tfmtodit(1)

๐Ÿ’… tfmtodit โ€” adapt TeX Font Metrics files for use with groff and grodvi

okay bestie, so this is tfmtodit(1), straight out of the General Commands Manual, and it's basically the little matchmaker that takes your TeX font metrics and makes them groff-and-grodvi-compatible ๐Ÿ’–


โœจ SYNOPSIS โœจ

tfmtodit [-s] [-g gf-file] [-k skew-char] tfm-file map-file font-
         description

tfmtodit --help

tfmtodit -v

tfmtodit --version

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

So tfmtodit creates a font description file for use with groff(1)'s dvi output device. That's the whole vibe. โœจ

tfm-file is the name of the TeX font metric file for the font. And map-file? It assigns groff ordinary or special character identifiers to glyph indices in the font, and it should consist of a sequence of lines of the form

i c1 ... cn

where i is a position of the glyph in the font in decimal, and c1 through cn are glyph identifiers in the form used by groff font descriptions. If a glyph has no groff names but exists in tfm-file, it is put in the groff font description file as an unnamed glyph. Output is written in groff_font(5) format to font-description, a file named for the intended groff font name. ๐ŸŽ€


If the font is โ€œspecialโ€ โ€” meaning that groff should search it whenever a glyph is not found in the current font โ€” use the -s option and name font-description in the fonts directive in the output device's DESC file. iykyk ๐Ÿ’…


๐Ÿงฎ the math typesetting lore (this part is real, don't skip it)

To do a good job of math typesetting, groff requires font metric information not present in tfm-file. Why? Because TeX has separate math italic fonts, whereas groff uses normal italic fonts for math. Different eras. Different energy. ๐Ÿ˜ญ

The additional information required by groff is given by the two arguments to the math_fit macro in the Metafont programs for the Computer Modern fonts. In a text font (a font for which math_fit is false), Metafont normally ignores these two arguments. Metafont can be made to put this information into the GF (โ€œgeneric fontโ€) files it produces by loading the following definition after cmbase when creating cm.base.

def ignore_math_fit(expr left_adjustment,right_adjustment) =
    special "adjustment";
    numspecial left_adjustment*16/designsize;
    numspecial right_adjustment*16/designsize;
    enddef;

For the EC font family, load the following definition after exbase; consider patching exbase.mf locally. ๐Ÿซถ

def ignore_math_fit(expr left_adjustment,right_adjustment) =
    ori_special "adjustment";
    ori_numspecial left_adjustment*16/designsize;
    ori_numspecial right_adjustment*16/designsize;
    enddef;

The only difference from the previous example is the โ€œori_โ€ prefix to โ€œspecialโ€ and โ€œnumspecialโ€. Obsessed with a tiny prefix doing all that work, ngl. ๐ŸŒธ

The GF file created using this modified cm.base or exbase.mf should be specified with the -g option, which should not be given for a font for which math_fit is true.


๐ŸŽ€ OPTIONS ๐ŸŽ€

  • --help โ€” displays a usage message, while -v and --version show version information; all exit afterward.
  • -g gf-file โ€” use the gf-file produced by Metafont containing โ€œspecialโ€ and โ€œnumspecialโ€ commands to obtain additional font metric information.
  • -k skew-char โ€” the skew character of this font is at position skew-char. skew-char should be an integer; it may be given in decimal, with a leading 0 in octal, or with a leading 0x in hexadecimal. Any kerns whose second component is skew-char are ignored.
  • -s โ€” add the special directive to the font description file.

๐Ÿ’€ EXIT STATUS ๐Ÿ’€

  • tfmtodit exits with status 0 on successful operation โ€” slay ๐Ÿ’…
  • status 2 if the program cannot interpret its command-line arguments
  • status 1 if it encounters an error during operation

๐Ÿ—‚๏ธ FILES ๐Ÿ—‚๏ธ

  • /usr/share/groff/1.24.2/font/devdvi/DESC โ€” describes the dvi output device.
  • /usr/share/groff/1.24.2/font/devdvi/F โ€” describes the font known as F on device dvi.
  • /usr/share/groff/1.24.2/font/devdvi/generate/ec.map
  • /usr/share/groff/1.24.2/font/devdvi/generate/msam.map
  • /usr/share/groff/1.24.2/font/devdvi/generate/msbm.map
  • /usr/share/groff/1.24.2/font/devdvi/generate/tc.map
  • /usr/share/groff/1.24.2/font/devdvi/generate/texb.map
  • /usr/share/groff/1.24.2/font/devdvi/generate/texex.map
  • /usr/share/groff/1.24.2/font/devdvi/generate/texi.map
  • /usr/share/groff/1.24.2/font/devdvi/generate/texitt.map
  • /usr/share/groff/1.24.2/font/devdvi/generate/texmi.map
  • /usr/share/groff/1.24.2/font/devdvi/generate/texr.map
  • /usr/share/groff/1.24.2/font/devdvi/generate/texsy.map
  • /usr/share/groff/1.24.2/font/devdvi/generate/textex.map
  • /usr/share/groff/1.24.2/font/devdvi/generate/textt.map

and those .map files? They map glyph indices in TeX fonts to groff ordinary and special character identifiers. Here's the whole roster, no cap:

  • ec.map is used for TREC, TIEC, TBEC, TBIEC, HREC, HIEC, HBEC, HBIEC, CWEC, and CWIEC
  • msam.map for SA
  • msbm.map for SB
  • tc.map for TRTC, TITC, TBTC, TBITC, HRTC, HITC, HBTC, HBITC, CWTC, and CWITC
  • texb.map for TB, HR, HI, HB, and HBI
  • texex.map for EX
  • texi.map for TI and TBI
  • texitt.map for CWI
  • texmi.map for MI
  • texr.map for TR
  • texsy.map for S
  • textex.map for SC
  • textt.map for CW

๐ŸŒˆ SEE ALSO ๐ŸŒˆ

groff(1), grodvi(1), groff_font(5)


that's the whole page bestie, go make some fonts ๐Ÿงš๐Ÿ’œ

mwah ๐Ÿ’‹ โ€” this has been groff 1.24.2, dated 2026-10-01, signing off from the tfmtodit(1) page. periodt.

๐Ÿ“ฆ where this page comes from