Wednesday, June 29, 2005

Converting TTF for use with Linux/Unix apps

There are some apps on Linux/Unix that refuse to play nicely with TrueType or OpenType fonts. (The WxWindows library is one that gave me such headaches.) For such programs, the best bet is to convert the TTF to Postscript Type 1 fonts using TTF2PT1. There's even a version for Windows.

After installing TTF2PT1, convert the font to Type 1 using the command:
ttf2pt1 -a -e -llatin1 filename.ttf

For creating fonts for use with Ghostscript:
ttf2pt1 -a -b -llatin1 filename.ttf

You ought to have a files suffixed with .afm and .pfa (or .pfb for use with GhostScript) after the conversion completes.

Note that you should NOT do this if the font license disallows such a conversion.
Drop the font in the appropriate directory on Linux/Unix and from that directory, build the fonts.scale and fonts.dir file with
mkfontscale
mkfontdir
.

If needed, add the directory to the X font path as mentioned in this tip.

No comments: