29.11.2012 Views

MetaFun - Pragma ADE

MetaFun - Pragma ADE

MetaFun - Pragma ADE

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

1.15 Text<br />

Most dashpatterns can be defined in terms of on and off. This simple on--off dashpattern is predefined<br />

as picture evenly. Because this is a picture, you can (and often need to) scale it.<br />

draw (0,0)--(10cm,0) dashed (evenly scaled 1mm)<br />

withpen pencircle scaled 1mm ;<br />

Opposite to a defaultpen, there is no default color and default dash pattern set. The macro<br />

drawoptions provides you a way to set the default attributes.<br />

drawoptions(dashed evenly withcolor red) ;<br />

Since METAFONT is meant for designing fonts, the only means for including text are those that permit<br />

you to add labels to positions for the sole purpose of documentation.<br />

Because METAPOST is derived from METAFONT it provides labels too, but in order to let users add<br />

more sophisticated text, like a math formula, to a graphic, it also provides an interface to TEX.<br />

Because we will spend a whole chapter on using text in METAPOST we limit the discussion here to<br />

a few fundamentals.<br />

pair a ; a := (3cm,3cm) ;<br />

label.top("top",a) ; label.bot("bot",a) ;<br />

label.lft("lft",a) ; label.rt ("rt" ,a) ;<br />

These four labels show up at the position stored in the pair variable a, anchored in the way specified<br />

after the period.<br />

top<br />

lft rt<br />

bot<br />

The command dotlabel also typesets the point as rather visible dot.<br />

pair a ; a := (3cm,3cm) ;<br />

dotlabel.top("top",a) ; dotlabel.bot("bot",a) ;<br />

dotlabel.lft("lft",a) ; dotlabel.rt ("rt" ,a) ;<br />

top<br />

lft rt<br />

bot<br />

The command thelabel returns the typeset label as picture that you can manipulate or draw<br />

afterwards.<br />

pair a ; a := (3cm,3cm) ; pickup pencircle scaled 1mm ;<br />

drawdot a withcolor .625yellow ;<br />

draw thelabel.rt("the right way",a) withcolor .625red ;<br />

Text Welcome to MetaPost<br />

41

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!