Next Previous Contents

5. Conversion

In some cases it is necessary or useful to convert TrueType fonts into a format more suitable for use in other programs.

5.1 Converting to Bitmap Fonts

In some cases it may be desirable to produce a bitmap font from a TrueType font. A utility for converting TrueType fonts to .bdf format, ttf2bdf, is included with the FreeType library.

5.2 Converting to Adobe Type 1

Adobe PostScript Type 1 fonts are supported directly by many programs, including WordPerfect (see section WordPerfect) and most X servers. For those which do not support TrueType fonts at all, such as WordPerfect, it is necessary to convert the fonts to Type 1 format in order to use them.

There are a number of commercial programs that will perform such conversions, however few if any of them are available for Linux. There is an open source program called ttf2pt1 which in conjunction with the Type 1 utilities (available at the same site) can perform the necessary conversions.

Once you have ttf2pt1, ttf2pfa, and t1asm installed in your path, the following shell script (or something similar) can be used to convert a TrueType .ttf font file into an Adobe Type 1 .pfb file with an .afm font metric file (needed by WordPerfect and some other programs):

#!/bin/sh
# dofont - convert a .ttf to .pfb/.afm
# usage: dofont <fontfile>
#         converts <fontfile>.ttf -> <fontfile>.pfb & <fontfile>.afm

# Make the .afm and a type 3 .pfa which we will junk
ttf2pfa $1.ttf $1

# Make the type 1 (pseudo) .pfa
ttf2pt1 $1.ttf $1

# Make a .pfb
t1asm -b $1.pfa > $1.pfb

# Junk the pseudo .pfa
rm -f $1.pfa

This process works by first using ttf2pfa to create a Type 3 .pfa file (which is not usable by most applications) and an .afm file; if you do not neet .afm files for your programs then you can skip this step. Then ttf2pt1. is used to create a Type 1 .pfa font. However, this file is not a correctly formed font file and t1asm must be used to create a proper file from it. The -b option is used to create a .pfb (binary) font file; if you wish you can create a proper .pfa (ASCII) font file by removing the -b option, however not all programs will take .pfa files and the file will be larger.

Once you have the Type 1 font files, install them as appropriate to the programs you wish to use them with; Type 1 font installation is outside the scope of this document except for specific applications mentioned in the section Applications.

5.3 Converting to Adobe Type 42

An Adobe Type 42 font is essentially a PostScript wrapper around a TrueType font. Since the font data is not changed at all, there is no loss of quality in conversion. If you have a PostScript printer that understands such fonts and you can convince your applications to use and display them (if applicable), then this is probably the best way to deal with the fonts.

You can use the program ttfps to convert the files.


Next Previous Contents