On 4/9/2020 11:01 AM, Taco Hoekwater wrote:
Hi,

Using multiple (text <x>) arguments in macros doesn’t work, you would
need to convert all but the last argument into (expr <x>) somehow.

That means that you probably cannot do a call like the one below at all.
(I, at least, do not see how you could convert one of those transparent
colours into an expr <x> argument)


SampleText ("Much Of This", transparent(1, .5, red  ) , transparent(1, .5, 
green  )) ;

The situation may get even trickier because withtransparency() and
transparent() both use a  (text <x>) argument internally as well,
and I am not quite sure why.

At this point, I think you may need Hans for advice, sorry.
Taco is right (of course). Indeed, one can end up in conflicts (mp has no transparency so it's all implemented using trickery). Anyway, using 'infont' has no real benefits as it maps onto textext, so one can just use that one (also because it supports the anchoring suffixes which saves you the shift):

\starttext
\startMPpage[instance=doublefun]

draw textext("more recent" ) withcolor red withtransparency (1, .5) ; draw textext("functionality" ) withcolor green withtransparency (1, .5) ; draw textext("was written" ) withcolor blue withtransparency (1, .5) ; draw textext("while listening" ) withcolor magenta withtransparency (1, .5) ; draw textext("to superb covers by") withcolor cyan withtransparency (1, .5) ; draw textext("Alyona Yarushina" ) withcolor yellow withtransparency (1, .5) ;

\stopMPpage
\stoptext

If something like "withcolor ... " is passed to a macro it has to be a text argument, not an expression (the transparent macro actually passed some abstraction); also, when making vardef's one need to omit the final semi colon in order to apply more properties to the 'return value'.

At some point I will update the metafun manual which means: remove old methods and exclusively use the new ones (currently the manual also discusses mpii while in context mkiv/lmtx we use mpiv macros).

For instance, when using colors one can best use named colors as these are consistent with the tex end, so often

  withcolor "red"

is better than

  withcolor red

etc etc etc etc

Hans


-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
       tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to