inimf [ first line ]
virmf [ first line ]
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 programs as compiled are called inimf and virmf, and are distinguished by the fact that inimf can be used to precompile macros into a ``*.base'' file, which is used by virmf. Virmf can read a precompiled ``*.base'' file, but it cannot create one. It is the version of METAFONT which lies behind most font production systems.
By convention, the program used to compile the Computer Modern fonts is called cmmf, which is essentially an alias for virmf with the Computer Modern support macros loaded in as a ``base'' file. In the following discussion, the name METAFONT will be used whenever the behavior of all varieties of the program is the same. Otherwise, it should be assumed that the behavior described is unique to the program named. Any arguments given on the command line to one of the METAFONT programs, such as cmmf, are passed to them as the first input line. As described in The METAFONTbook, that line should begin with a file name or a \controlsequence. The normal usage is to say
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''. 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.
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 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.
Mode_def specifications are tailored to each different print-engine.
There is a regular discussion of them in the journal of the
TeX
Users Group,
TUGboat,
and models can be found in the files `waits.mf' and `U_Wash.mf' which
come in the standard distribution of
TeX
for Unix systems. A good `mode_def' file (which we will here
call `<SITE>-modes.mf') should also supply other
features in the `gf' and `tfm' output from
cmmf.
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 requires that
`cmbase.mf', be loaded as well.
The best way to do this is to create a small ``driver'' file with
the lines
input plain
input <SITE>-modes
input cmbase
and name this file `cmplain.mf'.
Then run
inimf
with the arguments ``cmplain dump'', and you will
finish up with a file named cmplain.base.
The `base' file is used by
virmf.
It needs to be given a base file name as the first thing it reads.
A base file name is preceded by an &, which needs to be quoted or
escaped with \
if given on the command line.
One could set up a cshell alias with
alias cmmf "virmf \&cmplain"
to allow regular use of
cmmf,
but a preferable way is to set up an executable script with the
name
cmmf
which can ensure that `cmplain.base' is loaded whenever
cmmf
is called. In either case, the message on the screen will tell you that
there is ``no format preloaded'', which is of course perfectly true; the
format loading is achieved by the ``\&cmplain'' part of the alias.
The log file will tell you that cmplain was loaded, and that too is true,
because the log file is written after the loading of ``cmplain.base''
(or whatever base file you have specified). This mildly confusing
conflict in messages can be avoided if you choose to preload ``cmmf''
using the ``undump'' program. Preloading gives you a fast startup, but
only at the price of lost flexibility and of large storage requirements
for the preloaded version. WARNING. Do not use a base with
cmbase.mf preloaded when you make up the line and circle fonts for
LaTeX. It causes subtle errors in the compiled font and makes the
production of clean drawings in LaTeX picture mode virtually impossible.
There are some environment variables that 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/lib/mf/inputs
or the
sh
command sequence
MFINPUTS=.:/usr/me/mylib:/usr/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, MFEDITOR,
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 MFEDITOR string for the "vi" editor can be set by:
setenv MFEDITOR "/usr/ucb/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.
Most sites need at least two families of font resolution: one for printing and the other for previewing. If both write-white and write-black printers are used at the same site it may even be necessary to have two sets of fonts at the same resolution. When preloaded with a `mode-def' file such as U_Wash.mf, METAFONT has several modes, each associated with a given print engine or display device. In regular use the mode `localfont' is made equivalent to the mode for the print-engine most in use. There are also two styles of proof mode for character designers.
Once a METAFONT source is written, the following steps
may be used to generate a GF file for proofing, TFM
file for the width table, and raster font files for printing and previewing
at each desired resolution.
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.
The ``no format preloaded'' message could be considered an undesirable
fossil, but it is not a bug.