[tex-k] Which fonts are installed?
olaf at infovore.xs4all.nl
Mon Feb 24 22:04:54 CET 2003
Fabio Stumbo writes:
> I have a Linux box with mandrake 9.0, which ships tetex 1.07.
> My problem is: how can I figure out which are all fonts which are
> installed/usable ?
> (I looked on the web for some help, but I am not been able to find
> anything: I think this is the right place to ask.)
> I know there is a useful file called testfont.tex: its only drawback is
> that it asks me for the font to be tested... I would like to tell him:
> test all fonts!
> Somebody suggested me to look for all *.tfm files and test them, with a
> script. It works, but it doesn't show all the fonts (for example, ecbl is
> missing), and it can also show some font which is not available.
> Wouldn't it be nice if there were an utility for this?
This is actually a hard problem, and I'm not aware of a working
program that does this for you.
Some background on the problem: what TeX itself refers to as a font is
actually just the collection of font metrics in a .tfm file. This
tells TeX the sizes of the characters in the font. A .tfm file can
also contain the name of the encoding (which code corresponds to which
visible character, frex code #65 is 'A', code #66 is 'B'...) --
however, TeX doesn't use that information, and instead the typical
pattern is that to use a font in TeX you include a file which
specifies the encoding as well.
But all this only talks about metrics. You also need descriptions of
the actual characters (the "real" font), which are needed by drivers
like dvips to produce something that can be sent to a printer. So
just looking at the tfm files will not tell you which fonts are
installed. For example, the teTeX distribution contains metric and
macro files that support a number of commercial fonts that are
Another complication is that if you have metafont sources for a font,
then metafont can generate the tfm file for you at the moment TeX
requests it. So if cmr10.tfm is missing, it can be generated from
To this we've added yet another complication: files like cmr10.mf,
cmr12.mf are often written to contain just a set of parameters, and
these are used in combination with definition common to the entire
Computer Modern family to generate the actual characters. In a number
of cases, Computer Modern among them, the parameter files themselves
can also be generated on an as-needed basis.
And metafont sources are not the only way to provide the actual fonts.
Type1 or TrueType fonts are also commonly used, and that doesn't
exhaust the list of possibilities.
The upshot is that in order to know what fonts are available, you need
to take a number of factors into account:
- A font can be provided with pk and tfm only.
This doesn't actually seem to happen.
- A font can be provided with metafont sources.
In that case, the sources would be in a subdirectory of
texmf/fonts/source/ and you'd have to parse the files in there to
figure out exactly what it is they supply. Look for the
'font_identifier' lines, and note that these do usually not include
the size, so that cmbx10 and cmbx12 both have CMBX as their
- A font can use the mktexmf script to generate its parameter files.
In this case, the font's metafont sources need to be available as
well, of course. The font_identifier isn't the paramater file
(just note how little mktexmf actually writes) and you can at least
use that one to identify font families that are available.
- A font can be provided as a type1 (pfb or pfa file) and set of
tfm (and often vf) files. While it is in principle possible to
generate a tmf on the fly given an afm file, this is in practice not
done. So for these fonts it becomes a question of ensuring that
the matched files are present.
- Similar for ttf, and so on.
It seems to me that a utility that identifies just which fonts are
available for use by TeX can written by taking the above into account.
In some cases it would report families rather than individual fonts,
and there might be some omissions if the metafont source is too
convoluted, but it sure sounds doable.
Of course, in many cases a font only become more than marginally
useful if you have a set of TeX macros to set it up in a convenient
manner. But that's another kettle of fish, and much less tractable.
Still, a font-finder utility would be useful, and might be an
interesting project. So if you feel the urge to do something for the
TeX community, this is your chance. :-)
(This space left blank for technical reasons.)
More information about the tex-k