The new LCDF typetools and TTF files in LaTeX

For quite some time now, people are generating TeX font metrics out of TTF files to be able to use TrueType fonts from within (La)TeX. Although the developments of pdflatex have brought significant alleviation to this process by making it possible to natively use TTF files, it is still far from straightforward to actually get a font run with ligatures, kerning, and all the fine points those LaTeX fanboys are after.

The tools mostly in use for generating the necessary files include ttf2tfm, vptovf, and possibly afm2tfm. One major reason for using latter is that ttf2tfm was not always quite reliable at extracting ligature or kerning information out of the TTF file; instead of

$ ttf2tfm myFont.ttf -q -T myEncoding.enc -v myFont.vpl rmyFont.tfm >>

one was often better off going

$ ttf2afm -e myEncoding.enc -o myFont.afm myFont.ttf 2> /dev/null
$ afm2tfm myFont.afm -v myFont.vpl -T myEncoding.enc rmyFont.tfm | sed "s/>

and then discarding myFont.afm.

Either of the methods had to be followed by a call to vptovf.

The new kid in TTF town

With this weekend's advent of Eddie Kohler's LCDF typetools 2.79, all of the above can be done reliably in one step only. What you need is a working otftotfm, for example,

$ otftotfm --version
otftotfm (LCDF typetools) 2.79
Copyright (C) 2002-2009 Eddie Kohler
This is free software; see the source for copying conditions.
There is NO warranty, not even for merchantability or fitness for a
particular purpose.

Traditionally, otftotfm works on, well, OTF font files; this would include TTF files derived from it. You can identify those with the otfinfo tool which also comes with the LCDF typetools. An OTF-derived font file always contains the GPOS table to host kerning information, e.g.,

$ otfinfo -t Bello-Pro.otf
112924 CFF
22160 GPOS
7956 GSUB
96 OS/2
1542 cmap
54 head
36 hhea
3808 hmtx
6 maxp
1560 name
32 post

In an old-style TTF, the kerning information sits in the kern table, such as

$ otfinfo --tables times.ttf
6800 DSIG
166 GDEF
2474 GSUB
1678 LTSH
86 OS/2
4500 VDMX
5994 cmap
1990 cvt
1585 fpgm
16 gasp
296406 glyf
40232 hdmx
54 head
36 hhea
6696 hmtx
5220 kern
6700 loca
32 maxp
7369 name
16895 post
3859 prep

To date, otftotfm was able to extract all info of such a font except kerning, now it does it all. The one call that you need is

$ otftotfm \
--no-type1 \
-fkern \
--encoding="myencoding.enc" \
--map-file="" \
"myFont.ttf" \

This will generate the files mytexname.vpl, mytexname.tfm, and mytexname--bas.tfm, plus the encoding file (mostly a_012foobar.enc), and generate the correct entry in the map file
Copying those files to the correct location (which otftotfm can also do for you, see the manual), and you'll be able to use the font in plain TeX already.

For a more concise tutorial on how to use otftotfm to include your favourite TrueType into LaTeX, see here.

If you have issues, you might want to look at the TeX font error cheat sheet.

Happy TeXing!