|developer||Donald E. Knuth|
( January 2014 )
|License||LaTeX Project Public License|
|CTAN-Comprehensive TeX Archive Network|
Metafont is an abstract description language for defining vector fonts . It is also the name of the associated interpreter that executes the Metafont code and generates bitmap fonts of a certain resolution. It was developed by Donald E. Knuth as a companion of TeX to set the second volume of The Art of Computer Programming , as he was dissatisfied with the result of the phototypesetting of the first volume. Metafont is specially designed to support TeX and is therefore part of many TeX distributions.
Knuth started working on the font creation software in 1977 and released the first version of Metafont in 1979. Because of inadequacies in the original Metafont language, Knuth developed a completely new Metafont system in 1984, and this revised system is in use today. In analogy to TeX, the version number approaches Euler's number and will be changed to e after Knuth's death .
The shape of the letters is defined in Metafont using geometric equations, which can be complex. Unlike the more common outline fonts (such as TrueType or PostScript - Type 1 fonts ), a Metafont font consists mainly of lines from "pens" of a certain width, together with filled areas. Therefore, a Metafont file does not describe the outline of the characters, but the path of the pen and the respective width of the line when drawing. A nice example can be found in u. G. Metafont tutorial in chapter 0.5.
Some simpler Metafont fonts, such as For example, the calligraphic math fonts of the Computer Modern family use a single stroke of a relatively large pen to define each visible “stroke” of a character. More complex fonts, such as the Computer Modern family of Roman text fonts, typically use a narrow pen to outline the visible "strokes" that are then filled. With a standard outline font, on the other hand, the outlines are always dimensionless.
The use of non-dimensionless pens to outline areas usually leads to rational, higher-order curves for the actual outline, which means that converting Metafont fonts to TrueType or PostScript is often extremely difficult and can usually only be approximated - TrueType only uses second-degree curves , PostScript only uses third-degree curves .
Metafont differs from other systems in the variability of the fonts, which are specified by a few parameters such as aspect ratio, inclination, line width or serif size (hence the meta in the name); by changing relatively abstract parameters at one point in the Metafont file, a change in appearance that is consistent throughout the font can be achieved. Via “Width of a narrow line”, “Size of serifs”, “Inclination of the ellipse in curves”, for example, B. a neo-classical antiqua can be changed to a modern sans serif font .
Computer Modern Roman illustrates many uses of these possibilities; A typical TeX installation contains font styles in sizes from 5 to 17 points for a certain font , with the same line weight (instead of increasing due to the upscaling) in all sizes and size-dependent character widths for better legibility. Other fonts from Computer Modern, in particular Typewriter and the sans-serif styles, are, as already mentioned above, essentially defined using the same Metafont file, but with different global parameters.
Other parameters such as the O correction (the amount that a rounding is drawn larger) or the blackness parameter (lines become a little thicker) are used to adapt to different output devices. In addition, the definition of ligatures and the influencing of the kerning are possible in Metafont .
Some time ago, a descendant of Metafont was created that outputs a PostScript file: MetaPost . From this METATYPE1 was later developed, which generates a Postscript Type 1 font with the metric files required for TeX. However, neither of them can use pens, but rather describe the outline of the image or character.
The most important font developed in Metafont is Knuth's Computer Modern , which is used by TeX as the standard font.
The Metafont interpreter can also be executed interactively and knows commands to output the images produced on the screen. Knuth said he uses Metafont as a kind of desktop calculator for solving complicated equations, although he now uses MetaPost for math illustrations.
Difference between Metafont and Type 1 fonts or DVI and PDF files
With Metafont fonts, an adapted set of bitmap fonts must be created for each device . The idea of Metafont corresponds to that of DVI files , in which no fonts, but only references to them are included. It is not the creator of the document who supplies the fonts, but rather the person who processes (reads or prints out) the document by loading the bitmap fonts optimally created for this device by the DVI driver. However, the corresponding fonts must be available on the device.
With PDF files, on the other hand, the approach is that all fonts are included in the PDF file. You can integrate different bitmap fonts, but these will not be optimally adapted for different devices. Therefore, only vector fonts (e.g. Type 1 fonts) are recommended for portable PDF files. When printing, on the other hand, Metafont fonts that are adapted to the special printer provide quality advantages over Type 1 fonts.
Here is a small example from the Metafont logo font, a very simple font. Each point has an X and a Y coordinate, which are denoted by x1, y1, x2 etc. The term z4 is an abbreviation for (x4, y4).
Line 1 defines a new character with the name F and the character code 14.
In line 2, the x positions of points 1, 2 and 3 are set to leftstemloc , a value that indicates the position of the left bar.
Line 3 defines x4 so that, apart from the over-shot ho , it is the same distance from the right edge (specified by w ) as point 1 is from the left edge.
In lines 10 to 14, points 1, 3 and 4 are finally connected by straight lines (the left and top lines from the F) and the small horizontal line in the middle is drawn by connecting points 2 and 5.
- Donald E. Knuth: Metafont: the Program. Addison-Wesley, 1986, ISBN 0-201-13438-1
- ders .: The MetafontBOOK. Addison-Wesley, 1986, ISBN 0-201-13444-6
- Donald E. Knuth: The future of TEX and METAFONT . (PDF) 1990 (PDF; 15 kB)