[NTG-context] metapost code fails to work in mkiv
Hans Hagen
pragma at wxs.nl
Wed Dec 3 16:25:53 CET 2008
Mojca Miklavec wrote:
> Hello,
>
> A while back I wrote this dirty code (read as: hack) in attachment
> that allows multiple optional parameters in metapost functions, for
> example:
>
> draw_text("text");
> draw_text(angle(30),"text");
> draw_text(angle(30),align(right),"text");
> draw_text(align(center),"text");
>
> The code compiles fine with mkii, but not with mkiv. I would be
> grateful for any hints about how to fix this.
>
> I get the error:
>
> mplib | mp terminal: ! Missing `,' has been inserted.
> <to be read again>
> ,
> textext->...etextext(SUFFIX2)(rawtextext((EXPR3)),
> origin)else:thetextext(SUF...
>
> dummy->begingroup(TEXT2)
> endgroup
> gp_put_text->...tt)=tt.enddef;pict:=dummy((TEXT1))
> ;let,=@;endgroup;draw(gp_t...
> <*> ...m, 1cm), angle(30), textext.drt("rotated"))
> ; ;
> ! An expression can't begin with `;'.
> <inserted text>
> 0
> <to be read again>
> ,
> textext->...etextext(SUFFIX2)(rawtextext((EXPR3)),
> origin)else:thetextext(SUF...
>
> Thanks a lot,
> Mojca
>
> (The code is taken out of
> http://dl.contextgarden.net/modules/t-gnuplot/metapost/context/third/gnuplot/mp-gnuplot.mp
> and I'm slowly plucking up my courage to port the code to mkiv.)
\startMPcode
def fuzzy(expr a, b, c) =
draw image(
draw textext(c) ;
currentpicture := currentpicture rotatedaround(center
currentpicture,b) shifted a ;
) ;
enddef ;
fuzzy((1cm,1cm), 30, "rotated") ;
\stopMPcode
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------
More information about the ntg-context
mailing list