GROFF_FONT(5) | File Formats Manual | GROFF_FONT(5) |
groff_font - format of groff device and font description files
The groff font format is roughly a superset of the ditroff font format. The font files for device name are stored in a directory devname. There are two types of file: a device description file called DESC and for each font F, a font file called F. These are text files; unlike the ditroff font format, there is no associated binary format.
The DESC file can contain the following types of line as shown below. Later entries in the file override previous values.
Empty lines are ignored.
The res, unitwidth, fonts, and sizes lines are compulsory. Not all commands in the DESC file are used by troff itself; some of the keywords (or even additional ones) are used by postprocessors to store arbitrary information about the device.
Here a list of obsolete keywords which are recognized by groff but completely ignored: spare1, spare2, biggestfont.
A font file has two sections; empty lines are ignored in both of them.
The first section is a sequence of lines each containing a sequence of blank delimited words; the first word in the line is a key, and subsequent words give a value for that key.
Other commands are ignored by troff but may be used by postprocessors to store arbitrary information about the font in the font file.
The first section can contain comments which start with the # character and extend to the end of a line.
The second section contains one or two subsections. It must contain a charset subsection and it may also contain a kernpairs subsection. These subsections can appear in any order. Each subsection starts with a word on a line by itself.
The word charset starts the charset subsection. The charset line is followed by a sequence of lines. Each line gives information for one glyph. A line comprises a number of fields separated by blanks or tabs. The format is
name identifies the glyph: if name is a single glyph c then it corresponds to the groff input character c; if it is of the form \c where c is a single character, then it corresponds to the special character \[c]; otherwise it corresponds to the groff input character \[name]. If it is exactly two characters xx it can be entered as \(xx. Note that single-letter special characters can't be accessed as \c; the only exception is ‘\-’ which is identical to ‘\[-]’. The name --- is special and indicates that the glyph is unnamed; such glyphs can only be used by means of the \N escape sequence in troff.
The type field gives the glyph type:
The code field gives the code which the postprocessor uses to print the glyph. The glyph can also be input to groff using this code by means of the \N escape sequence. The code can be any integer. If it starts with a 0 it is interpreted as octal; if it starts with 0x or 0X it is interpreted as hexadecimal. Note, however, that the \N escape sequence only accepts a decimal integer.
The entity_name field gives an ASCII string identifying the glyph which the postprocessor uses to print that glyph. This field is optional and is currently used by grops to build sub-encoding arrays for PS fonts containing more than 256 glyphs. (It has also been used for grohtml's entity names but for efficiency reasons this data is now compiled directly into grohtml.)
Anything on the line after the encoding field or ‘--’ are ignored.
The metrics field has the form (in one line; it is broken here for the sake of readability):
There must not be any spaces between these subfields. Missing subfields are assumed to be 0. The subfields are all decimal integers. Since there is no associated binary format, these values are not required to fit into a variable of type char as they are in ditroff. The width subfields gives the width of the glyph. The height subfield gives the height of the glyph (upwards is positive); if a glyph does not extend above the baseline, it should be given a zero height, rather than a negative height. The depth subfield gives the depth of the glyph, that is, the distance below the baseline to which the glyph extends (downwards is positive); if a glyph does not extend below the baseline, it should be given a zero depth, rather than a negative depth. The italic-correction subfield gives the amount of space that should be added after the glyph when it is immediately to be followed by a glyph from a roman font. The left-italic-correction subfield gives the amount of space that should be added before the glyph when it is immediately to be preceded by a glyph from a roman font. The subscript-correction gives the amount of space that should be added after a glyph before adding a subscript. This should be less than the italic correction.
A line in the charset section can also have the format
This indicates that name is just another name for the glyph mentioned in the preceding line.
The word kernpairs starts the kernpairs section. This contains a sequence of lines of the form:
This means that when glyph c1 appears next to glyph c2 the space between them should be increased by n. Most entries in kernpairs section have a negative value for n.
groff_out(5), troff(1), addftinfo(1), afmtodit(1)
A man page name(n) of section n can be viewed either with
7 March 2023 | groff 1.22.4 |