1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
<head>
<title>UK TeX FAQ -- question label useMF</title>
</head><body>
<h3>Getting Metafont to do what you want</h3>
<p/>Metafont allows you to create your own fonts, and most TeX users
will never need to use it — modern (La)TeX systems contain
rather few Metafont fonts of any significance, and when Metafont output is
needed the font generation is done, automatically, “on the fly”.
<p/>If you find you have some special requirement that the system doesn’t
satisfy, you need to know about Metafont in rather more detail. Metafont,
unlike TeX, requires customisation for each output device: such
customisation is conventionally held in a “mode” associated with the
device. Modes are commonly defined using the <code>mode_def</code>
convention described on page 94 of <em>The Metafontbook</em>
(see <a href="FAQ-books.html">TeX-related books</a>). You will need
a file, conventionally called <i>local.mf</i>, containing all the
<code>mode_def</code>s you will be using. In the unlikely event that
<i>local.mf</i> doesn’t already exist, Karl Berry’s collection of
modes (<i>modes.mf</i>) is a good starting point
(it can be used as a ‘<i>local.mf</i>’ without modification in a
typical modern implementation of Metafont). Lists of
settings for various output devices are also published periodically in
<i>TUGboat</i> (see <a href="FAQ-TUGstar.html">TUG</a>). Now create
a <code>plain</code> base file using <i>mf</i> (in “initialisation”
mode), <code>plain.mf</code>, and <code>local.mf</code>:
<blockquote>
<pre>
% 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)
</pre>
</blockquote><p>
This will create a base file named <i>plain.base</i>
(or something similar; for example, it will be <i>PLAIN.BAS</i>
on MSDOS systems). Move the file to the directory containing
the base files on your system.
<p/>Now you need to make sure Metafont loads this new base when it starts up. If
Metafont loads the <code>plain</code> 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 <i>plainmf</i>
which executes ‘<code>mf -base=plain</code>’ (or, in more traditional
style ‘<code>mf &plain</code>’) which loads the <code>plain</code> base
file.
<p/>The usual way to create a font with Metafont (with an appropriate base
file loaded) is to start Metafont’s input with the
line
<pre>
\mode=<mode name>; mag=<magnification>; input <font file name>
</pre>
in response to the ‘<code>**</code>’ prompt or on the Metafont command line. (If
<code><mode name></code> is unknown or omitted, the mode defaults to
‘proof’ mode and Metafont will produce an output file called
<i><font file name>.2602gf</i>)
The <code><magnification></code> is a floating point number or
‘magstep’ (magsteps are defined in <em>The Metafontbook</em> and
<em>The TeXbook</em>).
If <code>mag=<magnification></code> is omitted, then the default
is 1 (magstep 0). For example, to generate cmr10 at 12pt for an Epson
printer you might type
<blockquote>
<pre>
mf \mode=epson; mag=magstep 1; input cmr10
</pre>
</blockquote><p>
Note that under Unix the <code>\</code> and <code>;</code>
characters must usually be quoted or escaped, so this would typically
look something like
<blockquote>
<pre>
mf '\mode=epson; mag=magstep 1; input cmr10'
</pre>
</blockquote><p>
If you need a special mode that isn’t in the base, you can put its
commands in a file (<em>e.g.</em>, <i>ln03.mf</i>) and invoke it on the
fly with the <code>\</code><code>smode</code> command. For example, to create
<i>cmr10.300gf</i> for an LN03 printer, using the file
<blockquote>
<pre>
% 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;
</pre>
</blockquote><p>
(note the absence of the <code>mode_def</code> and <code>enddef</code>
commands), you would type
<blockquote>
<pre>
mf \smode="ln03"; input cmr10
</pre>
</blockquote><p>
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.
<p/>Other sources of help are discussed in our list of
<a href="FAQ-mfptutorials.html">Metafont and MetaPost Tutorials</a>.
<dl>
<dt><tt><i>modes.mf</i></tt><dd><a href="http://www.tex.ac.uk/tex-archive/fonts/modes/modes.mf">fonts/modes/modes.mf</a>
</dl>
<p/><p>This question on the Web: <a href="http://www.tex.ac.uk/cgi-bin/texfaq2html?label=useMF">http://www.tex.ac.uk/cgi-bin/texfaq2html?label=useMF</a>
</body>
|