[NTG-context] "externalfigure" vs. "draw externalfigure" in metafun

Nicola nvitacolonna at gmail.com
Sat Sep 17 11:11:48 CEST 2011


In article 
<CALBOmsadxdYX8Q9pmVa2_cpM3RQ8j1MXKEPQGNaSJtAFUhc2OQ at mail.gmail.com>,
 Mojca Miklavec <mojca.miklavec.lists at gmail.com> wrote:

> Dear Hans,
> 
> I have problems with externalfigure inside metapost.
> 
> In MKII, only
>     externalfigure "something.png";
> works, while in MKIV only
>     draw externalfigure "something.png";
> is accepted.
> 
> Is there any chance to accept one of the syntaxes in both flavours?
> 
> Thank you,
>    Mojca
> 
> Minimal example:
> 
> \starttext
> \startMPpage
> % only good for MKII
> externalfigure "abc.png" xyscaled (5cm,8cm);
> % only good for MKIV
> % draw externalfigure "abc.png" xyscaled (5cm,8cm);
> \stopMPpage
> \stoptext

Does the following workaround work for you?

def mydraw text t =
   def f = begingroup t endgroup enddef;
   if picture f : draw f ; fi
enddef;
mydraw externalfigure "abc.png" xyscaled (5cm,8cm);

Nicola



More information about the ntg-context mailing list