Scroll to navigation

afmtodit(1) General Commands Manual afmtodit(1)

Name

afmtodit - adapt Adobe Font Metrics files for groff PostScript and PDF output

Synopsis

afmtodit [-ckmnqsx] [-a slant] [-d device-description-file] [-e encoding-file] [-f internal-name] [-i italic-correction-factor] [-o output-file] [-w space-width] afm-file map-file font-description-file
afmtodit --help
afmtodit -v
afmtodit --version

Description

afmtodit generates a font description file for use with groff(1)'s ps and pdf output devices from an Adobe Font Metric (AFM) file, afm-file. map-file associates a groff ordinary or special character name with a PostScript glyph name. afmtodit writes output in groff_font(5) format to font-description-file, a file named for the intended groff font name (but see the -o option).

map-file should contain a sequence of lines of the form

ps-glyph groff-char
where ps-glyph is the PostScript glyph name and groff-char is a groff ordinary (if of unit length) or special (if longer) character identifier. The same ps-glyph can occur multiple times in the file; each groff-char must occur at most once. afmtodit ignores blank lines and lines starting with “#”. If afmtodit does not find map-file in the current directory, it searches the devps/generate subdirectory of the default font directory.

If a PostScript glyph is not mentioned in map-file, and a groff character name can't be deduced using the Adobe Glyph List (AGL, built into afmtodit), then afmtodit puts the PostScript glyph into the groff font description file as an unnamed glyph that can only be accessed by the “\N” escape sequence in a roff document. In particular, this is true for glyph variants named in the form “foo.bar”; afmtodit maps all glyph names containing one or more periods to unnamed entities. Normally, afmtodit uses the encoding defined in the AFM file (that is, it interprets entries with non-negative codes); but see the -e option. Refer to section “Using Symbols” in Groff: The GNU Implementation of troff, the groff Texinfo manual, or groff_char(7), which describe how groff character identifiers are constructed.

Glyphs not encoded in the AFM file (i.e., entries indexed as “-1”) are still available in groff; they get glyph index values greater than 255 (or greater than the biggest code used in the AFM file in the unlikely case that it is greater than 255) in the groff font description file. Unencoded glyph indices don't have a specific order; it is best to access them only via special character identifiers.

If the font file proper (not just its metrics) is available, listing it in the files /usr/share/groff/1.25.0/font/devps/download and /usr/share/groff/1.25.0/font/devpdf/download enables it to be embedded in the output produced by grops(1) and gropdf(1), respectively.

If the -i option is used, afmtodit automatically generates an italic correction, a left italic correction, and a subscript correction for each glyph; groff_font(5) explains the significance of these. They can be specified for individual glyphs by adding to the afm-file lines of the form:

italicCorrection ps-glyph n
leftItalicCorrection ps-glyph n
subscriptCorrection ps-glyph n
where ps-glyph is the PostScript glyph name, and n is the desired value of the corresponding parameter in thousandths of an em. Such parameters are normally needed only for italic (or oblique) fonts.

Specify the -s option if the font is “special”, meaning that groff should search it whenever a glyph is not found in the current font. To enable this search, list font-description-file as an argument to the fonts directive in the output device's DESC file; alternatively, a document can designate it with the special request. If the font is not special, there is no need to do either, since troff(1) automatically mounts it when it is first used.

Options

--help displays a usage message, while -v and --version show version information; all exit afterward.

Use slant as the slant (“angle”) parameter in the font description file; GNU troff uses it to correctly position diacritical marks relative to base glyphs. By default afmtodit uses the negative of the ItalicAngle specified in the AFM file; with true italic fonts it is sometimes desirable to use a slant that is less than this. If you find that an italic font places accents too far to the right over base glyphs, use -a to give it a smaller slant.
Include comments in the font description file identifying the PostScript font.
Use desc-file as the device description file rather than the default DESC. If not found in the current directory, afmtodit searches the devps subdirectory of the default font directory. (This is true for both the default device description file and a file given with option -d.)
Rencode the PostScript font to use the encoding described in enc-file. grops(1) describes the format of enc-file . If not found in the current directory, afmtodit searches the devps subdirectory of the default font directory.
Set the internal name of the groff font to int-name.
Generate an italic correction for each glyph so that its width plus its italic correction is equal to factor thousandths of an em plus the amount by which the right edge of the glyph's bounding box is to the right of its origin. If this would result in a negative italic correction, use a zero italic correction instead.
Also generate a subscript correction equal to the product of the tangent of the slant of the font and four fifths of the x-height of the font. If this would result in a subscript correction greater than the italic correction, use a subscript correction equal to the italic correction instead.
Also generate a left italic correction for each glyph equal to factor thousandths of an em plus the amount by which the left edge of the glyph's bounding box is to the left of its origin. The left italic correction may be negative unless option -m is given.
This option is normally needed only with italic (or oblique) fonts. groff's developers created the the font description files distributed in the devps directory using an option of -i50 for italic fonts.
Write to output-file instead of font-description-file.
Omit any kerning data from the groff font; use only with monospaced (constant-width) fonts.
Prevent negative left italic correction values. For roman styles, groff's developers created the the font description files distributed in the devps directory using options “-i0 -m” to improve spacing with eqn(1).
Emit no “ligatures” directives for this font; use with monospaced (constant-width) fonts.
Quieten duplicate mapping warnings; see section “Diagnostics” below.
Emit “special” directive to the font description file.
Use dist as the width of inter-word spaces.
Ignore groff's built-in Adobe Glyph List.

Exit status

afmtodit exits with status 0 on successful operation, status 2 if the program cannot interpret its command-line arguments, and status 1 if it encounters an error during operation.

Files

/usr/share/groff/1.25.0/font/devps/DESC
describes the ps output device.
/usr/share/groff/1.25.0/font/devps/F
describes the font known as F on device ps.
/usr/share/groff/1.25.0/font/devps/download
lists fonts available for embedding within the PostScript document (or download to the device).
/usr/share/groff/1.25.0/font/devps/generate/dingbats.map
/usr/share/groff/1.25.0/font/devps/generate/dingbats-reversed.map
/usr/share/groff/1.25.0/font/devps/generate/slanted-symbol.map
/usr/share/groff/1.25.0/font/devps/generate/symbol.map
/usr/share/groff/1.25.0/font/devps/generate/text.map
map names in the Adobe Glyph List to groff special character identifiers for Zapf Dingbats (ZD), reversed Zapf Dingbats (ZDR), slanted symbol (SS), symbol (S), and text fonts, respectively. These map-files produce the font description files provided with groff for the grops output driver.

Diagnostics

AGL name 'x' already mapped to groff name 'y'; ignoring AGL name 'uniXXXX'
You can disregard these if they're in the form shown, where the ignored AGL name contains four hexadecimal digits XXXX. The Adobe Glyph List (AGL) has its own names for glyphs; they often differ from groff's special character names. afmtodit is constructing a mapping from groff special character names to AGL names; this can be a one-to-one or many-to-one mapping, but one-to-many does not work, so afmtodit discards the excess mappings. For example, if x is Delta, y is *D, and XXXX is 0394, afmtodit is telling you that the groff font description that it is writing cannot map the groff special character \[*D] to AGL glyphs Delta and uni0394 at the same time.
If you get a message like this but are unhappy with which mapping is ignored, a remedy is to craft an alternative map-file and re-run afmtodit using it.
When the -q option is used, these messages are suppressed in favor of a count of how many would have been emitted were the option not present.

See also

Groff: The GNU Implementation of troff, by Trent A. Fisher and Werner Lemberg, is the primary groff manual. Section “Using Symbols” may be of particular note. You can browse it interactively with “info '(groff)Using Symbols'”.

groff(1), gropdf(1), grops(1), groff_font(5)

2026-11-22 groff 1.25.0