Metafont is a really nice program for designing typefaces. There are two stand-out features:
(1) You specify control points on the outline, not outside (as with Bezier curves). That's something Peter Karow already did with Ikarus, but it didn't prevail.
(2) You write programs. Obviously that was a non-starter for the type-designer profession, which is much more programming friendly today, but back then it wasn't.
Oh, and read up on the "hinting" mechanisms in Metafont, it's lightyears ahead of Type 1 hints and TrueType instructions.
Obviously, today it's long in the tooth: 128 glyphs are way to few, the fact that it creates bitmap fonts is en vogue, either.
Still, a fantastic tool from which you can still learn a lot.
> "Metafont is a really nice program for designing typefaces."
It is really a nice approach, not only for typefaces but also for graphics in general there is the Metafont inspired MetaPost. [1]
> "You specify control points on the outline, not outside (as with Bezier curves)."
Metafont basically simulates tools like brush and broad nib pen.
This is great for some typefaces but it surprisingly gets in the way for most punchcutting based typefaces. The shapes of most of these letters are just not easy to replicate with a brush or pen approach.
[1] Metafont minuscule f, MetaPost majuscule P, not a typo.
While it can be used to simulate nib and brush characters, it's not required. Most of the CM typefaces do not use that functionality (only the calligraphic uppercase letters, designed by Neenie Billawalla, use the nib feature).
I know and as far as I remember this is done using a small brush to trace the outline and then fill it. Apart from being kind of a hack you also lose the beauty and simplicity of using Metafont to describe the spine of the character and let it derive the outline from that. I always thought of that as the higher abstraction that is preferable to use, but unfortunately and unexpectedly it falls short on many common character shapes. As a bezier outline description tool I see little benefit in using Metafont.
You're right, and I think that's what these newfangled LaTeX font schemes did (back when anybody still used bitmap fonts), but unfortunately I don't know much about it.
The LaTeX font schemes were more about providing a parameterized access to font families. TeX 3.0 provided access to 8-bit input and output.
I was involved in a typesetting project in the 90s where I wrote a preprocessor which took 16-bit input (encoded using SJIS—Unicode was not yet widely adopted enough to be practical) and turned that into a stream of TeX code which handled font selection and character coding. It also handled allowing breaks between Kanji/Kana characters at allowable points (e.g., between two Kanji/Kana but not between Kanji/Kana and, say, a period).
There were some specialized extensions of TeX that were designed for CJK typesetting. With the rise of Unicode, this functionality became available in XeTeX.
Metafont's "charext" feature allows for more than 128 glyphs, though it's kind of a cheat, as it puts artificial constraints on character dimensions. But it would be much less trouble to modify Metafont to properly handle larger character sets than it was to get TeX to.
Concerning bitmaps, it's ironic that window systems ultimately display bitmaps on the screen, yet they keep the pathway from font-outline to their character-bitmap cache internal. There's no way to tell MacOS, for instance, that you want to plug in your own provider, that it can call whenever it first wants the bitmap for a given font glyph at a given size. Too bad this API is hidden; it must exist internally in MacOS, Windows, etc.
IIRC, MF 2.0 at least boosted 128 to 256. At the time, the only character sets which went beyond 256 characters were CJK character sets which had uniform character dimensions for all characters so the limitation was not a problem.
You're absolutely correct; I should have said "more than 256". It's difficult to modify TeX to handle larger character sets, but Metafont could, using that weird hack that all characters of a given "mod 256" had to have the same dimensions (no doubt simply due to the limitations of TFM format).
> Obviously, today it's long in the tooth: 128 glyphs are way to few, the fact that it creates bitmap fonts is en vogue, either.
To be fair, the language Metafont defines the font in vector format, but computers at the time weren't fast enough to interpret metafont on the fly generating the fonts, so in all metafont software until today there is this preprocessing part where you generate bitmap fonts.
I wonder if Metafont could be used today with new software which interprets Metafont code generating fonts on the fly. I read the Metafont book and all the programming capabilities appear very powerful and useful. Perhaps we could create fonts where there is variation each time a letter is printed, logos and symbols with more interactive behavior when it's compressed or stretched out...
For a more gentle introduction, check out 'The METAFONTbook', also by Donald E. Knuth. I think that it is still not available in a digital format, but your local CS-oriented library might have a physical copy.
One of my favorite reads! Somehow, it turns out to be much funnier than the TeXBook, which is a bit arid. I love when he explains that drawing a beautiful S is wickedly difficult. And the metafont language is quite slick.
I remember when the half-tone article was first published in TUGboat. In those days when scanners were exotic equipment not easily accessible, the illustrations were amazing to see (and to recreate).
That's the source code; there's also the 360-page user manual, The Metafont Book, published by Addison-Wesley, in both soft and hard-cover. Unhappily out of print; softcover
ISBN 0201134446 9780201134445; hardcover 0201134454 9780201134452 at places like AbeBooks.com.
At the time, the idea that a type designer would use a computer as part of the design process (or even at all) was pretty radical. And the notion that you were expected to design a parameterized version of your font, that would produce both regular and bold, in any point size, from a single source where you specified control point coordinates with multiple linear equations in multiple unknowns, was also a challenge. (And, no, it isn't acceptable to do that algorithmically.)
Ultimately, the biggest impediment seemed to be Metafont's "stroke with a brush" model was at odds with how designers lived in an "outline" world. The combination of this calligraphic orientation on top of needing to be comfortable with linear algebra and computer programming, account for Metafont's lack of popularity, I believe.
I agree that the "brush with a stroke" is the first thing you see when you look at Metafont and the first examples in the Metafontbook, but in real projects (like Computer Modern) you're using the brush to draw an outline, so there isn't much difference anymore (except for the fact that you're moving a shape across the outline instead of a zero-dimensional point, and that is unconventional, but really helps).
Wait, I just noticed your id. drfuchs as in David Fuchs? The inventor of the GF file format? I don't remember if we ever met in person back in the day but hi!
Yes, that would be me. Usually folks bring up DVI, but thanks for the GF shout-out! For the record, as a real user of Metafont, all of your comments on this page are more informed than mine. (And, hi, Don!)
The biggest reason for MF's not catching on was the lack of immediate visual feedback (the program has hooks for displaying graphic output as it creates bitmaps, but I never saw them implemented on any platform). Adobe's internal tools (based on illustrator) and later Fontographer were the nails in the coffin. I remember talking about MF with Sumner Stone in 1989 or 1990 and he was blunt about how the Adobe design team considered it a dead end because they needed to directly manipulate the visual representation of the typefaces.
Slightly off-topic, but I've got a copy of Knuth's Computer Modern Typefaces (Book E in the Computers And Typesetting series). I don't think many people get to see this book. You can see where some of Kunth's time went. Here's a quote from the preface:
"Another piece of luck came my way in 1984, when I learned that the original bronze patterns used to make the molds of Monotype 8A were in San Francisco. For years I had been working with indirect and imprecise information about the fonts that had stimulated this work. First I had worked from photographic blowups of letterpress original pages from The Art of Computer Programming; then Richard Southall had prepared enlargements from original proofs he had located in England. At last I found the actual 80-year-old patterns that had generated the metal type. The present owner of these patters, Mr. Othmar Peters, kindly consented to let me borrow them while I was preparing the final draft of Computer Modern, and I learned much by measuring them with calipers."
You also get to see how "real typefaces" are produced using Metafont (namely, doing outlines and then filling them), which may not be crystal clear when reading the Metafontbook alone.
(I also like the book for a much simpler reason: it got me my Knuth cheque)
Volume D is the code, it’s interesting because the literate programming approach where the raw code is transformed into a fully typeset version for printing.
If you just want a quick rough idea of how the book (Volume E) is structured, you could look at the January 1980 report of the same name: http://infolab.stanford.edu/pub/cstr/reports/cs/tr/80/780/CS... — think of it as a very early draft where a lot of details (both code and prose) have changed, and the scan online is awful (rotated and low-resolution and somehow actually introduces typos) — but the bulk of the book is like the bulk of this report (two-page spreads with a glyph's definition in code on the right, with the resulting output on the left).
You sometimes see a person do some things with mf but these days most folks want vector output, not bitmaps.
Today, most of the use of these ideas is in drawing technical graphics. For instance, for his drawings Knuth uses MetaPost, which is very much like MetaFont but outputs vectors (there are some additions to take advantage of PostScript).
Another example of mp involves LuaTeX (briefly, TeX but where you can write in the scripting language Lua). The folks who have developed it have brought MetaPost in as a ready-made drawing library. See https://www.tug.org/TUGboat/tb29-3/tb93hagen-mplib.pdf for instance.
Finally, still another example of the use of these ideas is the stand alone graphics production program Asymptotehttps://en.wikipedia.org/wiki/Asymptote_(vector_graphics_lan... which aims to lift to 3D the algorithms that Knuth put into MetaFont to make beautiful curves. (I use this system.)
File size is one, since the output documents only hold the one font, whether it is for body text or section headers.
Another reason is magnify-ability, or zoom in-ability. Authors are annoyed when they produce a graphic, and then include it in a document, say expanded to 120% of its original size or shrunk to 75%, and it contains jaggie letters. Similarly, readers are annoyed to blow up a map and find that the town names are hard to read.
Still another is that one set of fonts will do for essentially all documents, so on your hard drive you don't need a set at 10 pts, another set at 11, etc. The space these take up is less of an issue than it used to be, but it is an administrative annoyance.
Another issue impacted me a lot since I put stuff up for download. You have to maintain a number of outputs for the dpi-ness of various output devices, so that people reading on a screen use a different output file than people using a printer. In addition, Knuth has settings called things like blacker to tune the output for the physical output device engine, so you may want to maintain output file versions tuned for a number of different vendor's devices. Besides, at some point printers just became vector devices.
Right, so: if one intends to sell a font, Metafont may not be a good idea, but if the purpose is to make a font for one's own use in book typography, and one is otherwise inclined to Metafont, then these concerns needn't stand in one's way.
And perhaps it would be possible to make a vector-outputting version, if this has already been done for MetaPost.
All this suggests that Knuth's Metafont work has ended up being a successful provocation regarding how it is possible to encode creative design and visual language.
Wow, never heard of this before but recently I mistyped mv as mf and got stuck vim-style. I wish I had this hardware arduino kill button for mf :), btw ctrl-z did the trick, found it after Googling for a long time.
If all you have is a few seconds, take a look at https://www.metaflop.com/modulator — play with the sliders, or click "flop it!" a few times.
That's the best very-quick introduction today to the basic ideas behind Metafont I think, and the best less-short one is Knuth's “The Concept of a Meta-Font” (1982) — this 25-page paper (in large font so it's really not very long) is IMO not just a great read but a brilliant performance (https://s3-us-west-2.amazonaws.com/visiblelanguage/pdf/16.1/...)
An even better presentation (although lacking bug fixes after publication) is volume D of Computers & Typesetting, Metafont: The Program. It's not just the output of weave (which is what's in the linked mf.pdf file), but also includes "mini-indexes" for quick cross-referencing of parts of the code.
I'd also note that while TeX is primarily the work of Knuth, MF was more of a collaboration between Knuth and his grad student John Hobby (who also wrote MetaPost) and Hobby should be recognized as a co-author of MF.
I should also recognize David Fuchs as the creator of the GF file format which is TeX's output format and the author of some of the auxiliary tools around MF. Tom Rokicki was not part of the original team, but he created the PK format for bitmap fonts which offered even greater compression than GF and became the standard for distributing bitmap fonts for TeX (for a long time even, after GF was created, a lot of device drivers required PXL fonts which were uncompressed bitmaps, which, especially in 1980s computing, were resource heavy).
Neenie Billawalla was an important figure in the development of MF as well. She created the calligraphic uppercase letters in the CM math set and the Pandora typeface which was, as I recall, the first non-CM type family created using MF84 (Euler Math predates it, but iirc was created using MF79 and didn't take advantage of the parameterization capable with MF so each size was separately digitized). I'm sure there were other important figures in the development of MF and the surrounding technologies back in the 80s, and I apologize if I've left anyone out.
I'd be interested in hearing about experiences with Metafont from those of you who have put effort into it. How far did you get and how much time did you spend? Any advice for others who would like to try?
You'll need the Metafontbook and Computer Modern Typefaces. It's worth spending time looking through the MF source for other typefaces in CTAN.
Drawing characters/symbols on graph paper is helpful for being able to determine what points should be.
MF is a really nice language to work with. It's macro-based like TeX, but because it's not intertwining with text presentation, it doesn't feel as awkward as TeX programming does. Among other things, it's effectively an algebraic solver system.
If it's available, gftodvi is a useful tool as well. It creates a large bitmap with annotations of locations on it (it was used for the illustrations in Computer Modern Typefaces). It would be so much nicer to use with contemporary previewing capabilities than things were back in 1990 when I had to send my gftodvi output to the Xerox printer in the basement of the computer center, hope it didn't crash the printer and get my printout half an hour later.
52 comments
[ 3.2 ms ] story [ 113 ms ] thread(1) You specify control points on the outline, not outside (as with Bezier curves). That's something Peter Karow already did with Ikarus, but it didn't prevail.
(2) You write programs. Obviously that was a non-starter for the type-designer profession, which is much more programming friendly today, but back then it wasn't.
Oh, and read up on the "hinting" mechanisms in Metafont, it's lightyears ahead of Type 1 hints and TrueType instructions.
Obviously, today it's long in the tooth: 128 glyphs are way to few, the fact that it creates bitmap fonts is en vogue, either.
Still, a fantastic tool from which you can still learn a lot.
It is really a nice approach, not only for typefaces but also for graphics in general there is the Metafont inspired MetaPost. [1]
> "You specify control points on the outline, not outside (as with Bezier curves)."
Metafont basically simulates tools like brush and broad nib pen. This is great for some typefaces but it surprisingly gets in the way for most punchcutting based typefaces. The shapes of most of these letters are just not easy to replicate with a brush or pen approach.
[1] Metafont minuscule f, MetaPost majuscule P, not a typo.
I was involved in a typesetting project in the 90s where I wrote a preprocessor which took 16-bit input (encoded using SJIS—Unicode was not yet widely adopted enough to be practical) and turned that into a stream of TeX code which handled font selection and character coding. It also handled allowing breaks between Kanji/Kana characters at allowable points (e.g., between two Kanji/Kana but not between Kanji/Kana and, say, a period).
There were some specialized extensions of TeX that were designed for CJK typesetting. With the rise of Unicode, this functionality became available in XeTeX.
Concerning bitmaps, it's ironic that window systems ultimately display bitmaps on the screen, yet they keep the pathway from font-outline to their character-bitmap cache internal. There's no way to tell MacOS, for instance, that you want to plug in your own provider, that it can call whenever it first wants the bitmap for a given font glyph at a given size. Too bad this API is hidden; it must exist internally in MacOS, Windows, etc.
To be fair, the language Metafont defines the font in vector format, but computers at the time weren't fast enough to interpret metafont on the fly generating the fonts, so in all metafont software until today there is this preprocessing part where you generate bitmap fonts.
I wonder if Metafont could be used today with new software which interprets Metafont code generating fonts on the fly. I read the Metafont book and all the programming capabilities appear very powerful and useful. Perhaps we could create fonts where there is variation each time a letter is printed, logos and symbols with more interactive behavior when it's compressed or stretched out...
The half-tone chapter is also quite cool.
At the time, the idea that a type designer would use a computer as part of the design process (or even at all) was pretty radical. And the notion that you were expected to design a parameterized version of your font, that would produce both regular and bold, in any point size, from a single source where you specified control point coordinates with multiple linear equations in multiple unknowns, was also a challenge. (And, no, it isn't acceptable to do that algorithmically.)
Ultimately, the biggest impediment seemed to be Metafont's "stroke with a brush" model was at odds with how designers lived in an "outline" world. The combination of this calligraphic orientation on top of needing to be comfortable with linear algebra and computer programming, account for Metafont's lack of popularity, I believe.
(And for those not in the know, David also created the DVI format.)
"Another piece of luck came my way in 1984, when I learned that the original bronze patterns used to make the molds of Monotype 8A were in San Francisco. For years I had been working with indirect and imprecise information about the fonts that had stimulated this work. First I had worked from photographic blowups of letterpress original pages from The Art of Computer Programming; then Richard Southall had prepared enlargements from original proofs he had located in England. At last I found the actual 80-year-old patterns that had generated the metal type. The present owner of these patters, Mr. Othmar Peters, kindly consented to let me borrow them while I was preparing the final draft of Computer Modern, and I learned much by measuring them with calipers."
(I also like the book for a much simpler reason: it got me my Knuth cheque)
Then short prose every now and then: https://www.2uo.de/image1.jpeg
But it's mostly the listings you can see on CTAN, as well. I actually misremembered and thought there was more explanation in the book.
What's really nice is that all glyphs are shown on a grid, next to their programs:
https://www.2uo.de/image0.jpeg
https://en.m.wikipedia.org/wiki/Literate_programming
Volume B is the code for TeX.
Today, most of the use of these ideas is in drawing technical graphics. For instance, for his drawings Knuth uses MetaPost, which is very much like MetaFont but outputs vectors (there are some additions to take advantage of PostScript).
Another example of mp involves LuaTeX (briefly, TeX but where you can write in the scripting language Lua). The folks who have developed it have brought MetaPost in as a ready-made drawing library. See https://www.tug.org/TUGboat/tb29-3/tb93hagen-mplib.pdf for instance.
Finally, still another example of the use of these ideas is the stand alone graphics production program Asymptote https://en.wikipedia.org/wiki/Asymptote_(vector_graphics_lan... which aims to lift to 3D the algorithms that Knuth put into MetaFont to make beautiful curves. (I use this system.)
Another reason is magnify-ability, or zoom in-ability. Authors are annoyed when they produce a graphic, and then include it in a document, say expanded to 120% of its original size or shrunk to 75%, and it contains jaggie letters. Similarly, readers are annoyed to blow up a map and find that the town names are hard to read.
Still another is that one set of fonts will do for essentially all documents, so on your hard drive you don't need a set at 10 pts, another set at 11, etc. The space these take up is less of an issue than it used to be, but it is an administrative annoyance.
Another issue impacted me a lot since I put stuff up for download. You have to maintain a number of outputs for the dpi-ness of various output devices, so that people reading on a screen use a different output file than people using a printer. In addition, Knuth has settings called things like blacker to tune the output for the physical output device engine, so you may want to maintain output file versions tuned for a number of different vendor's devices. Besides, at some point printers just became vector devices.
Basically, the market has spoken.
And perhaps it would be possible to make a vector-outputting version, if this has already been done for MetaPost.
[0] https://wiki.contextgarden.net/MetaType1
Letter & Spirit opens by describing a dialog between Knuth and Douglas Hofstadter ("Metafont, Mathematics, and Metaphysics"). For Hofstadter's essay, see https://core.ac.uk/display/15352994 or chapter 13 (p.260 & fwd.) of Metamagical Themas (https://archive.org/details/metamagicalthema0000hofs/page/n9...).
There is also Dexter Sinister's "A Note on Type" (https://www.sternberg-press.com/product/notes-on-the-type-ti...).
All this suggests that Knuth's Metafont work has ended up being a successful provocation regarding how it is possible to encode creative design and visual language.
That's the best very-quick introduction today to the basic ideas behind Metafont I think, and the best less-short one is Knuth's “The Concept of a Meta-Font” (1982) — this 25-page paper (in large font so it's really not very long) is IMO not just a great read but a brilliant performance (https://s3-us-west-2.amazonaws.com/visiblelanguage/pdf/16.1/...)
BTW the submitted link here goes to the “raw” .web source code of the METAFONT program, but that was meant to be read in typeset form: http://texdoc.net/texmf-dist/doc/generic/knuth/mf/mf.pdf
I'd also note that while TeX is primarily the work of Knuth, MF was more of a collaboration between Knuth and his grad student John Hobby (who also wrote MetaPost) and Hobby should be recognized as a co-author of MF.
Neenie Billawalla was an important figure in the development of MF as well. She created the calligraphic uppercase letters in the CM math set and the Pandora typeface which was, as I recall, the first non-CM type family created using MF84 (Euler Math predates it, but iirc was created using MF79 and didn't take advantage of the parameterization capable with MF so each size was separately digitized). I'm sure there were other important figures in the development of MF and the surrounding technologies back in the 80s, and I apologize if I've left anyone out.
Drawing characters/symbols on graph paper is helpful for being able to determine what points should be.
MF is a really nice language to work with. It's macro-based like TeX, but because it's not intertwining with text presentation, it doesn't feel as awkward as TeX programming does. Among other things, it's effectively an algebraic solver system.