My main experience with Metafont was Christopher Grandsire's The METAFONTtutorial which I think is a good and concise description of the language and its tricks, but I've missing one important part: how to produce a .PDF or printed document using your newly created font.

So. How can I write a Hello World document using a newly created font with Metafont? (Or with any other font I would've created by a package such as Fontographer, FontForge, etc.)

  • 1
    I believe this is as simple as \font\myfont=mymetafont.mf \myfont This is my meta font \vfill\eject\bye when mymetafont.mf is in the working directory, or the font paths searched by TeX. – WillAdams Nov 6 '13 at 14:16
  • @WillAdams Running my tex hello.tex example I get a .dvi which I cannot read in my dvi reader. dvips produces the same result, and ps2pdf does not show the commanded characters. pdftex reports error “!pdfTeX error: pdftex (file chlscr): Font chlscr at 600 not found” and luatex reports “! Font \myfont=chlscr.mf not loadable: metric data not found or bad.” I might be missing some step. – Carlos Eugenio Thompson Pinzón Nov 6 '13 at 15:54
  • I think this may then be addressed by the FAQ: tex.ac.uk/cgi-bin/texfaq2html?label=useMF – WillAdams Nov 6 '13 at 16:29
  • 1
    Found the problem: I failed to create the metric file with the gftomk command. – Carlos Eugenio Thompson Pinzón Nov 6 '13 at 23:35
  • 1
    @CarlosEugenioThompsonPinzón I think you mean the gftopk command, which creates a .pk file. Metafont itself creates the metric file (exension .tfm). The error you quote from pdftex indicate a missing file named chlscr.600pk. On the other hand the error from luatex indicates a missing .tfm file. That could come from using the incorrect \font command. It should be \font\myfont=chlscr (without extension), not \font\myfont=chlscr.mf. – Dan Nov 7 '13 at 7:01

Okay this is a working example using LaTeX:

This is a {\myscr hello world} example:

The quick brown fox jumps over the lazy dog.

And this is a working example using plain TeX, as suggested by WillAdams:

\font\myfont=chlscr.mf Hello: \myfont hello world \vfill\eject\bye 

For these examples to work, I need to run
mf '\mode=ljfour; input chlscr.mf' to create the chlscr.600gf and chlscr.tmf files.
gftopk chlscr.600gf chlscr.600pk to create the chlscr.600pk file.

Without this metric files pdftex and pdflatex will fail. (and tex and latex commands will compile but the generated .dvi won't work.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.