Debian Codegraph @

texmf-dist/doc/man/man1/mf.1

raw
1 .TH MF 1 "15 January 2026" "Web2C 2026"
2 .\"=====================================================================
3 .if n .ds MF Metafont
4 .if t .ds MF Metafont
5 .if t .ds TX \fRT\\h'-0.10m'\\v'0.17v'E\\v'-0.17v'\\h'-0.06m'X\fP
6 .if n .ds TX TeX
7 .ie t .ds OX \fIT\h'-0.17m'\v'+0.21m'E\v'-0.21m'\h'-0.04m'X\fP
8 .el .ds OX TeX
9 .\"=====================================================================
10 .SH NAME
11 mf, inimf, mf-nowin \- Metafont, a language for font and logo design
12 .SH SYNOPSIS
13 .B mf
14 .RI [ options ]
15 .RI [ \fB&\fPbase ]
16 \h'.25' [ \fIfile\fP [ \fImore-input\fP ] \h'.5'|\h'.5' [ \fB\e\fP\fImore-input\fP ]
17 .\"=====================================================================
18 .SH DESCRIPTION
19 \*(MF reads the source program in the specified files
20 and outputs font bitmaps in
21 .I gf
22 (generic font) format and font metrics in
23 .I tfm
24 (\*(TX font metric) format. The \*(MF
25 language is described in
26 .IR "The \*(MFbook" .
27 In general, \*(MF programs describe how to draw characters in fonts, or
28 other shapes, in an algorithmic way.
29 .PP
30 The normal usage is to run
31 .IP
32 \fBmf\ \fP '\\\|mode=\fIprintengine\fP; [mag=magstep(\fIn\fP);]' input\ \fI font \fP
33 .PP
34 to process
35 .I font.mf
36 with Metafont.
37 .PP
38 \fBmf\fP's command line processing is essentially the same as \*(TX's,
39 except that the conventional assignment to \fImode\fP on the command
40 line means that it's usual to invoke \fBmf\fP with several commands, as
41 shown, and not just a filename. Without the initial backslash, \*(MF
42 would try to read a file name \fImode\fP, just as \*(TX would. On Unix,
43 the single quotes are the simplest way of keeping the shell from
44 (mis)interpreting the backslash, semicolons, parentheses, etc.
45 Alternatively, you can invoke
46 .I mf
47 without arguments and give the commands on the next line, in response to
48 \fBmf\fP's "**" prompt, without any quotes.
49 .PP
50 In either case, other \*(MF commands, such as
51 .I batchmode
52 (for silent operation) can also appear. The default extension, ".mf",
53 can be overridden by specifying an extension explicitly.
54 .PP
55 The name
56 .I font
57 will be the ``jobname'', and is used in forming
58 output file names.
59 If \*(MF doesn't get a file name in the first line,
60 the jobname is
61 .IR mfput .
62 A log of error messages goes into the file
63 \fIjobname\fP\fB.\fP\fIlog\fP. The output files are
64 \fIjobname\fP\fB.\fP\fItfm\fP (for the metrics) and
65 \fIjobname\fP\fB.\fP\fI<\fPnumber\fI>gf\fP (for the bitmaps),
66 where <number> depends on the resolution and magnification of the
67 generated font.
68 .PP
69 Metafont can also be invoked by \*(TX, via the (for example)
70 .BR mktextfm (1)
71 script (q.v.), when \*(TX cannot find a font.
72 .PP
73 .B Metafont's output
74 .PP
75 Internally, Metafont computes Bezier cubic splines (and straight lines)
76 from the Metafont source program. However, as mentioned above, the main
77 output from Metafont is a bitmap file, that is, given the desired
78 output device (see next section), Metafont does its own rasterization.
79 (Why? Because Knuth's goal in creating \*(TX and Metafont was to
80 completely control the typesetting of his own books, down to the pixel.)
81 .PP
82 On the other hand, nowadays it is almost universal to want outline fonts
83 in the pdf (or other) output from \*(TX (or other document processors).
84 It is possible to extract the splines that Metafont computes from its
85 log file, or to have Metafont generate a high-resolution bitmap and
86 trace that (with, e.g.,
87 .BR autotrace (1)),
88 to get back to splines, but both of these are inconvenient, at best. It
89 is easier to use MetaPost
90 .RB ( mpost (1)),
91 which outputs PostScript instead of bitmaps, and outputs the splines
92 instead of their rasterizations. Metafont sources cannot generally be
93 used without change with MetaPost, but they are close. A detailed
94 article on this, in a relatively early project, is by Richard Kinch:
95 MetaFog: Converting Metafont shapes to contours, \fITUGboat\fP 16:3,
96 https://tug.org/TUGboat/tb16-3/tb48kinc.pdf).
97 .PP
98 The \fItfm\fP font metrics file that Metafont outputs contains character
99 dimension (height, width, depth) information, along with ligatures,
100 kerns, and so on; in short, everything needed to do typesetting with the
101 font. This does not include the shapes themselves. OpenType and TrueType
102 fonts, by contrast, incorporate both metric and shape information, along
103 with (potentially) a whole lot more for typesetting in non-Latin
104 scripts, which the original \*(TX and Metafont do not attempt to handle,
105 in modern generality. (There have been many projects to do typesetting
106 with \*(TX in non-Latin scripts, both predating Unicode and working with
107 Unicode when it became available. Articles in \fITUGboat\fP can be found
108 at
109 https://tug.org/TUGboat/Contents/listkeyword.html#CatTAGMultilingualDocumentProcessing.)
110 .PP
111 The technical specifications of the \fIgf\fP (bitmap) and \fItfm\fP
112 (metrics) formats are in the Metafont source program, or any of the
113 utility programs working with the respective formats; see list at end.
114 .PP
115 .B Modes (device definitions)
116 .PP
117 The Metafont
118 .I mode
119 of \fIprintengine\fP in the above invocation needs to be the name of an
120 actual device (e.g., \fIljfour\fP) or
121 .IR localfont .
122 If a mode is not specified, or is not valid, \*(MF will default to
123 .I proof
124 mode, which produces large character images for use in font design.
125 Proof mode will generate an output file of .2602gf (36 pixels per
126 point). A proof mode gf can be further processed into a printable
127 document with
128 .BR gftodvi (1).
129 This proof mode output is described further in \fIThe \*(MFbook\fP,
130 Appendix H (Hardcopy Proofs), and examples for the entire
131 Computer Modern typeface family are shown in
132 .I "Computer Modern Typefaces"
133 (Volume E of
134 .IR "Computers & Typesetting" ).
135 .PP
136 Modes are defined with the
137 .I mode_def
138 macro, which adapts the font output to a particular output device, by
139 defining such things as the device resolution. The file \fImodes.mf\fP
140 (https://ctan.org/pkg/modes) is distributed with \*(TX Live and is used
141 by default; it describes the various parameters, defines more than 150
142 modes (more entries are welcome), and defines \fIlocalfont\fP as
143 \fIljfour\fP, a 600dpi HP LaserJet printer.
144 .PP
145 Nowadays, output is often viewed online, where high-resolution bitmaps
146 are desirable. Several definitions in \fImodes.mf\fP can be used for
147 this: the mode named \fIpdf\fP (or \fIdpdfezzz\fP for older versions)
148 generates bitmaps at 8000 dpi (other parameters are canonical). If you
149 want a lower resolution, similar canonical modes are \fIsupre\fP at 2400
150 and \fIultre\fP at 1200.
151 .PP
152 \fIThe \*(MFbook\fP gives some more details and examples of modes,
153 particularly in chapter 11 (Magnification and Resolution).
154 .PP
155 .B Magsteps
156 .PP
157 The system of
158 .I magsteps
159 is identical to what is used in \*(TX, with values of \fIn\fP in the
160 above invocation generally one of 0.5, 1, 2, 3, 4 or 5, although in
161 principle it can be anything. Magnification can also be specified not as
162 a call to magstep but as an arbitrary value, such as 1.315, to create
163 special character sizes. It can also be entirely omitted, as shown above.
164 .PP
165 .B Base (.base) selection
166 .PP
167 Like \*(TX, \*(MF is normally used with a large body of precompiled
168 macros, called a "base"; the \fIplain\fP base is distributed as part of
169 \*(MF and is by far the most commonly used.
170 .PP
171 The \*(MF implementation in \*(TX Live (a.k.a. Web2C) looks at its
172 command line to see what name it was called under, just as \*(TX does.
173 In short, The names \fBinimf\fP and \fBvirmf\fP read \fIplain.base\fP,
174 and any other name reads the base file by that name. See
175 .BR tex (1)
176 for details.
177 The invocation name \fBmf-nowin\fP is a case special to \*(MF that uses
178 \fImf.base\fP; see below.
179 .PP
180 .B Error handling
181 .PP
182 See
183 .BR tex (1);
184 Metafont's error recovery is entirely analogous. The environment
185 variable name for the editor is MFEDIT.
186 .PP
187 .B Online graphics output
188 .PP
189 Unlike \*(TX, \*(MF can show the results of its processing online, as it
190 runs. \*(MF can use most modern displays. Chapter\~23 of
191 .I "The \*(MFbook"
192 describes what you can do. \*(MF uses environment variables to determine
193 which display device to use.
194 .PP
195 First it looks for a variable MFTERM; if MFTERM is not set, and DISPLAY
196 is set, the Metafont window support for X is used. (DISPLAY must be set
197 to a valid X server specification, as usual.) If neither MFTERM nor
198 DISPLAY is set, TERM is used to guess the window support to use.
199 If it can't find any of these, you get no online output.
200 .PP
201 The supported values for MFTERM and TERM are listed at
202 https://tug.org/texinfohtml/web2c.html#Online-Metafont-graphics. Since
203 they are mostly old and rarely used, and not enabled by default in \*(TX
204 Live, the list is not repeated here.
205 .PP
206 The two Kpathsea configuration variables \fIscreen_width\fP and
207 \fIscreen_depth\fP define the width and height of the window used by
208 Metafont. They can be set in the environment or a Kpathsea configuration
209 file (https://tug.org/texinfohtml/kpathsea.html#Path-sources). They
210 default to 1664 and 1200, respectively.
211 .PP
212 By default, \*(TX Live is distributed with two \*(MF binaries,
213 .B mf
214 and
215 .BR mf-nowin .
216 The
217 .B mf
218 binary supports graphics, while the
219 .B mf-nowin
220 binary does not. The
221 .B mf-nowin
222 binary is used by scripts like
223 .BR mktexpk (1),
224 where graphics support is a nuisance rather than something helpful.
225 .\"=====================================================================
226 .SH OPTIONS
227 See
228 .BR tex (1)
229 for both details of command-line parsing and the options available
230 (apart from the \*(TX-specific ones). The only Metafont-specific option
231 name is \fB-base\fP, which is entirely analogous to \*(TX's
232 \fB-format\fP.
233 .\"=====================================================================
234 .SH ENVIRONMENT
235 See
236 .BR tex (1)
237 for general information and more details. The terse descriptions here
238 are just a hint. There are many more environment variables that can
239 affect the path searching behavior.
240 .TP
241 .B TEXMFOUTPUT
242 If set, \*(MF attempts to put its output files here, if they cannot be
243 put in the current directory.
244 .TP
245 .B MFINPUTS
246 Search path for
247 .I input
248 files.
249 .TP
250 .B MFEDIT
251 Command template for switching to editor.
252 .TP
253 .B MFTERM
254 Determines the online graphics display. See above.
255 .TP
256 .B screen_width, screen_depth
257 Width and height of online graphics window.
258 .\"=====================================================================
259 .SH "FONT UTILITIES"
260 Here is a selection of the core utility programs that accompany \*(MF:
261 .TP \w'gftodvi'u+2n
262 .B gftopk
263 Takes a
264 .I gf
265 file and produces a smaller
266 .I pk
267 font file.
268 .TP
269 .B gftodvi
270 Produces proof sheets for fonts.
271 .TP
272 .B gftype
273 Displays the contents of a
274 .I gf
275 file in mnemonics and/or images.
276 .TP
277 .B pktype
278 Mnemonically displays the contents of a
279 .I pk
280 file.
281 .TP
282 .B mft
283 Formats a source file as shown in
284 .IR "Computer Modern Typefaces" .
285 .\"=====================================================================
286 .SH "FILES"
287 .TP
288 .I $TEXMFMAIN/metafont/base/plain.mf
289 The standard base.
290 .TP
291 .I $TEXMFMAIN/metafont/misc/modes.mf
292 A file of
293 .IR mode_def s
294 for many devices. See https://ctan.org/pkg/modes.
295 .TP
296 .I *.base
297 Predigested \*(MF base files.
298 .TP
299 .I "mf.pool"
300 Encoded text of \*(MF's messages.
301 .\"=====================================================================
302 .SH BUGS
303 Knuth still accepts new bug reports for \*(MF, but only reviews them
304 every several years. For a list of submitted reports and other
305 information: https://tug.org/texmfbug.
306 .\"=====================================================================
307 .SH "HEALTH WARNING"
308 From \fIThe \*(MFbook\fP: ``Type design can be hazardous to your other
309 interests. Once you get hooked, you will develop intense feelings about
310 letterforms; the medium will intrude on the messages that you read. And
311 you will perpetually be thinking of improvements to the fonts that you
312 see everywhere, especially those of your own design.''
313 .\"=====================================================================
314 .SH "SEE ALSO"
315 .BR gftopk (1),
316 .BR gftodvi (1),
317 .BR gftype (1),
318 .BR mft (1),
319 .BR pktogf (1),
320 .BR pltotf (1),
321 .BR tftopl (1).
322 .br
323 .BR mktexmf (1),
324 .BR mktexpk (1),
325 .BR mktextfm (1).
326 .br
327 .BR mpost (1),
328 .BR tex (1).
329 .PP
330 Donald E. Knuth,
331 .I "The \*(MFbook"
332 (Volume C of
333 .IR "Computers & Typesetting" ).
334 .br
335 Donald E. Knuth,
336 .I "\*(MF: The Program"
337 (Volume D of
338 .IR "Computers & Typesetting" ).
339 .br
340 Donald E. Knuth,
341 .I Computer Modern Typefaces
342 (Volume E of
343 .IR "Computers & Typesetting" ).
344 .br
345 .PP
346 Some online information:
347 .br
348 Metafont for beginners, by Geoffrey Tobin:
349 https://ctan.org/pkg/metafont-beginners
350 .br
351 Metafont font implementations (nearly all descend from Computer Modern):
352 https://ctan.org/topic/font-mf
353 .PP
354 \*(TX Live web pages:
355 https://tug.org/texlive
356 .br
357 Web2C Texinfo manual and web page:
358 https://tug.org/web2c
359 .br
360 Kpathsea Texinfo manual and web page:
361 https://tug.org/kpathsea
362 .br
363 Sources for the \*(TX-world literate programs, as pdf:
364 https://ctan.org/pkg/knuth-pdf
365 .PP
366 .I TUGboat
367 (the journal of the \*(TX Users Group, submissions welcome):
368 https://tug.org/TUGboat/
369 .br
370 Particularly the \fIFonts\fP topic:
371 https://tug.org/TUGboat/Contents/listkeyword.html#CatTAGFonts
372 .\"=====================================================================
373 .SH AUTHORS
374 \*(MF was created by Donald E. Knuth, who implemented it using his WEB
375 system for Pascal programs. It was originally ported to Unix by Paul
376 Richards at the University of Illinois at Urbana-Champaign. The version
377 now included in \*(TX Live, the current Unix \*(TX distribution, is
378 generated by the Web2C system originally written by Tomas Rokicki and
379 Tim Morgan. This man page was originally written by Pierre MacKay.
380 .PP
381 Bug reports in \*(MF (exceedingly rare): https://tug.org/texmfbug
382 .br
383 Public mailing list for implementation questions and reports:
384 https://lists.tug.org/tex-k
385 .br
386 Public discussion list for all things \*(MF (and \*(TX):
387 https://lists.tug.org/texhax