[metapost] Beginners question

Laurence.Finston at gmx.net Laurence.Finston at gmx.net
Tue Sep 12 15:24:30 CEST 2023


In your example, you use a low-level command. Normally, one uses `label' or `dotlabel' to include text in a MetaPost file and this is what I'd recommend.

If you're using TeX for the typesetting, you can define any PostScript font for which the necessary files are available (.tfm and .pfb). In a "normal" TeX installation, e.g., TeXLive or MikTeX, this will certainly be the case for the computer fonts and the standard PostScript fonts.

You can access any font you want using `verbatimtex', e.g.,

verbatimtex \font\largeit=cmbxti10 scaled \magstep3 etex;

Then, in a label command, you just have to use the control sequence \it, e.g.,

label(btex {\largeit Abc} etex, (0, 0));

You can put as many font definitions or other TeX code as you want (within reason) in the `verbatimtex' command.

If you don't use any macros, cmr10 is the default (if you're using TeX).

If you're using, say, Times-Roman as your font, and/or if you're using `troff' or something else for the typesetting, you'll have to check the manual or someone else will have to answer, because I never do either of these things. I have used Times-Roman or some other standard PostScript font in the past, though.

> Gesendet: Dienstag, 12. September 2023 um 11:08 Uhr
> Von: "Patrick Gundlach" <patrick at gundla.ch>
> An: metapost at tug.org
> Betreff: [metapost] Beginners question
>
> Hello all,
>
> I try to define a user interface such as:
>
> draw "some text" infont "myfontfamily" withstyle "bold";
>
> where infant ... and withstyle ... are optional ( and the defaults should be "text" and "regular").
>
> (How) Is it possible to achieve this?
>
> Is it advisable do to so? Or should I rather create an interface such as
>
> draw text ("some text", "myfontfamily", "bold")?
>
>
> Patrick
>
>
>
>
> --
> http://tug.org/metapost/
>



More information about the metapost mailing list.