# create Meta-Font

I know, you're supposed to only ask questions about very specific technical problems and this is not such a question. If you think that this post is inappropriate, please tell me so, by writing a comment and I will delete the question, but I really need help and I don't know where else to go.

I work as a Graphic-Designer and I have basic programming knowledge but I pretty much only work with GUIs. I recently read something about Meta-Fonts in a book, I was very fascinated and I now want to create my own Meta-Font.

I found some really good documentation online on how to create such a font, but I only have computers running macOS and the documentation I'm trying to follow doesn't really go into detail on what applications I have to install on a Mac, to create a Meta-Font. I did some googling and I found MiKTeX, which looks like a solid application that is also available for macOS, but I'm really new to all of this and my questions is:

Do I need more than just MiKTeX to create a Meta-Font? I read that I will also need GFtoPK, is this included in MiKTeX?

Thank You! –Simon

• Yes, you can create your own fonts with METAFONT, but that is a very dated approach, since modern tex engines can use PostScript, TrueType and Open Type fonts. If you want to create your own font, I recommend: Gylphs, FontLab or FontForge. The last one is open source. – DG' Dec 9 '20 at 20:06
• @DG' Thank you for your answer! I already have a lot of experience with creating vectors, I know about OpenType and TrueType and I've created some vectors directly with PostScript and of course with the Adobe-Cloud, but my goal here is not to create a perfect font-family, I just think that this old and weird way of creating a font is really interesting and I want to play around with it a bit. – This is why I want to do something with METAFONT. – Simon R. Dec 9 '20 at 20:38
• you need a tex system, either miktex or mactex (based on texlive): tug.org/mactex. Both should contain anything you need. – Ulrike Fischer Dec 9 '20 at 20:56
• You should start here: ctan.org/pkg/metafont-beginners any complete tex distribution (MiKTeX, MacTeX, TeX Live) should already have the software you need to use METAFONT. Maybe you'd like to check ctan.org/topic/font-devel too – DG' Dec 9 '20 at 20:59
• Before getting started actually working with METAFONT, you may have some fun playing with this demo of a Metafont-like system (actually based on METAFONT somewhere underneath): Metaflop Modulator. Without installing anything, you can also play with the MetaPost previewer (MetaPost is somewhat like METAFONT and shares a lot of the code/ideas). I think there was a MF workshop(?) about a month ago: I haven't looked it up but something from it may be available/useful (in French): this may be the link? Good luck :-) – ShreevatsaR Dec 9 '20 at 21:58

The MacTeX system will include all the software you need. You may want to install Aquamacs for editing the mf files since it includes a dedicated MF mode which will give syntax highlighting. Note that MacTeX takes a long time to download from scratch so be patient with it.

If you're looking to get deep into it, I would recommend reading The METAFONTbook and also picking up a copy of Computer Modern Typefaces (Volume E of Computers and Typesetting). Neenie Billawalla's Metamarks is hard to come by, but presents another complete design with Metafont which can be downloaded from CTAN at https://ctan.org/tex-archive/fonts/pandora?lang=en This is notable since it's really the most comprehensive attempt at designing a metafont by someone coming at it from a design perspective.

The ultimate failure of Metafont was a consequence of the fact that it was more of a mathematical/programming tool than a visual one. Talking with Sumner Stone in the early 90s, he said that it didn't work for him or other type designers because they needed to interact more directly with the visual aspect of the work.

• All right, thank you! – Simon R. Dec 10 '20 at 13:01

It turns out you can actually just use MiKTeX too (as asked in the question), although when this question was posted, it was slightly less obvious on MikTeX, because of an issue that is now fixed as of MiKTeX 20.12. So here is a tutorial/walk-through of how to get started with playing with METAFONT.

### Initial setup

Install either TeX Live (aka MacTeX on macOS) or MikTeX. The main difference is that with the former it's easier to just “install everything” (several gigabytes), and with the latter (MiKTeX) it's easier to have an absolutely minimal installation and install everything else on demand (when needed).

Whichever one you install (or have previously installed), make sure you have a working installation by verifying that the following input file can be compiled (e.g. on MiKTeX may have to install a couple dozen things the first time):

\documentclass{article}
\begin{document}
Hello
\end{document}


For example you may use an IDE like TeXworks (comes with MiKTeX) or TeXShop (comes with MacTeX), or if the above is in a file foo.tex, you may run pdflatex foo.tex at the commandline.

### Draw something

This may not be how you'll design characters when you're an expert at METAFONT (or it may be, what do I know), but you can get started by making a drawing on graph paper.

Draw a letter (or arbitrary shape), the way you would like it to look. I drew this shape, looking somewhat like a question mark:

### Label interesting points

Give names to some points on the shape; here I've labelled four points (1, 2, 3, 4) and also drawn axes in order to count off their coordinates:

### Create a METAFONT file

Now create a file called cee.mf (for this example), that will be the METAFONT source file that describes the shape you drew. The manual (The METAFONTbook) explains the syntax for doing this. Choose which position in your font you wish this shape to be assigned as the glyph for. Here I chose "q" (i.e. ASCII 112; you can use any number from 0 to 255).

mode_setup;

% (character code, width, height, depth)
beginchar("q", 8pt#, 10pt#, 0);
"A funny shape";
% Can use variables w, h, d below.
z1 = (1/7 w, 7/8 h);
z2 = (6/7 w, 4/8 h);
z3 = (3/7 w, 3/8 h);
z4 = (3/7 w, 1/8 h);
pickup pencircle scaled 0.15w;
draw z1 .. z2 .. z3 -- z4;
penlabels(1, 2, 3, 4);
endchar;

end


### Use this file

One way to make use of this METAFONT file is to just refer to it from your TeX file (in the same directory as the .mf file):

\documentclass{article}
\begin{document}
\font\myfont=cee

Hey look, {\myfont qqq} from our font.
\end{document}


This will (under TeX Live or MiKTeX) automatically invoke the mf program to generate whatever TeX needs to know about the font:

Congratulations, you just typeset a document that uses a font you created!

But wait…

### Specifying paths

You may have noticed that the shape is not exactly what we intended. Turns out METAFONT has its own ideas about how to join points. One way to overcome this is to add lots of points, but there are better ways; read the METAFONTbook for details.

Here, it turns out we can change our draw line to:

draw z1{right} .. z2{down} .. {left}z3 -- z4;


### Iterating/making changes

We want to edit the .mf file and have the updated font definition used when the .tex file is compiled. The easiest way I've found to do this is to simply delete both the tfm and pk files that were generated.

• On TeX Live, these are cee.tfm and cee.600pk in the same directory as our .tex and .mf files.

• On MiKTeX, these are installed in a surprising directory:

~/Library/Application Support/MiKTeX/texmfs/data/fonts/tfm/cg/egyptian/cee.tfm
~/Library/Application Support/MiKTeX/texmfs/data/fonts/pk/ljfour/cg/egyptian/dpi600/cee.pk


Depending on the name of your .mf file they may have been put somewhere else! Look at the log output for hints.

This is the command I used that works for both TL and MiKTeX (and shows which files it deleted):

rm -vf cee.{tfm,600pk} ~/Library/Application\ Support/MiKTeX/texmfs/data/fonts/{tfm/cg/egyptian/cee.tfm,pk/ljfour/cg/egyptian/dpi600/cee.pk}


Then you can compile the .tex file again to have the font be regenerated:

Much better.

### Proof sheets

Rather than view the glyph only in your typeset document, you may want to see it at large size to “debug” it. You can run:

mf '\mode=proofmode; input cee' && gftodvi cee.2602gf && dvipdfmx cee.dvi && open cee.pdf


Looks something like:

As mentioned in the answer by Don Hosek, you should read the METAFONTbook to learn more about the syntax of the program, and carefully study the definitions in Computer Modern and Pandora to learn how actual typefaces have been constructed with METAFONT. You can also look at other examples; Luc Devroye has collected a lot of relevant links here.

Even this simple example font we drew with a simple shape illustrates some of the things unique to METAFONT:

• As the shape is just a program, you can change lots of values and see what happens, parametrize it (doing this wisely is nontrivial though!), make variations, etc. Knuth's article The Concept of a Meta-Font is valuable to read carefully, as it is a demonstration of all this.

• You can't just draw the shape; you have to explain to the computer (by writing a program) how to draw the shape. (Knuth believes this is worthwhile for its own sake and deepens one's “understanding” of the font, and I'm inclined to agree, but it's definitely harder than simply drawing.) See Richard Southall's article Designing a new typeface with METAFONT which mentions problems with this, including a quote from Charles Bigelow: “the designer thinks with images, not about images”.

• I haven't noticed anyone mention this (probably someone has), but I wonder about the influence on design: Is one tempted to pick easier-to-describe points and paths (those with a “clean” definition), rather than choose them purely visually?

Anyway, even though METAFONT seems (culturally) a dead end as far as mainstream font design goes, it sure looks like this process can be fun; good luck!

• Posted shortly before this answer, but I'm seeing this only now: someone's font they say is after six hours with METAFONT, available here. – ShreevatsaR Dec 19 '20 at 16:44
• Hey man, thank you so much! :) – Simon R. Dec 20 '20 at 17:17
• @SimonR. You're welcome, was a good opportunity for me too to write this down for future reference… let me know if you end up using METAFONT for anything. :-) – ShreevatsaR Dec 20 '20 at 18:17
• It might take me a while, I'm super caught up in other projects right now, but I will definitely work with this in the future. :) – Simon R. Dec 22 '20 at 12:56