Printing TrueType fonts in Unix

There is currently no standard way of printing under X11. Most applications produce PostScript which is then either sent to a PostScript printer, or printed using GhostScript, the Free PostScript interpreter. Don't mention Xprt.

This document covers a few ways of printing with TrueType fonts from Unix.

Conversion to Type 42

A Type 42 font is a TrueType font encapsulated in a PostScript dictionary that makes it superficially similar to other PostScript fonts; the conversion is therefore lossless (i.e. all the information in the TrueType font is preserved). Unfortunately, only recent versions of PostScript (starting with Adobe Postscript 2013) know how to deal with such fonts. As Type 42 fonts look like the more usual Type 1 fonts, most application software can be coerced into using them. I have successfully used this approach with LaTeX2e and dvips.

If your printer supports Type 42, this is by far the best solution. This small PostScript utility (to be sent to your printer) will help you determine whether this is indeed the case.

Conversion of TrueType into Type 42 can be done by ttfps (this program also generates AFM font metric files). Alternatively, you may want to use ttf2pf, provided by the Polish TeX Users' Group (GUST), which uses GhostScript and does not require any compilation. There is also ttftot42.

The Type 42 format is described in the Adobe technote 5012. It can be found with the other Adobe technical notes for developers.

Conversion of outlines to Type 1 or Type 3

It is possible to convert TrueType fonts into more traditional PostScript fonts; unfortunately, the process loses all instructions (hinting information). This means that unless you are using a very high-resolution device the results will be somewhat disappointing at small sizes.

Type 1, the usual PostScript font format, contains outline descriptions in a restricted form of PostScript; Type 1 fonts can be used with software such as X11, IBM OS/2, or the Adobe Type Manager (ATM). Type 3 fonts, on the other hand, require a full PostScript interpreter.

Programs for doing the conversion include ttf2pt1 (conversion to Type 1) and ttf2pfa (conversion to Type 3).

Conversion to bitmaps

The FreeType library -- of which you probably already have a copy -- should enable you to generate bitmaps of your favourite TrueType fonts. The contrib directory of the full distribution contains programs for conversion to the TeX pk format and the Adobe/X11 BDF format. Similar utilities for Your Favourite Bitmap Format should not be difficult to write.

Use of GhostScript

Recent versions of GhostScript can use TrueType fonts, both as Type 42 font dictionaries or directly referenced in the Fontmap file; the latter option only works if GhostScript was compiled with the ttfonts option, which is not always set by default on Unix systems. In both cases, instructions (hints) will be ignored -- expect the results to be disappointing at small sizes.

Use of Distiller

Adobe's PS to PDF conversion software knows about Type 42 fonts and properly embeds them in the resulting PDF file, at least in version 3.0.

Further work

Printing TrueType fonts under Unix consists of hacks in hacks in hacks; furthermore, the results are not always satisfactory. If you want to help changing this state of affairs, here are a few ideas of projects that I would like to see done.

Providing TrueType support for the X print server is currently of dubious utility.

All of these projects should use the FreeType library, both because of its high quality and for legal reasons (the FreeType developers use a very liberal licence, which is needed for inclusion in e.g. X11).


PostScript and Adobe are registered trademarks of Adobe Systems Inc.


Juliusz Chroboczek.

Copyright © 1998-1999 by Juliusz Chroboczek

Permission is hereby granted, free of charge, to any person obtaining a copy of this material, to deal in it without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of this material, and to permit persons to whom this material is furnished to do so, subject to the following conditions: