[tex-live] Discovering Fonts

Karl Berry karl at freefriends.org
Sat Sep 22 00:41:36 CEST 2007


    How do you know which fonts exist in which encodings?

You don't.

    How do you know which fonts have which shapes availible?

You don't.

    I tried looking at .mf and .tfm files, realising that these files
    don't seem to encode this informtaion.

They don't, at least not in any reliable way.
(Few fonts are .mf, anyway.)

There are various heuristics to guess with, but that's about it.
For instance, <something>8y.tfm would be the texnansi encoding.
Ditto texnansi-<something>.tfm.

However, if you restrict your attention to outline fonts (not
unreasonable these days IMHO), it would be a lot easier and faster to
just parse psfonts.map; in many cases, that will have an explicit
reencoding, so you know the encoding.  And you can guess the shape from
the FontName, e.g., the fact that Cherokee-Bold is bold is pretty parsable.

Still, no general scheme will always work; there are too many font names
that follow no useful pattern.  What I can imagine is a script that
simply special cases names, so that you can pass it, say, cmr10, and it
can return stuff like

family=ComputerModern
encoding=TeX text
weight=regular
...

That's my best suggestion.  Maybe others have better ones.  

    If I can work this out I was planning on writing a program that is
    capable of scanning your texmf creating a font preview document,
    allowing you to easily select a font you like to look of. Unless
    ofcourse this program already exists.

I know of no such program, although people ask for it not infrequently.
If you can manage to get something working, that would be great.

Conceivably some of the files at http://tug.org/fontname would be of use
in deconstructing names, though I can't say for sure.

Best,
Karl


More information about the tex-live mailing list