[metapost] description of glyph operator for MetaPost v1.200

Taco Hoekwater taco at elvenkind.com
Wed May 6 21:41:44 CEST 2009


Stephan Hennig wrote:
> Ryan Van Wagoner schrieb:
> 
>> - Are there any ways to change the color or pattern that is used to
>>   unfill the "transparent" contours for cases where the background color
>>   is not white?
> 
> As far as I know, no.  One can of course copy the picture returned by
> the glyph operator element by element, colouring `white' contours
> differently.  

Exactly right.

> On the other hand, why not using `background' instead of a
> hard-coded `white' for counter-clockwise contours initially?  Taco?

The color "background" is a macro convention that does not exist at
the engine level, so it could not be used. Maybe a future version
of metapost will have eofill support and that will simplify things.

Below is the source code of the slide examples (all three rather
trivial)

Best wishes,
Taco

fontmapline "cmr10 CMR10 <cmr10.pfb";
picture q;

beginfig(1)
q := glyph 113 of "cmr10";
addto currentpicture also q scaled .2;
endfig

beginfig(1)
q := (glyph "Omega" of "cmr10") scaled .2;
for i within q:
   draw (pathpart i) withcolor .75green;
endfor;
endfig;

beginfig(1)
path p;
pickup pencircle scaled 2;
q := glyph  "one" of "cmr10" scaled .4;
for i within q:
   p:= pathpart i;
   draw p withcolor .75green;
   for j=0 upto length p:
     pickup pencircle scaled 1;
     draw (point j of p -- precontrol j of p) dashed evenly
        withcolor blue;
     draw (point j of p -- postcontrol j of p) dashed evenly
        withcolor blue;
     pickup pencircle scaled 5;
     draw (precontrol j of p) withcolor red;
     draw (postcontrol j of p) withcolor red;
     pickup pencircle scaled 5;
     draw (point j of p) withcolor black;
   endfor
endfor;
endfig;




More information about the metapost mailing list