summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-useMF.html
blob: c15db500ccafdf89939b7a2c9fa80cf682a9788a (plain)
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 &#8212; modern (La)TeX systems contain
rather few Metafont fonts of any significance, and when Metafont output is
needed the font generation is done, automatically, &#8220;on the fly&#8221;.
<p/>If you find you have some special requirement that the system doesn&#8217;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 &#8220;mode&#8221; 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&#8217;t already exist, Karl Berry&#8217;s collection of
modes (<i>modes.mf</i>) is a good starting point 
(it can be used as a &#8216;<i>local.mf</i>&#8217; 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 &#8220;initialisation&#8221;
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&#8217;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 &#8216;<code>mf -base=plain</code>&#8217; (or, in more traditional
style &#8216;<code>mf &#38;plain</code>&#8217;) 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&#8217;s input with the

line
<pre>
\mode=&#60;mode name&#62;; mag=&#60;magnification&#62;; input &#60;font file name&#62;
</pre>
in response to the &#8216;<code>**</code>&#8217; prompt or on the Metafont command line. (If
<code>&#60;mode name&#62;</code> is unknown or omitted, the mode defaults to
&#8216;proof&#8217; mode and Metafont will produce an output file called 
<i>&#60;font file name&#62;.2602gf</i>)
The <code>&#60;magnification&#62;</code> is a floating point number or
&#8216;magstep&#8217; (magsteps are defined in <em>The Metafontbook</em> and
<em>The TeXbook</em>).
If <code>mag=&#60;magnification&#62;</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&#8217;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&#8217;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&#8217;re using.  Once you&#8217;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>