MF(1) MF(1)
NAME
mf, inimf - Metafont, a language for alphabet design
SYNOPSIS
mf [ first line ]
inimf [ first line ]
virmf [ first line ]
DESCRIPTION
METAFONT reads the program in the specified files and out-
puts font rasters (in gf format) and font metrics (in tfm
format). The METAFONT language is 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. The virmf variant is
used to reload the .base files quickly. Typically, virmf
has links to it by the names of the various base files.
For example, if you link foo to virmf and then execute the
program foo, you get the base file foo.base. You can load
a different base by saying, e.g., virmf&mybase.
As described in The METAFONTbook, the command line (or
first input 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 your shell from misinterpreting the
semicolons and from removing the \ character, which is
needed here to keep METAFONT from thinking that you want
to produce a font called ``mode''. (Or you can just say mf
and give the other stuff on the next line, without
quotes.) Other control sequences, 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 extension,
.mf, can be overridden by specifying an extension explic-
itly.
A log of error messages goes into the file jobname.log.
The output files are jobname.tfm and jobname.<number>gf,
where <number> depends on the resolution and magnification
of the font. The ``mode'' in this example is shown gener-
ically as <printengine>, a symbolic term for which the
7 Jan 92 1
MF(1) MF(1)
name of an actual device or, most commonly, 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 char-
acter images for use in font design and refinement. Proof
mode can be recognized by the suffix .2602gf after the
jobname. Examples of proof mode output can be found in
ComputerModernTypefaces, (Volume E of ComputersandTypeset-
ting), by Donald Knuth. The system of magsteps is identi-
cal to the system used by TeX , with values generally 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.
MAGSTEP 118 dpi 240 dpi 300 dpi
mag=magstep(0) 118 240 300
mag=magstep(0.5) 129 263 329
mag=magstep(1) 142 288 360
mag=magstep(2) 170 346 432
mag=magstep(3) 204 415 518
mag=magstep(4) 245 498 622
mag=magstep(5) 294 597 746
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 compo-
nents 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 offi-
cially 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
should be somewhere in the directory
/usr/contrib/lib/mf/inputs. With only plain.mf and the
``modes'' file 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 direc-
tory paths to search when METAFONT opens a file for input.
For example, the csh command
setenv
MFINPUTS .:/usr/me/mylib:/usr/contrib/lib/mf/inputs
or the sh command sequence
MFINPUTS=.:/usr/me/mylib:/usr/contrib/lib/mf/inputs
export MFINPUTS
7 Jan 92 2
MF(1) MF(1)
would cause all invocations of METAFONT and its deriva-
tives to look for \input files first in the current direc-
tory, 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 his or her .login or .profile file.
The e response to METAFONT's error-recovery mode invokes
the system default editor at the erroneous line of the
source file. There is an environment variable, MFEDIT,
that overrides the default 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 with the csh command
setenv MFEDIT "/usr/ucb/vi +%d %s"
The environment variables 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.
ONLINE GRAPHICS OUTPUT
METAFONT can use most modern displays, so you can see its
output without printing. Chapter 23 of The METAFONTbook
describes what you can do. This implementation of META-
FONT uses environment variables to determine which display
device you want to use. First it looks for a variable
MFTERM, and then for TERM. If it can't find either, you
get no online output. Otherwise, the value of the vari-
able determines the device to use: hp2627, sun (for Sun-
View), tek, uniterm (for an Atari ST Tek 4014 emulator),
xterm (for either X10 or X11). Some of these devices may
not be supported in all METAFONT executables; the choice
is made at compilation time.
ENVIRONMENT
The default values for all environment variables are set
at the time of compilation in a file site.h. See tex(1)
for the details of the searching. If the environment
variable TEXMFOUTPUT is set, METAFONT attempts to put its
output files in it, if they cannot be put in the current
directory. Again, see tex(1).
MFINPUTS
Search path for input and openin files. It should
be colon-separated, and start with ``.''. Default:
.:/usr/contrib/lib/mf/inputs:/usr/src/contrib/tex/fonts//.
7 Jan 92 3
MF(1) MF(1)
MFINPUTS_SUBDIR
Search path for directories with subdirectories of
input files. Default: @MFINPUTSSUBDIR@
MFBASES
Search path for base files. Default:
/usr/contrib/lib/mf/bases /*basefile*/.
MFPOOL Search path for METAFONT internal strings.
Default:
/usr/contrib/lib/mf /*mf.pool*/.
MFEDIT Command template for switching to editor. Default:
/usr/ucb/vi+%d%s.
MFTERM,
Determines the online graphics display.
FONT UTILITIES
A number of utility programs are available. The following
is a partial list of available utilities and their pur-
pose. Consult your local METAFONT guru for details.
gftopk Takes a GF file and produces a more tightly
packed PK font file.
gftodvi Produces proof sheets for fonts.
gftype Displays the contents of a GF file in mnemonics
and/or images.
pktype Mnemonically displays the contents of a PK file.
mft Formats a source file as shown in Computer Mod-
ern Typefaces.
FILES
@MFLIBDIR@ METAFONT's library areas
/usr/contrib/lib/mf/mf.pool
Encoded text of METAFONT's messages
/usr/contrib/lib/mf/bases/*.base
METAFONT base files
/usr/contrib/lib/mf/inputs/plain.mf
The ``standard'' macro package
/usr/contrib/lib/mf/inputs/(something).mf
The file of ``mode_def''s for your
site's various printers
/usr/local/contrib/mf/inputs/cm/mf
METAFONT sources for Computer Modern
7 Jan 92 4
MF(1) MF(1)
SUGGESTED READING
Donald E. Knuth, The METAFONTbook (Volume C of Computers
and Typesetting)
Donald E. Knuth, METAFONT: The Program (Volume D of Com-
puters 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 every-
where, especially those of your own design.''
SEE ALSO
gftopk(1), gftodvi(1), gftype(1), mft(1), pltotf(1),
tftopl(1)
BUGS
On January 4, 1986 the ``final'' bug in METAFONT was dis-
covered 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 hunt-
ing.
AUTHORS
METAFONT was designed by Donald E. Knuth, who implemented
it using his WEB system for Pascal programs. It was orig-
inally ported to Unix by Paul Richards at the University
of Illinois at Urbana-Champaign. This page was mostly
written by Pierre MacKay.
7 Jan 92 5