*** Welcome to piglix ***

TeX font metric

TeX font metric
Filename extension .tfm
Internet media type application/x-tex-tfm (unofficial)
Developed by Donald E. Knuth
Type of format font metric

TeX font metric (TFM) is a font file format used by the TeX typesetting system. It is a font metric format, not an outline font format like TrueType, because it provides only the information necessary to typeset the font such as each character's width, height and depth. The actual glyphs are stored elsewhere. This is not unique to TeX; Adobe's AFM files and Windows' PFM (NTF on modern Windows PostScript driver) files use the same technique.

TFM files contain all of the information TeX needs to produce its device-independent (DVI) output. The actual glyphs are then inserted by the eventual DVI output driver or previewer, using, for instance, TrueType fonts, or fonts in METAFONT's PK format. The format is designed to be extremely compact: in the original Computer Modern distribution, every font's TFM file is smaller than 2 kB.

The canonical specification of the TFM format is embedded in the source code of the program TFtoPL.

A TFM file is broken down into a series of four-byte words, which can contain data fields of various lengths. Any data fields that are more than one byte long are held in big endian order. (The exact same file will be generated, regardless of architecture of the computer generating it.)


The six-word (24-byte) file header contains twelve unsigned 16-bit integers which describe the length of the file, the range of character codes contained in the font, and the size of each of the tables. A single TFM file describes between 0 and 256 characters, inclusive.


The body of the TFM file consists of a series of ten tables, each one except for the first laid out as an array of fixed-length fields. A 32-bit signed fixed-point number with 12 bits to the left of the decimal point, referred to as a fix_word, is used heavily. The first table, header, contains a checksum designed to prevent a document compiled into a DVI with one set of fonts from being printed with a different set, as well as ASCII descriptions of the character coding scheme (e.g., ASCII or TeX text) and the font family. It also contains the font's design size; all following fix_word values are interpreted as multiplication factors for this.


...
Wikipedia

...