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

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