[metapost] Positioning text arbitrarily in the canvas

Hartmut Henkel hartmut_henkel at gmx.de
Tue Mar 24 22:50:23 CET 2009


On Tue, 24 Mar 2009, Jesús Guillermo Andrade wrote:

> Dear Fellows: While reading Mr. Hobby?s guide to Metapost, I tried to figure
> our how to position the text I wanted to include around a polygon. My efforts
> however, have been sterile since there is no documentation regading how to
> place a given string arbitrarily in the "canvas" of Metapost.
> I use the following statements in order to "embed" the font in the final eps
> file:
> prologues:=3;
> filenametemplate "%j-%3c.eps";
> fontmapfile "pdftex_dl14.map";
> Thus, metapost have access to the biggest font list in my system. From there
> on, I would only have to move it around:
>
> draw "A&M Despacho de Abogados" infont "t1-yvtbc-c";
>
> What can be done in order to position the text with precise coordinates
> without using the label command?

why not use the label command? for precise positioning you may set
labeloffset:=0pt. Anyway both direct draw and label/thelabel are rather
similar, e. g.:

beginfig(1)
draw origin;
draw "A&M Despacho de Abogados" infont "t1-yvtbc-c" shifted (10mm,10mm);
draw "A&M Despacho de Abogados" infont "t1-yvtbc-c" shifted (20mm,20mm);
draw "A&M Despacho de Abogados" infont "t1-yvtbc-c" rotated 15
  shifted (5mm,5mm);
labeloffset:=0pt;
draw thelabel.urt("A&M Despacho de Abogados" infont "t1-yvtbc-c", origin)
  rotated 2;
endfig;
end

Regards, Hartmut


More information about the metapost mailing list