[metapost] glyph operator and font map files

Taco Hoekwater taco at elvenkind.com
Mon Dec 21 20:24:35 CET 2009


Laurent Méhats wrote:
> Hello,
> 
> I'm trying to use the glyph operator and I'd like (a lot !) not to have to
> bother about font names and font map files. Regarding font names, the
> fontpart operator works just time. But I don't know how to deal with font
> map files (and I'm totally ignorant about them). Would it be possible that

Reading the metapost manual should help with that, but in short: For
PostScript fonts, conceptually there is a metric file (tfm), an official
postscript font name, a type1 font implementation file (pfb), and
sometimes also an encoding file (enc), which also has an official name.

The map glues these all together, for example:

   fontmapline "msbm10 MSBM10 <msbm10.pfb";

to the left is the tfm metric name, that is what you would use in the
glyph operator. in the middle is the postscript font name, and to the
right is the pfb file name.  The less than sign before the pfb name
indicates that the font should be subsetted in the output (if it is
missing the font characters are not included at all because the fonts
are assumed to be known by the system already, and two less-thans next
to each other indicate full pfb inclusion without any subsetting).
No encoding is used in this example.

When an encoding file is used, it is added before the pfb name,
and its name plus a code word (ReEncodeFont) is in quotes before
that. (The pdfmapline itself is also a bit more complicated due to
the need to quote the embedded " characters by using 'ditto' and
concatenation).

   fontmapline "rpxpplr TeXGyrePagella-Regular "&ditto&
        "encq8r ReEncodeFont"&ditto&" <q-8r.enc <qplr.pfb";


But usually, you don't have to concern yourself with this because
the fonts that are known by your tex installations will all be
added to the file pdftex.map automatically, and that file is
then automatically read by mpost.

> I create a local mpost.map or pdftex.map so that the following code will
> work ? And if so ... how should I proceed ?

So why did this fail?

That is because glyph only works on actual postscript fonts. xccsy10 is
metafont bitmap font, and that cannot work at all (neither do truetype
or opentype fonts).

If you absolutely want that font, you will have to convert it to a
PostScript Type1 font first. Using a large resolution pk file and
fontforge to autotrace it, probably, but if this sentence did not make
any sense to you, than perhaps you can find someone to do the conversion
for you.  The process is too involved to describe in a short email
message.

> %
> % Will cause a segmentation fault:
> %\usepackage{cmbright}		   % CM text & CM Bright math

That is interesting, I'll try myself tomorrow (segfaults are never ok).

Best wishes,
Taco


More information about the metapost mailing list