[Univ of Cambridge] [Dept of Engineering]

LaTeX and fonts

Introduction

The main focus of this document is on the use of fonts in LaTeX, though some wider issues are addressed too. Typesetting's an old, arcane, aestheics-ridden subject of which fonts are a small but surprisingly complex part. Even apparently simple operations are non-trivial - for example, when a character is enlarged, the lines are proportionally thinner than when the character is reduced. Rules for controlling these changes (and anti-aliasing, kerning etc) are contained in hints that form part of the font definition.

In consequence, LaTeX's use of fonts isn't trivial for users or system managers, but usually isn't too hard either. These notes go way beyond what a standard LaTeX user needs, but might be useful when something doesn't work as expected.

Font formats

There are many thousands of fonts. Fonts that share the same name needn't be the same - the appearance of a "Garamond" font, for example, might well depend on the supplier.

There are also several font formats. Systems (especially in the past) required separate screen fonts and printer fonts. Screen fonts are low-resolution, bitmapped images which don't scale well (so different point-sizes call for different images) and can take a lot of disc-space. Printer fonts are for the final hardcopy so they need to be high-resolution. They're often produced from a set of specifications which can produce different sizes and styles of characters according to requirements. Postscript (a page description language rich in curve-drawing and filling commands) can be used to define fonts. Postscript type 1 fonts were used in the 1980s and continue to be used. ATM (Adobe Type Manager) is a subset of the postscript interpreter that runs on the computer, not in the printer. It needs a single bitmap font plus a printer font. ATM scales Type 1 PostScript fonts for screen display and imaging for both PostScript and non-PostScript printers.

In the early 1990s TrueType emerged so scalable fonts could generate bitmaps on-demand as though each size had been designed by hand. On Windows such file have a .ttf suffix. Other formats exist too -

TrueType is built into most Windows/MacOS systems. PostScript Type 1 fonts are well-established and supported directly by most high-end output devices. TrueType (which compared to postscript uses relatively smarter fonts and a dumber interpreter) allows better hinting than type 1 does. Unlike typeType fonts, PostScript fonts require two separate files: one contains the character outlines, and the other contains metrics data. For Windows systems using PostScript, a "PFB" file contains the outlines, while a "PFM" file carries the metrics. The system-independent "AFM" metrics file can be converted to a Windows PFM file. In LaTeX the metric information is in "TFM" files.

More recently, many PostScript Level 2 printers (and all PostScript 3 printers) have TrueType rasterisation built in. However, with some Windows printer drivers the user must change the printer driver settings in software to take advantage of this feature (downloading TrueType as Type 42).

How LaTeX uses fonts

LaTeX initially used metafont fonts, the TFM files (containing the metrics) and the PK files (containing the shapes) having to be installed beforehand. Nowadays the TFM and PK files can be created on-demand, and postscript fonts can be used.
[from .ltx to .ps]

LaTeX's use of metafont fonts

When latex processes a source file to produce a DVI file it needs to know not only the size of each character but also This kind of information is contained in a TeX Font Metrics file (a TFM file) which is required whatever format the fonts are in. The DVI files contains the coordinates of the characters but not the font shapes. When the DVI file is printed out or converted to postscript the shape of each character can be imparted in 2 ways

Using Postscript fonts in LaTeX

Though originally [La]TeX used metafont-generated fonts (e.g. Computer Modern Roman) it can also use postscript fonts. There are some standard postscript font sets Most LaTeX installations support at least the core set of 13 using the packages below. To use (for example) Helvetica, one just adds \usepackage{helvet}. Note that LaTeX has the concept of a default Roman font and a default Sans Serif font. Using \usepackage{helvet} will change the default Sans Serif font but your document will still use the default Roman font.
Package Description
avant AvantGarde font as default sans
avantgar ITC Avant Garde
bookman Bookman font as default roman
chancery Zapf Chancery font as default roman
charter default roman
courier default ttdefault
helvet Helvetica font as default sans
helvetic Helvetica-Oblique font as default sans
ncntrsbk NewCenturySchlbk-Roman
newcent NewCenturySchoolbook font as default roman
palatcm Palatino + Computer Modern math fonts
palatino Palatino font as default roman
pifont Pi font support (special characters)
times Times font as default roman
utopia Utopia font as default roman
zapfchan ITC Zapf Chancery as default roman
These packages are installed on our system in /usr/local/teTeX/share/texmf/tex/latex/psnfss/.

LaTeX font attributes

Every text font in LATEX has five attributes: A sample LaTeX specification is T1 ptm bit 18pt (Adobe Times Bold Italic 18pt) and (using TeX font naming) ptmbq at 18pt in TeX. There are LaTeX commands to change each of the attributes. Fonts for math mode are dealt with rather differently. They have the same 5 attributes but no commands to change the attributes individually. There's a lack of postscript fonts with mathematical characters.

Associated LaTeX filetypes

All the LaTeX files should be under one directory called $TEXMF in the documentation. On our system $TEXMF is /usr/local/teTeX/share/texmf.

Associated LaTeX utilities

LaTeX packages to support new fonts usually contain detailed installation details. If you need to go it alone (or something goes wrong) you may have need of the following

LaTeX font names

In the configuration files the fonts are codenamed. The naming scheme is FNW{V}E{n} where: For example, the font Adobe Garamond demibold is pgad8a.

Things that can go wrong

See Also

The following sites have been useful - thanks go their authors for their help

Glossary


PostScript and Adobe are registered trademarks of Adobe Systems Inc.
[LaTeX] [Postscript] [Help]
Updated March 2002
tpl@eng.cam.ac.uk