plain
could be misconstrued as a reference to Plain TeX.Getting MetaFont to do what you want
MetaFont vous permet de créer vos propres polices, mais la plupart des utilisateurs de TeX n'auront jamais besoin de l'utiliser. En effet, les systèmes (La)TeX modernes contiennent très peu de polices MetaFont importantes, et lorsque l'usage de MetaFont est nécessaire, il est appelé automatiquement pour générer les polices « à la volée ».
Mais si vous avez des besoins particuliers que le système ne satisfait pas,
vous avez intérêt à connaître MetaFont plus en détail.
MetaFont, contrairement à TeX, nécessite une personnalisation pour chaque périphérique de sortie:
cette personnalisation est traditionnellement conservée dans un « mode » associé au périphérique.
Les modes sont généralement définis à l'aide de la convention mode_def
décrite à la page 94 de The MetaFontbook
(voir les livres à propos de TeX).
Votre distribution est censée fournir un fichier, généralement appelé local.mf
,
contenant tous les mode_def
que vous utiliserez. Dans le cas improbable où local.mf
n'existe pas encore,
la collection de modes de Karl Berry (modes.mf
) est un bon point de départ
(elle peut être utilisée comme local.mf
sans modification avec les implémentations modernes de MetaFont).
Les paramètres des nouveaux périphériques de sortie sont ajoutés à modes.mf
au fur et à mesure de leur apparition.
Now create a plain
base file using mf
(in “initialisation” mode),
plain.mf
, and local.mf
:
% mf -ini 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 MS-DOS
systems). Move the file to the directory containing the base files on
your system, and run texhash
as necessary.
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 TeX Live (and earlier)
distributions this does indeed happen, but we could for instance
define a command plainmf
1)
which executes mf -base=plain
(or, in more traditional
style mf & plain
) which loads the plain
base file.
The usual way to create a font with MetaFont (with an appropriate base file loaded) is to start MetaFont's input 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” mode and MetaFont will produce an output file called
<font file name>.2602gf
)
The <magnification>
is a floating point number or a
“magstep” (magsteps define sizes by stating how many times you need to
multiply a base size by 1.2
, so for a base size of
10
, magstep 1
is 12
, magstep 2
is
14.4
If mag=<magnification>
is omitted, then the default
is 1
(magstep 0
). For example, to generate
cmr10
at 12pt
for an Epson,
printer you might type
mf \mode=epson; mag=magstep 1; input cmr10
Note 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 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 cmr10
This 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.
Other sources of help are discussed in our list of MetaFont and MetaPost Tutorials.