Go to the first, previous, next, last section, table of contents.


8. Automatic Font Generation

One major problem with TeX and the Computer Modern fonts is the huge amount of disk space a full set of high resolution fonts can take. Dvips solves this problem by creating fonts on demand, so only those fonts that are actually used are stored on disk. At a typical site, less than one-fifth of the full set of Computer Modern fonts are used over a long period, so this saves a great deal of disk space.

Furthermore, the addition of dynamic font generation allows fonts to be used at any size, including typesetter resolutions and extremely huge banner sizes. Nothing special needs to be done; the fonts will be automatically created and installed as needed.

The downside is that it does take a certain amount of time to create a new font if it has never been used before. But once a font is created, it will exist on disk, and the next time that document is printed it will print very quickly.

It is the `MakeTeXPK' shell script that is responsible for making these fonts. It must echo the filename of the new font (and nothing else) to standard output. Use standard error for commentary. `MakeTeXPK' is passed various arguments, the first of which is the font it's supposed to make. You can override the other argument conventions with environment variables or at compilation time; see the Kpathsea documentation.

The `MakeTeXPK' script supplied invokes Metafont (using the Sauter scripts first, if necessary and if they are installed) to create the font and then copies the resultant `pk' file to a world-writable font cache area.

`MakeTeXPK' can be customized to do other things to get the font. For instance, if you are installing dvips to replace (or run alongside) an existing PostScript driver, and that driver demands `gf' fonts, you can easily modify `MakeTeXPK' to invoke `gftopk' to convert the `gf' files to `pk' files for dvips. This provides the same space savings listed above.

Because dvips (and thus `MakeTeXPK') is run by a wide variety of users, there must be a system-wide place to put the cached font files. In order for everyone to be able to supply fonts, the directory must be world writable. If your system administrator considers this a security hole, `MakeTeXPK' can write to `/tmp/pk' or some such directory, and periodically the cached fonts can be moved to a more general system area. The cache directory must exist on the `pk' file search path in order for `MakeTeXPK' to work.


Go to the first, previous, next, last section, table of contents.