MF(1L)

NAME
mf, inimf - METAFONT, a language for font design

SYNOPSIS
mf [ first line ]

inimf [ first line ]

DESCRIPTION
METAFONT reads the program in the specified files and outputs font rasters (in gf format) and font metrics (tfm files). METAFONT capabilities and language are described in The METAFONTbook by Donald E. Knuth, published by Addison-Wesley.

Like TeX , METAFONT is normally used with a large body of precompiled macros, and font generation in particular requires the support of several macro files. The basic program as compiled is called inimf; it can be used to precompile macros into a ``*.base'' file, which can be preloaded when you invoke inimf under another name. If you call it `mf', the file plain.base is quickly loaded; if you call it `foo' and link `foo' to `inimf', you get the file foo.base. A different base file can be loaded if you say &mybase at the beginning of your first input line. As described in The METAFONTbook, that line should otherwise begin with a file name or a \controlsequence. The normal usage is to say

    mf ' \mode=<printengine>; [\mag=magstep(n);] ' input font

to start processing font.mf. The single quotes are the best way of keeping the shell from misinterpreting the semicolons and from removing the \ characters, which are needed here to keep METAFONT from thinking that you want to produce a font called ``mode'' or ``mag''. (Or you can just say `mf' and give the other stuff on the next line, without quotes.) Other \controlsequences, such as \batchmode (for silent operation) can also appear. The name ``font'' will be the ``jobname'', and is used in forming output file names. If METAFONT doesn't get a file name in the first line, the jobname is ``mfput''. The default `.mf' extension can be overridden by specifying an extension explicitly. There is no way to read a METAFONT input file with no filename extension.

A log of error messages goes into font.log where font is the jobname. The output files are font.tfm and font.<number>gf where <number> depends on the resolution and magnification of the font. The ``\mode'' in this example is shown generically as <printengine>, a symbolic term for which the name of an actual printengine or the name ``localfont'' (see below) must be substituted. If the ``\mode'' is not specified or is not valid for your site, METAFONT will default to ``proof'' mode which produces large character images for use in font design and refinement. Proof mode can immediately be recognized by the appearance of the suffix .2602gf after the jobname. Examples of proof mode output can be found in The Computer Modern Fonts, (Volume E of Computers and Typesetting ), by Donald Knuth. The system of magsteps is identical to the system used by TeX , with values normally in the range 0.5, 1.0, 2.0, 3.0, 4.0 and 5.0. A listing of gf numbers for 118-dpi, 240-dpi and 300-dpi fonts is shown below.
Magnification can also be specified not as a magstep but as an arbitrary value, such as 1.315, to create special character sizes.

Before font production can begin, it is necessary to set up the appropriate `base' files. The minimum set of components for font production for a given print-engine is the `plain.mf' macro file and the local `mode_def' file. The macros in `plain.mf' can be studied in an appendix to the METAFONTbook; they were developed by Donald Knuth, and this file should never be altered except when it is officially upgraded. Each mode_def specification helps adapt fonts to a particular print-engine. There is a regular discussion of mode_defs in the journal of the TeX Users Group, TUGboat; the local ones in use on this computer (art) are in the file /home/tex/local/lib/art.mf. With only `plain.mf' and `<SITE>-modes.mf' loaded it is possible to create fonts of simple characters, such as those used for the METAFONT logo, and those used for the LaTeX line and circle fonts, but the production of Computer Modern fonts would be facilitated by making a cmmf.base file (which includes the macros in cmbase.mf as well as those in plain.mf).

Several environment variables can be used to set up directory paths to search when METAFONT opens a file for input. For example, the csh command
setenv MFINPUTS .:/usr/me/mylib:/usr/local/lib/mf/inputs
or the sh command sequence
MFINPUTS=.:/usr/me/mylib:/usr/local/lib/mf/inputs
export MFINPUTS
would cause all invocations of METAFONT and its derivatives to look for \input files first in the current directory, then in a hypothetical user's ``mylib'', and finally in the system library. Normally, the user will place the command sequence which sets up the MFINPUTS environment variable in the .cshrc or .profile file.

The e response to METAFONT's error-recovery mode invokes the GNU emacs editor at the erroneous line of the source file. There is an environment variable, MFEDIT, that can be used to specify the editor. It should contain a string with "%s" indicating where the filename goes and "%d" indicating where the decimal linenumber (if any) goes. For example, an MFEDIT string for the "vi" editor can be set by:
     setenv MFEDITOR "/usr/bin/vi +%d %s"

(replacing the path name for the editor as appropriate on your system). The Environment section below lists the relevant environment variables, and their defaults.

A convenient file in the library is null.mf, containing nothing. When mf can't find the file it thinks you want to input, it keeps asking you for another file name; responding `null' gets you out of the loop if you don't want to input anything.

ENVIRONMENT
The defaults for all environments are set at the time of compilation, by reference to a file called /home/tex/local/mfpaths.h. The values given below are preset in this file.

MFINPUTS
    Search path for \input and \openin files. It should be colon-separated, and start with ``.''. The entire path must be no longer than 700 characters long. Default: .:/home/tex/local/lib:/home/tex/dist/lib

MFBASES
    Search path for base files. Default: .:/home/tex/local/mf

MFPOOL
    Search path for METAFONT internal strings. Default: .:/home/tex/local/mf

MFEDIT
    Command template for switching to editor. Default: /emacs +%d %s

FONT UTILITIES

A number of utility programs are available (see section See Also). The following is a partial list of available utilities and their purpose. Consult your local METAFONT guru for details.

gftopk
    Takes a GF file and produces a more tightly packed PK font file TP gftodvi Produces proof sheets for fonts

gftype
    Displays the contents of a GF file in mnemonics and images

pktype
    Mnemonically displays the contents of a PK file

mft Formats a source file (font.mf) as shown in Computer Modern Typefaces

FILES

/home/tex/{dist,local}/lib
    METAFONT's library areas

/home/tex/local/mf/mf.pool
    Encoded text of METAFONT's messages

/home/tex/local/mf/*.base
    METAFONT base files

/home/tex/dist/lib/plain.mf
    The ``standard'' macro package

/home/tex/local/lib/art.mf
    The file of ``mode_def''s for your site's various printers

/home/tex/dist/cm
    METAFONT sources for Computer Modern

/home/tex/local/cm
    Local variations of Computer Modern

SUGGESTED READING
Donald E. Knuth, The METAFONTbook (Volume C of Computers and Typesetting)
Donald E. Knuth, METAFONT the Program (Volume D of Computers and Typesetting)
Donald E. Knuth, Computer Modern Typefaces (Volume E of Computers and Typesetting)
TUGboat (the publication of the TeX Users Group)

COMMENTS
Warning: ``Type design can be hazardous to your other interests. Once you get hooked, you will develop intense feelings about letterforms; the medium will intrude on the messages that you read. And you will perpetually be thinking of improvements to the fonts that you see everywhere, especially those of your own design.''

BUGS
On January 4, 1986 the ``final'' bug in METAFONT was discovered and removed. If an error still lurks in the code, D. E. Knuth promises to pay a finders fee which doubles every year to the first person who finds it. Happy hunting.

AUTHORS
METAFONT was designed by Donald E. Knuth, who implemented it using his WEB system for Pascal programs. It was ported to Unix by Paul Richards at the University of Illinois at Urbana-Champaign. This page written by Pierre MacKay (mostly).

SEE ALSO
dvitype(1), gftopk(1), gftodvi(1), gftype(1), mft(1), pktype(1), pltotf(1), tftopl(1)