LaTeX font selection scheme

While processing the source document, the LaTeX typesetting system doesn’t have much knowledge about the font it is using. It just calculates the positions of the characters, without needing to know shapes. The most crucial information it requires are the characters’ black boxes, which are defined by their widths, heights, and depths. These dimensions are stored in a separate external file known as a TeX font metric (.tfm) file for each font.

The character chapes come into play later. If a LaTeX system produces a .dvi file, a driver program combines character placement data from the .dvi file with information about character shapes from the .pk file or from outline descriptions (such as PostScript) to produce the character image on the output medium. However, other LaTeX systems like PDF TeX or VTEX bypass the production of a .dvi file and instead directly generate PDF or PostScript output. In that case, the character shapes are embedded when the corresponding formatter produces the final output.

LaTeX font selection scheme

LaTeX separates logical typography from low-level font files through the New Font Selection Scheme (NFSS). Instead of hardcoding specific font filenames into a document, LaTeX describes every typeface using five independent attributes—encoding, family, series, shape, and size—and maps those combinations to external font metrics (.tfm files) and glyph outlines at compile time. Within Aspose.TeX for Java, the Object TeX engine implements this standard selection architecture natively in Java, allowing you to switch typefaces, configure custom font packages, and resolve encodings without requiring an external TeX distribution.

How NFSS resolves fonts

When typesetting text or mathematics, LaTeX evaluates the current attribute state in two stages:

Core Topics Covered in This Chapter

The guides in this section progress from high-level text formatting commands to low-level NFSS internals, custom font installation, and character encoding models:

Fundamentals and attributes

Standard document typography

Low-level control and customization