Metafont allows you to create your own fonts, and most TeX users
will never need to use it. Metafont, unlike TeX, requires some
customisation: each output device for which you will be generating
fonts needs a mode associated with it. Modes are defined using the
mode_def
convention described on page 94 of The Metafontbook
(see TeX-related books). You will need
a file, which conventionally called local.mf, containing all the
mode_def
s you will be using. If local.mf doesn't already
exist, Karl Berry's collection of modes,
available as fonts/modes/modes.mf, is a good starting point
(it can be used as a 'local.mf' without modification in a 'big
enough' implementation of Metafont). Lists of
settings for various output devices are also published periodically in
TUGboat (see TUG). Now create
a plain
base
file using inimf, plain.mf
, and local.mf
:
% inimf This is METAFONT... **plain # you type plain (output) *input local # you type this (output) *dump # you type this Beginning to dump on file plain... (output)This will create a base file named plain.base (or something similar; for example, it will be PLAIN.BAS on MSDOS systems) which should be moved to the directory containing the base files on your system (note that some systems have two or more such directories, one for each 'size' of Metafont used).
Now you need to make sure Metafont loads this new base when it starts up. If
Metafont loads the plain
base by default on your system, then you're
ready to go. Under Unix (using the default web2c
distribution
)
this does indeed happen, but we could for instance define a command
mf which executes virmf &plain
loading the plain
base
file.
The usual way to create a font with plain
Metafont is to start
it with the line
\mode=<mode name>; mag=<magnification>; input <font file name>in response to the '**' prompt or on the Metafont command line. (If
<mode name>
is unknown or omitted, the mode defaults to 'proof' and
Metafont will produce an output file called
<font file name>.2602gf)
The <magnification>
is a floating point number or
'magstep' (magsteps are defined in The Metafontbook and
The TeXbook).
If mag=<magnification>
is omitted, then the default
is 1 (magstep 0). For example, to generate cmr10 at 12pt for an epson
printer you would type
mf \mode=epson; mag=magstep 1; input cmr10Note that under Unix the
\
and ;
characters must usually be quoted or
escaped, so this would typically look something like
mf '\mode=epson; mag=magstep 1; input cmr10'
If you don't have inimf or need a special mode that isn't
in the base, you can put its commands in a file (e.g.,
ln03.mf) and invoke it on the fly with the \smode
command.
For example, to create cmr10.300gf for an LN03 printer, using
the file
% This is ln03.mf as of 1990/02/27 % mode_def courtesy of John Sauter proofing:=0; fontmaking:=1; tracingtitles:=0; pixels_per_inch:=300; blacker:=0.65; fillin:=-0.1; o_correction:=.5;(note the absence of the
mode_def
and enddef
commands), you would
type
mf \smode="ln03"; input cmr10This technique isn't one you should regularly use, but it may prove useful if you acquire a new printer and want to experiment with parameters, or for some other reason are regularly editing the parameters you're using. Once you've settled on an appropriate set of parameters, you should use them to rebuild the base file that you use.
A summary of the above written by Geoffrey Tobin, and tips about common pitfalls in using Metafont, is available as info/metafont-for-beginners.tex