groff_font(5)
๐ Name ๐
groff_font โ GNU roff device and font description files ๐ manual page: groff_font(5) from the File Formats Manual ๐ซถ
โจ Description โจ
Okay so, bestie, the groff font and output device description formats are slight extensions of the ones used by AT&T device-independent troff. Unlike the AT&T implementation, groff lacks a binary format โ all files are text files. (Plan 9 troff has also abandoned the binary format, so this is a whole text-file vibe fr fr.) โจ
The device and font description files for a device name are stored in a devname directory. The device description file is called DESC, and, for each font supported by the device, a font description file is called f, where f is usually an abbreviation of a fontโs name and/or style. For example, the ps (PostScript) device has groff font description files for Times roman (TR) and Zapf Chancery Medium italic (ZCMI), among many others, while the utf8 device (for terminals) has font descriptions for the roman, italic, bold, and bold-italic styles (R, I, B, and BI, respectively). ๐
Device and font description files are read by the formatter, troff, and by output drivers. The programs typically delegate these filesโ processing to an internal library, libgroff, ensuring their consistent interpretation. No cap, thatโs the whole point. ๐ซถ
๐ธ DESC file format ๐ธ
The DESC file contains a series of directives; each begins a line. Their order is not important, with two exceptions: (1) the res directive must precede any papersize directive; and (2) the charset directive must come last (if at all). ๐จ
๐จ Order check, bestie:resbefore anypapersize, andcharsetlast if it shows up. Periodt.
If a directive name is repeated, later entries in the file override previous ones (except that the paper dimensions are computed based on the res directive last seen when papersize is encountered). Spaces and/or tabs separate words and are ignored at line boundaries. Comments start with the # character and extend to the end of a line. Empty lines are ignored. Easy. ๐
family famโ the default font family is fam.fonts n F1 ... Fnโ fontsF1, ...,Fnare mounted at font positionsm+1, ...,m+nwhere m is the number of styles (see below). This directive may extend over more than one line. A font name of0causes no font to be mounted at the corresponding position.hor nโ the horizontal motion quantum is n basic units. Horizontal measurements round to multiples of n.image_generator programโ use program to generatePNGimages fromPostScriptinput. UnderGNU/Linux, this is usuallygs(1), but under other systems (notablyCygwin) it might be set to another name. Thegrohtml(1)driver uses this directive.paperlength nโ the vertical dimension of the output medium is n basic units (deprecated: usepapersizeinstead). ๐papersize format-or-dimension-pair-or-file-name ...โ the dimensions of the output medium are as according to the argument, which is either a standard paper format, a pair of dimensions, or the name of a plain text file containing either of the foregoing. ๐- Standard paper formats: the ISO and DIN formats
A0โA7,B0โB7,C0โC7, andD0โD7; the U.S. formatsletter,legal,tabloid,ledger,statement, andexecutive; and the envelope formatscom10,monarch, andDL. Matching is performed without regard for lettercase. โจ - Custom paper format:
length,width(with no spaces before or after the comma). Both length and width must have a unit appended; valid units areifor inches,cfor centimeters,pfor points, andPfor picas. Example:12c,235p. An argument that starts with a digit is always treated as a custom paper format. ๐ - File name: e.g.,
/etc/papersize; if the file can be opened, the first line is read and a match attempted against each other form. No comment syntax is supported. ๐ - More than one argument can be specified; each is scanned in turn and the first valid paper specification used. ๐
- Standard paper formats: the ISO and DIN formats
paperwidth nโ the horizontal dimension of the output medium is n basic units (deprecated: usepapersizeinstead). ๐pass_filenamesโ directtroffto emit the name of the source file being processed. This is achieved with the intermediate output commandx F, whichgrohtmlinterprets.postpro programโ use program as the postprocessor.prepro programโ use program as a preprocessor. Thehtmlandxhtmloutput devices use this directive.print programโ use program as the print spooler. If omitted,groffโs-land-Loptions are ignored. ๐ซถres nโ the device resolution is n basic units per inch.sizes s1 ... sn 0โ the device has fonts ats1, ...,snscaled points (see below). The list of sizes must be terminated by a0. Eachsican also be a range of sizesmโn. The list can extend over more than one line. ๐ธsizescale nโ a typographical point is subdivided into n scaled points. The default is1.styles S1 ... Smโ the first m font mounting positions are associated with stylesS1, ...,Sm.tcommandโ the postprocessor can handle thetanduintermediate output commands.unicodeโ the output device supports the complete Unicode repertoire. This directive is useful only for devices which produce character entities instead of glyphs.
If unicode is present, no charset section is required in the font description files since the Unicode handling built into groff is used. However, if there are entries in a font description fileโs charset section, they either override the default mappings for those particular characters or add new mappings (normally for composite characters). ๐ฆ
The utf8, html, and xhtml output devices use this directive.
unitwidth nโ arbitrary basis with respect to which font metrics are proportionally scaled when rendering glyphs at a type size of one point.unscaled_charwidthsโ make the font handling module always return unscaled glyph widths. Thegrohtmldriver uses this directive.use_charnames_in_specialโtroffshould encode special characters in arguments to device extension commands. Thegrohtmldriver uses this directive.vert nโ the vertical motion quantum is n basic units. Vertical measurements round to multiples of n.charsetโ this directive and the rest of the file are ignored. It is recognized for compatibility with othertroffimplementations. In GNUtroff, character set repertoire is described on a per-font basis. ๐
troff recognizes but ignores the directives spare1, spare2, and biggestfont. ๐
๐จ Mandatory lines, no skipping: theres,unitwidth,fonts, andsizeslines are mandatory.
Directives not listed above are ignored by troff but may be used by postprocessors to obtain further information about the device. โจ
๐ธ Font description file format ๐ธ
okay so on typesetting output devices, each font is typically available at multiple sizes. While paper measurements in the device description file are in absolute units, measurements applicable to fonts must be proportional to the type size. The font's unit width establishes a numerical basis that permits all of its metrics to be expressed as integers if rendered at one point. When the formatter configures a type size, it scales the metrics linearly relative to that basis. The unit width has no inherent relationship to the device resolution, and the same division procedure applies to all font metrics. Observe that whatever unit you might select for the unit width, the division operation implied by scaling cancels it out, leaving a dimensionless quantity. math girlie moment, honestly ๐งฎโจ
For instance, groff's lbp device uses a unitwidth directive with an argument of 800. Its Times roman font TR has a spacewidth of 833; this is also the width of its comma, period, centered period, and mathematical asterisk, while its โMโ has a width of 2,963. Thus, an โMโ on the lbp device is 2,963 รท 800 times the unit width, or approximately 3.7. At a type size of 10 points, a Times roman โMโ is therefore 37 units wide. the math is mathing ๐
A font description file has two sections. The first is a sequence of directives, and is parsed similarly to the DESC file described above. Except for the directive names that begin the second section, their ordering is immaterial. Later directives of the same name override earlier ones, spaces and tabs are handled in the same way, and the same comment syntax is supported. Empty lines are ignored throughout.
nameF โ the name of the font is F. โDESCโ is an invalid font name. Simple integers are valid, but their use is discouraged. (groff requests and escape sequences interpret non-negative integers as mounting positions instead. Further, a font named โ0โ cannot be automatically mounted by thefontsdirective of aDESCfile.)spacewidthn โ the width of an unadjusted inter-word space is n, relative to the device's unit width.
The directives above must appear in the first section; those below are optional.
slantn โ the font's glyphs have a slant of n degrees; a positive n slants in the direction of text flow.ligaturesโ syntax isligatures lig1 ... lign [0]; glyphs lig1, ..., lign are ligatures; possible ligatures areff,fi,fl,ffi, andffl. For compatibility with other troff implementations, the list of ligatures may be terminated with a0. The list of ligatures must not extend over more than one line.specialโ the font is special: when the document attempts to format a glyph that is not present in the formatter's currently selected font, the glyph is sought in any mounted fonts that bear this property. Often, such fonts are unstyled, having no heavy (bold) or slanted (italic or oblique) variants.
Other directives in this section are ignored by GNU troff, but may be used by postprocessors to obtain further information about the font. side quest information, basically ๐ฆ
The second section contains one to three subsections, which can appear in any order, and any of which starts the second section. Each starts with a directive on a line by itself. A charset subsection is mandatory unless the associated DESC file contains the unicode directive. Another subsection, kernpairs, is optional.
The directive charset starts the character set subsection. (On typesetters, this directive is misnamed since it starts a list of glyphs, not characters.) It precedes a series of glyph descriptions, one per line. Each such glyph description comprises a set of fields separated by spaces or tabs and organized as follows.
name metrics type index [entity-name] [-- comment]
name identifies the glyph: a printable character c corresponds to the troff ordinary character c, and a multi-character sequence not beginning with \, corresponds to the GNU troff special character escape sequence \[name]. A name consisting of three minus signs, โ---โ, indicates that the glyph is unnamed: such glyphs can be accessed only by the \N escape sequence in troff. A special character named โ---โ can still be defined using .char and similar requests. The name \- defines the minus sign glyph. Finally, name can be the horizontal motion escape sequences, \| and \^ (โthinโ and โhairโ spaces, respectively), in which case only the width metric described below is applied; a font can thus customize the widths of these spaces. custom space widths? slay โจ
The form of the metrics field is as follows (on one line; it may be broken here for readability).
width[,[height[,[depth[,[italic-correction[,[
left-italic-correction[,[subscript-correction]]]]]]]]]]
Spaces, tabs, and newlines are prohibited between these subfields, which are expressed as decimal integers. The unit of measure is that established by the unitwidth directive and scaled to the type size. Unspecified subfields default to 0. Since there is no associated binary format, these values are not required to fit into the C language data type char as they are in AT&T device-independent troff. no tiny-type crunch, we love to see it ๐
The width subfield gives the width of the glyph. The height subfield gives the height of the glyph (upward is positive); if a glyph does not extend above the baseline, give it a zero height, not a negative height. The depth subfield gives the depth of the glyphโthat is, the distance below the baseline to which the glyph extends (downward is positive); if a glyph does not extend below the baseline, give it a zero depth, not a negative depth. Italic corrections apply when upright and slanted (italic or oblique) styles are typeset adjacently. The italic-correction is the amount of space to add after a slanted glyph to be followed immediately by an upright glyph. The left-italic-correction is the amount of space to add before a slanted glyph to be preceded immediately by an upright glyph. The subscript-correction is the amount of space to add after a slanted glyph to be followed by a subscript; it should be less than the italic correction. respect the spacing rules, bestie ๐
For fonts used with typesetters, the type field gives a featural description of the glyph: it is a bit mask recording whether the glyph is an ascender, descender, both, or neither. When a \w escape sequence is interpolated, these values are bitwise or-ed together for each glyph and stored in the ct register. In font descriptions for terminals, all glyphs might have a type of zero, regardless of their appearance.
0โ means the glyph lies entirely between the baseline and a horizontal line at the โx-heightโ of the font, as with โaโ, โcโ, and โxโ;1โ means the glyph descends below the baseline, like โpโ;2โ means the glyph ascends above the font's x-height, like โAโ or โbโ); and3โ means the glyph is both an ascender and a descenderโthis is true of parentheses in some fonts.
The index field is an integer that uniquely identifies a glyph within the font; any integer is accepted as input, (that is, any integer parsable by the C standard library's strtol(3) function) but no practical font employs all possible values. An index is limited to the range of the system's C language data type int. In a troff document, use the indexed character escape sequence \N to specify a glyph by index. one glyph, one index, no cap ๐
The entity-name field defines an identifier for the glyph that the postprocessor uses to print the troff glyph name. This field is optional; it was introduced so that the grohtml output driver could encode its character set. For example, the glyph \[Po] is represented by โ£โ in HTML 4.0. For efficiency, these data are now compiled directly into grohtml. grops uses the field to build sub-encoding arrays for PostScript fonts containing more than 256 glyphs.
Anything on the line after the entity-name field or โ--โ is ignored. When afmtodit generates font description files for gropdf(1) and grops(1), it writes the UTF-16 code for the character to the comment field. comment field: not for your diary, but okay ๐ญ
A line in the charset section can also have the form
name "
identifying name as another name for the glyph mentioned in the preceding line. Such aliases can be chained. alias chain, literally iconic โญ
A charset-range subsection works like the charset directive except that the glyph descriptions use a name of the form uAAAA..uFFFF, where AAAA and FFFF are hexadecimal digit sequences; the specified metrics then apply identically to all glyphs in the designated range.
The directive kernpairs starts a list of kerning adjustments to be made to adjacent glyph pairs from this font. It contains a sequence of lines formatted as follows.
g1 g2 n
The foregoing means that when glyph g1 is typeset immediately before g2, the space between them should be increased by n. The unit of measure is that established by the unitwidth directive and scaled to the type size. Most kerning pairs should have a negative value for n. negative kern, positive vibe ๐
๐ธ FILES ๐ธ
/usr/share/groff/1.24.2/font/devname/DESCโ describes the output device name./usr/share/groff/1.24.2/font/devname/Fโ describes the font known as F on device name.
๐ SEE ALSO ๐
- Groff: The GNU Implementation of troff, by Trent A. Fisher and Werner Lemberg, is the primary groff manual. You can browse it interactively with
info groff. - โTroff User's Manualโ by Joseph F. Ossanna, 1976 (revised by Brian W. Kernighan, 1992), AT&T Bell Laboratories Computing Science Technical Report No. 54, widely called simply โCSTR #54โ, documents the language, device and font description file formats, and device-independent page description language referred to collectively in groff documentation as โAT&T troffโ.
- โA Typesetter-independent TROFFโ by Brian W. Kernighan, 1982, AT&T Bell Laboratories Computing Science Technical Report No. 97, provides additional insights into the device and font description file formats and device-independent page description language.
groff(1), subsection โUtilitiesโ, lists programs available for describing fonts in a variety of formats such that groff output drivers can use them.troff(1)documents the default device and font description file search path.groff_out(5),addftinfo(1)
๐ okay that's the whole font-format lore drop, bestie. signed, sealed, and typeset with love: groff 1.24.2, dated 2026-10-01, page groff_font(5). periodt. ๐
๐ฆ where this page comes from
- alpine 3.24: groff-doc 1.24.2-r0 ยท GPL-3.0-or-later
- Copyright 1989-2025 Free Software Foundation, Inc
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms