Metafont

Metafont
Developer(s)Donald Knuth
Stable release
2.71828182 / January 2021; 3 years ago (2021-01)
Operating systemCross-platform
TypeComputer language
LicensePermissive

Metafont is a description language used to define raster fonts. It is also the name of the interpreter that executes Metafont code, generating the bitmap fonts that can be embedded into e.g. PostScript. Metafont was devised by Donald Knuth as a companion to his TeX typesetting system.

One of the characteristics of Metafont is that the points defining the shapes of the glyphs—for example top of a stem, or intersection of a stem and crossbar—are defined with geometrical equations; the intent that the three stems of an ‘m’ are equally spaced horizontally might be expressed as if points 1, 2, and 3 are at the bottom ends of the three stems, whereas the intent that they all end on the same vertical position would be .

Metafont is a macro language, where operations such as "draw a lower case top of stem serif at point 4" might appear as one macro instruction (with the point as argument) in the program for a letter. For describing shapes, Metafont has a rich set of path construction operations that mostly relieves the user of having to calculate control points.

Many families of Metafont fonts are set up so that the main source file for a font only defines a small number of design parameters (x-height, em width, slant, vertical stroke width, etc.), then calling a separate source file common for a whole range of fonts to actually draw the individual glyphs; this is the meta aspect of the system.