Section: File Formats (5)
Updated: 10 February 2018
Return to Main Contents
groff_font - format of groff device and font description files
The groff font format is roughly a superset of the ditroff
The font files for device
are stored in a directory
There are two types of file: a device description file called
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.
DESC file 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.
This line and everything following in the file are ignored.
It is allowed for the sake of backwards compatibility.
- family fam
The default font family is
- fonts n F1 F2 F3 ... Fn
F1, ..., Fn
are mounted in the font positions
m+1, ..., m+n
is the number of styles.
This command may extend over more than one line.
A font name of~0
causes no font to be mounted on the corresponding font position.
- hor n
The horizontal resolution is
- image_generator string
It specifies the program to generate PNG images from
Under GNU/Linux this is usually
but under other systems (notably cygwin) it might be set to another name.
- paperlength n
The physical vertical dimension of the output medium in machine units.
This isn't used by
itself but by output devices.
- papersize string
Select a paper size.
Valid values for
are the ISO paper types A0-A7, B0-B7, C0-C7, D0-D7,
DL, and the US paper
types letter, legal, tabloid, ledger, statement, executive, com10, and
Case is not significant for
if it holds predefined paper types.
can be a file name (e.g. '/etc/papersize'); if the file can
reads the first line and tests for the above paper sizes.
can be a custom paper size in the format
(no spaces before and after the comma).
must have a unit appended; valid values are 'i' for inches,
'c' for centimeters, 'p' for points, and 'P'
An argument which starts with a digit is always treated as a custom paper
sets both the vertical and horizontal dimension of the output medium.
More than one argument can be specified;
scans from left to right and uses the first valid paper specification.
- paperwidth n
The physical horizontal dimension of the output medium in machine units.
This isn't used by
itself but by output devices.
Make troff tell the driver the source file name being processed.
This is achieved by another tcommand:
- postpro program
as the postprocessor.
- prepro program
as a preprocessor.
- print program
as the spooler program for printing.
If omitted, the
- res n
machine units per inch.
- sizes s1 s2 ... sn 0
This means that the device has fonts at
s2, ..., sn
The list of sizes must be terminated by a
can also be a range of sizes
The list can extend over more than one line.
- sizescale n
The scale factor for point sizes.
By default this has a value of 1.
is equal to
The arguments to the
commands are given in scaled points.
- styles S1 S2 ... Sm
font positions are associated with styles
S1, ..., Sm.
This means that the postprocessor can handle the
Indicate that the output device supports the complete Unicode
Useful only for devices which produce
instead of glyphs.
is present, no
section is required in the font description files since the Unicode
handling built into
However, if there are entries in a
section, they either override the default mappings for those
particular characters or add new mappings (normally for composite
This is used for
- unitwidth n
Quantities in the font files are given in machine units
for fonts whose point size is
Make the font handling module always return unscaled glyph widths.
Needed for the
This command indicates that troff should encode named glyphs inside
- vert n
The vertical resolution is
lines are compulsory.
Not all commands in the DESC file are used by
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
but completely ignored:
Font file format
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.
- ligatures lig1 lig2 ... lign 
lig2, ..., lign
are ligatures; possible ligatures are
For backwards compatibility, the list of ligatures may be terminated
The list of ligatures may not extend over more than one line.
- name F
The name of the font is~F.
- slant n
The glyphs of the font have a slant of
(Positive means forward.)
- spacewidth n
The normal width of a space is~n.
The font is
this means that when a glyph is requested that is not present in
the current font, it is searched for in any special fonts that are
Other commands are ignored by
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
and it may also contain a
These subsections can appear in any order.
Each subsection starts with a word on a line by itself.
starts the charset subsection.
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 metrics type code
identifies the glyph:
is a single glyph
then it corresponds to the groff input character
if it is of the form
where c is a single character, then it
corresponds to the special character
otherwise it corresponds to the groff input character
If it is exactly two characters
it can be entered as
Note that single-letter special characters can't be accessed as
the only exception is '\-' which is identical to
is special and indicates that the glyph is unnamed;
such glyphs can only be used by means of the
escape sequence in
field gives the glyph type:
means the glyph has a descender, for example, 'p';
means the glyph has an ascender, for example, 'b';
means the glyph has both an ascender and a descender, for example,
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
The code can be any integer.
If it starts with a~0
it is interpreted as octal;
if it starts with
it is interpreted as hexadecimal.
Note, however, that the
escape sequence only accepts a decimal integer.
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
to build sub-encoding arrays for PS fonts containing more than 256
(It has also been used for
entity names but for efficiency reasons this data is now compiled
Anything on the line after the encoding field or '--' are
field has the form (in one line; it is broken here for the sake of
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
as they are in ditroff.
subfields gives the width of the glyph.
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.
subfield gives the depth of the glyph, that is, the distance
below the lowest point below the baseline to which the
glyph extends (downwards is positive);
if a glyph does not extend below above the baseline, it should be
given a zero depth, rather than a negative depth.
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.
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.
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
is just another name for the glyph mentioned in the
starts the kernpairs section.
This contains a sequence of lines of the form:
c1 c2 n
This means that when glyph
appears next to glyph
the space between them should be increased by~n.
Most entries in kernpairs section have a negative value for~n.
Device description file for device
Font file for font~F
can be viewed either with
for text mode or
man n name
for graphical mode (default is PDF mode).
Copyright © 1989-2014 Free Software Foundation, Inc.
This file is part of groff (GNU roff), which is a free software project.
You can redistribute it and/or modify it under the terms of the GNU
General Public License as published by the Free Software Foundation,
either version 2 of the License, or (at your option) any later
You should have received a copy of the GNU General Public License
along with this program. If not, see
- DESC file format
- Font file format
- SEE ALSO
This document was created by
using the manual pages.
Time: 01:53:58 GMT, September 21, 2018