MF(1)
๐ NAME ๐
okay bestie, welcome to the MF(1) manual page, General Commands Manual edition ๐
mf, inimf, mf-nowin โ Metafont, a language for font and logo design โจ
๐ธ SYNOPSIS ๐ธ
mf [options] [commands]
๐ DESCRIPTION ๐
so basically Metafont reads the program in the files you specify and outputs font rasters (in gf format) and font metrics (in tfm format). The Metafont language itself is described in The Metafontbook. ๐
Like TeX, Metafont is normally used with a large body of precompiled macros, and font generation in particular requires the support of several macro files. This version of Metafont looks at its command line to see what name it was called under. Both inimf and virmf are symlinks to the mf executable. When called as inimf (or when the -ini option is given) it can be used to precompile macros into a .base file. When called as virmf it will use the plain base. When called under any other name, Metafont will use that name as the name of the base to use. For example, when called as mf the mf base is used, which is identical to the plain base. Other bases than plain are rarely used. ๐ซถ
The commands you hand to the Metafont program on the command line get passed to it as the first input line. (But it's often easier to type extended arguments as the first input line, because UNIX shells tend to gobble up or misinterpret Metafont's favorite symbols, like semicolons, unless you quote them.) As described in The Metafontbook, that first line should begin with a filename, a \controlsequence, or a &basename. ๐
The normal usage is to say
mf '\mode=<printengine>; [mag=magstep(n);]' input font
to start processing font.mf. The single quotes are the best way of keeping the Unix shell from misinterpreting the semicolons and from removing the \ character, which is needed here to keep Metafont from thinking that you want to produce a font called mode. (Or you can just say mf and give the other stuff on the next line, without quotes.) Other control sequences, such as batchmode (for silent operation) can also appear. The name font will be the โjobnameโ, and is used in forming output file names. If Metafont doesn't get a file name in the first line, the jobname is mfput. The default extension, .mf, can be overridden by specifying an extension explicitly. ๐ซ
A log of error messages goes into the file jobname.log. The output files are jobname.tfm and jobname.<number>gf, where <number> depends on the resolution and magnification of the font. The mode in this example is shown generically as <printengine>, a symbolic term for which the name of an actual device or, most commonly, the name localfont (see below) must be substituted. If the mode is not specified or is not valid for your site, Metafont will default to proof mode, which produces large character images for use in font design and refinement. Proof mode can be recognized by the suffix .2602gf after the jobname. Examples of proof mode output can be found in Computer Modern Typefaces (Volume E of Computers and Typesetting). The system of magsteps is identical to the system used by TeX, with values generally in the range 0.5, 1.0, 2.0, 3.0, 4.0 and 5.0. A listing of gf numbers for 118-dpi, 240-dpi and 300-dpi fonts is shown below. ๐
MAGSTEP 118 dpi 240 dpi 300 dpi
mag=magstep(0) 118 240 300
mag=magstep(0.5) 129 263 329
mag=magstep(1) 142 288 360
mag=magstep(2) 170 346 432
mag=magstep(3) 204 415 518
mag=magstep(4) 245 498 622
mag=magstep(5) 294 597 746
Magnification can also be specified not as a magstep but as an arbitrary value, such as 1.315, to create special character sizes. ๐
Before font production can begin, it is necessary to set up the appropriate base files. The minimum set of components for font production for a given print-engine is the plain.mf macro file and the local mode_def file. The macros in plain.mf can be studied in an appendix to The Metafontbook; they were developed by Donald E. Knuth, and this file should never be altered except when it is officially upgraded. ๐จ Each mode_def specification helps adapt fonts to a particular print-engine. There is a regular discussion of mode_defs in TUGboat, the journal of the TeX Users Group. The local ones in use on this computer should be in modes.mf.
The e response to Metafont's error-recovery mode invokes the system default editor at the erroneous line of the source file. There is an environment variable, MFEDIT, that overrides the default editor. It should contain a string with "%s" indicating where the filename goes and "%d" indicating where the decimal linenumber (if any) goes. For example, an MFEDIT string for the vi editor can be set with the csh command
setenv MFEDIT "vi +%d %s"
A convenient file in the library is null.mf, containing nothing. When mf can't find the file it thinks you want to input, it keeps asking you for another file name; responding null gets you out of the loop if you don't want to input anything. ๐
๐ฆ ONLINE GRAPHICS OUTPUT ๐ฆ
Metafont can use most modern displays, so you can see its output without printing. Chapter 23 of The Metafontbook describes what you can do. This implementation of Metafont uses environment variables to determine which display device you want to use. First it looks for a variable MFTERM, and then for TERM. If it can't find either, you get no online output. Otherwise, the value of the variable determines the device to use: hp2627, sun (for old SunView), tek, uniterm (for an Atari ST Tek 4014 emulator), xterm (for either X10 or X11). Some of these devices may not be supported in all Metafont executables; the choice is made at compilation time. ๐
On some systems, there are two Metafont binaries, mf and mf-nowin. On those systems the mf binary supports graphics, while the mf-nowin binary does not. The mf-nowin binary is used by scripts like mktexpk where graphics support is a nuisance rather than something helpful. ๐
โจ OPTIONS โจ
This version of Metafont understands the following command line options.
-basebase โ use base as the name of the base to be used, instead of the name by which Metafont was called or a%&line.-cnf-linestring โ parse string as atexmf.cnfconfiguration line. See the Kpathsea manual.-file-line-errorโ print error messages in the formfile:line:error, which is similar to the way many compilers format them.-no-file-line-errorโ disable printing error messages in thefile:line:errorstyle.-file-line-error-styleโ this is the old name of the-file-line-erroroption. (legacy icon behavior, we love her ๐)-halt-on-errorโ exit with an error code when an error is encountered during processing.-helpโ print help message and exit.-iniโ beinimf, for dumping bases; this is implicitly true if the program is called asinimf.-interactionmode โ sets the interaction mode. The mode can be one ofbatchmode,nonstopmode,scrollmode, anderrorstopmode. The meaning of these modes is the same as that of the corresponding commands.-jobnamename โ use name for the job name, instead of deriving it from the name of the input file.-kpathsea-debugbitmask โ sets path searching debugging flags according to the bitmask. See the Kpathsea manual for details.-maketexfmt โ enablemktexfmt, where fmt must bemf.-no-maketexfmt โ disablemktexfmt, where fmt must bemf.-output-directorydirectory โ write output files in directory instead of the current directory. Look up input files in directory first, then along the normal search path.-parse-first-lineโ if the first line of the main input file begins with%&, parse it to look for a dump name or a-translate-fileoption.-no-parse-first-lineโ disable parsing of the first line of the main input file.-prognamename โ pretend to be program name. This affects both the format used and the search paths.-recorderโ enable the filename recorder. This leaves a trace of the files opened for input and output in a file with extension.fls.-translate-filetcxname โ use the tcxname translation table.-versionโ print version information and exit.
(part 1 of 2, bestie โ the rest is literally right there, don't go anywhere ๐ซถ)
๐ SUGGESTED READING ๐
ok so if you want to go โจ deeper โจ โ and bestie, you will want to โ here's the sacred text stack ๐
Donald E. Knuth, The Metafontbook (Volume C of Computers and Typesetting), Addison-Wesley, 1986, ISBN 0-201-13445-4.Donald E. Knuth, Metafont: The Program (Volume D of Computers and Typesetting), Addison-Wesley, 1986, ISBN 0-201-13438-1.Donald E. Knuth, Computer Modern Typefaces (Volume E of Computers and Typesetting), Addison-Wesley, 1986, ISBN 0-201-13446-2.TUGboat (the journal of the TeX Users Group).
like. that's the canon. Volume C is the vibe, Volume D is the lore, Volume E is the glow-up, and TUGboat is the group chat. ๐โจ
๐จ COMMENTS ๐จ
ok this is genuinely my favourite part of the whole page, no cap:
Warning: ``Type design can be hazardous to your other interests. Once you get hooked, you will develop intense feelings about letterforms; the medium will intrude on the messages that you read. And you will perpetually be thinking of improvements to the fonts that you see everywhere, especially those of your own design.''
likeโฆ it's a warning, bestie, and it is NOT playing ๐ this is the manual straight-up telling you that you will never look at a menu, a street sign, or a cereal box the same way again. it's giving "you can't sit with us unless you're ready to be obsessed." and the truly unhinged part? the warning is correct. ๐ซ ๐ค
you've been warned. proceed with your whole chest. ๐
๐ SEE ALSO ๐
go bother these lovely people next:
๐ AUTHORS ๐
so here's the girlboss history lesson ๐ธ
- Metafont was designed by Donald E. Knuth, who implemented it using his Web system for Pascal programs. (yes, he built a whole literate-programming system to build a font system. main character energy fr fr.)
- It was originally ported to Unix by Paul Richards at the University of Illinois at Urbana-Champaign. ๐ฆ
- This page was mostly written by Pierre MacKay. ๐ซถ
and that's the whole page, bestie!! you made it to the end, you absolute icon ๐
this little masterpiece comes to you from Web2C 2025, dated 24 August 2023, and it's page MF(1) of your friendly neighbourhood manual set. ๐
now go make some letterforms and ruin your ability to read normal text forever. mwah. ๐โจ
๐ฆ where this page comes from
- alpine 3.24: texlive-doc 2026.0-r0 ยท GPL-2.0-or-later AND GPL-3.0-or-later
- fedora 44: texlive-metafont 12:svn77830-105.fc44 ยท Knuth-CTAN
- fedora 44: texlive-metafont 12:svn77830-111.fc44 ยท Knuth-CTAN
- opensuse-leap 16.0: texlive-metafont-doc 2025.221.2.71828182svn73848-160000.3.1 ยท SUSE-TeX
- ubuntu resolute: texlive-binaries 2025.20250727.75242+ds-5build1 ยท TeX-Live
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms