4

Hello I am trying to use Metapost to create a font, and I have been using the Metafontbook to study, there it states that the penstroke command is a type of abbreviation command for the command fill that goes through the left sides then through the right side and then cycles. I have been using Troy Henderson's metapost previewer and at least there it seems such command was not specified, also it is not commented anywere in the metapost user's manual.

5

Yes penstroke is implemented in plain Metapost. It is in plain.mp:

...
vardef lft primary x = x + if pair x: (pen_lft,0) else: pen_lft fi enddef;
vardef rt primary x = x + if pair x: (pen_rt,0) else: pen_rt fi enddef;
vardef top primary y = y + if pair y: (0,pen_top) else: pen_top fi enddef;
vardef bot primary y = y + if pair y: (0,pen_bot) else: pen_bot fi enddef;

vardef penpos@#(expr b,d) =
 (x@#r-x@#l,y@#r-y@#l)=(b,0) rotated d;
 x@#=.5(x@#l+x@#r); y@#=.5(y@#l+y@#r) enddef;

def penstroke text t =
 forsuffixes e = l,r: path_.e:=t; endfor
 fill path_.l -- reverse path_.r -- cycle enddef;
path path_.l,path_.r;
...

You use it just as described in the MetafontBook.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.