METAFONT
From Wikipedia, the free encyclopedia
METAFONT is a programming language used to define vector fonts. It is also the name of the interpreter that executes METAFONT code, converting the vector fonts into bitmap fonts that can be included in PostScript documents.
Donald Knuth started work on font creation software in 1977, and produced the first version of METAFONT in 1979. Due to shortcomings in the original METAFONT language, Knuth developed an entirely new METAFONT system in 1984, and it is this revised system that is used today; METAFONT has a versioning system similar to that of TEX, where the number asymptotically approaches e with each revision. This programming language was devised by Donald Knuth as counterpart to his TEX typesetting system. One of the characteristics of METAFONT is that all of the shapes of the glyphs are defined with powerful geometrical equations, e.g., you can define a given point to be the intersection of a line segment and a Bézier cubic.
Unlike more common outline font formats (such as TrueType or PostScript Type 1), a METAFONT font is primarily made up of strokes with finite-width "pens", along with filled regions. Thus, rather than describing the outline of the glyph directly, a METAFONT file describes the pen paths. Some simpler METAFONT fonts, such as the calligraphic mathematics fonts in the Computer Modern family, use a single pen stroke with a relatively large pen to define each visual "stroke" of the glyphs. More complex fonts such as the Roman text fonts in the Computer Modern family use a small pen to trace around the outline of the visual "strokes", which are then filled; the result is much like an outline font, but with slightly softened corners defined by the pen shape.
Since the font shapes are defined by equations rather than directly-coded numbers, it is possible to treat parameters such as aspect ratio, font slant, stroke width, serif size, and so forth as input parameters in each glyph definition. Thus, by changing the definition of one of these parameters at one location in the METAFONT file, one can produce a consistent change throughout the entire font. Computer Modern Roman illustrates many uses of this feature; a typical TeX installation includes a number of versions of the font in sizes from 5pt to 17pt, with the stroke widths the same in all sizes (rather than increasing as the font is scaled up) and aspect ratios widening in the smaller sizes for increased legibility. In addition, the Computer Modern typewriter and sans-serif fonts are defined using essentially the same METAFONT file as the Roman font, but with different global parameters.
Curves in Metafont are defined not as conic sections but as cubic splines, for greater versatility and simpler arithmetic.
METAFONT can render any kind of graphical output, not just glyphs. However, MetaPost with its PostScript output is preferred for advanced illustrations. METAFONT is most commonly invoked without a direct request from the user. DVI files can only contain references to typefaces, rather than the sets of raster or vector glyphs that other formats like PostScript allow. Consequently the glyphs in the typefaces need to be accessed whenever a request is made to view, print or convert a DVI file. Most TeX distributions are configured so that any fonts not currently available at the required resolution are generated by calls to METAFONT. The typefaces are then stored for later reuse.
METAFONT can also be run interactively, and has commands for displaying on the screen the images it produces. Knuth has said that he uses METAFONT as a kind of desk calculator for solving complicated equations, though he now uses MetaPost for mathematical illustrations.
Since METAFONT cannot create vector fonts directly, the Polish JNS team developed METATYPE1 (based on METAPOST) for creating PostScript Type 1 fonts. Its big disadvantage is that no pens may be used which highly reduces the power of METAFONT language.
While well-known font designers, such as Hermann Zapf, have collaborated with Knuth to create new fonts using METAFONT, the system has not been widely adopted by professional type designers. Knuth attributes this to the fact that "asking an artist to become enough of a mathematician to understand how to write a font with 60 parameters is too much".[1]
[edit] Notes
- ^ Donald E. Knuth. Questions and Answers II, TUGboat 17 (1996), 355–367. Reprinted as chapter 32 of the book Digital Typography, p. 612. Also available online at http://www.tug.org/TUGboat/Articles/tb17-1/tb50knut.pdf
[edit] References
- Donald Knuth: METAFONT: The Program, Addison-Wesley 1986. ISBN 0-201-13438-1
- Donald Knuth : The METAFONTbook, Addison-Wesley 1986. ISBN 0-201-13444-6 . The source code of the book in TeX (and a needed macro [1]) is available online on CTAN.