[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Files Reference

troff Font File Format


Specifies description files for the troff command.


For each phototypesetter that the troff command supports and that is available on your system, there is a directory that contains files describing the phototypesetter and its fonts. This directory is named /usr/lib/font/devName, where the Name variable specifies the name of the phototypesetter.

The ASCII DESC file in the /usr/lib/font/devName directory within the troff command source directory describes the characteristics of the phototypesetter specified by the Name variable. A binary version of this file is found in the /usr/lib/font/devName/DESC.out file. Each line of this ASCII file starts with a word that identifies a characteristic, followed by appropriate specifiers. Blank lines and lines beginning with the # (pound sign) are ignored.

For many typesetters, downloaded fonts are supported in a general fashion. The bitmaps for these fonts are stored in the /usr/lib/font/devName/bitmaps directory. Each font size pair is stored in a file with a name of the form Fontname-Size.pk. For example:


These bitmaps are stored in the PK packed-font format used by TeX and its post-processors. These bitmaps are easily generated form readily available programs, such as METAFONT, or easily converted from other forms.

In addition to the bitmap files, a troff font file, as described here, is required for each font typeface. In the unitwidth field of this file, the width of each character bitmap in device units is given.

The legal lines for the DESC file are:

res Number Resolution of device in basic increments per inch.
unitwidth Number Point size in which all width tables in the font description files are given. The troff command automatically scales the widths from the unitwidth size to the point size with which it is working.
sizescale Number Scaling for fractional point sizes. The value of the Number variable is 1. The sizescale line is not currently used.
paperwidth Number Width of paper in basic increments.
paperlength Number Length of paper in basic increments.
biggestfont Number Maximum number of characters in a font.
sizes Number1 Number2... List of point sizes available on typesetter, ended by 0.
fonts NumberName... Number of initial fonts, followed by the ASCII names of the fonts. For example:

fonts 4 R I B S
codeset codesetName Code set for the particular printer or typesetter, where CodesetName is a valid code set name for use with the iconv command. The specified code set is used to define character entries in the charset section of font description files. For example:

codeset ISO8859-1

The troff command uses the specified CodesetName and the code set implied by the current locale to determine if code set conversions are necessary for the input characters. The iconv function is used to perform the code set conversion if necessary.

charset Last keyword in the file is on a line by itself. Following it is the list of special character names for this device. Names are separated by a space or a new line. The list can be as long as necessary. Names not in this list are not allowed in the font description files.
hor Number Smallest unit of horizontal motion.
vert Number Smallest unit of vertical motion.

The hor and vert lines describe the relationships between motions in the horizontal and vertical directions. For example, if the device moves in single basic increments in both directions, both the hor and vert lines have values of 1. If vertical motion occurs only in multiples of two basic units and horizontal motion occurs only in one basic unit, vert is 2 and hor is 1.

For each font supported by the phototypesetter, there is also an ASCII file with the same name as the font (for instance, R, I, CW) that describes it. The format for a font description file is as follows:

name Name Name of the font, such as R or CW.
internalname Name Internal name of the font.
special Sets the flag indicating that the font is special.
ligatures Name...0 Sets the flag indicating that the font has ligatures. The list of ligatures follows and is ended by a 0 (zero). Accepted ligatures are ff fi fl ffi ffl.
spacewidth Number Specifies width of space if something other than the default (1/3 of an em space) is desired.
charset The character set must come at the end. Each line following the charset word describes one character in the font. Each line has one of two formats:

Name Width Kerning Code


Name "

where the value of the Name field is either a single-byte character or a special character name from the list found in the DESC file. The Width field is in basic increments. The Kerning field is 1 if the character descends below the line, 2 if it rises above the letter `a', and 3 if it both rises and descends. The Code field is the number sent to the typesetter to produce the character. For an nls font, the Code field can be a multi-byte sequence.

For fonts of extended-character output devices, the Code field can be a multi-byte sequence that begins and ends with a double quotation mark. In the sequence, control or nonprinting characters can be represented by the following escape sequences:

\n Produces a new line.
\r Produces a return.
\t Produces a tab.
\b Produces a backspace.
\" Produces a double quote.
\xdd Produces a hexadecimal number, where dd is two hexadecimal digits.
\ooo Produces an octal number, where ooo is three octal digits.

The second format, Name ", is used to show that the character has more than one name. The double quotation marks indicate that this name has the same values as the preceding line. The Kerning and Code fields are not used if the value of the Width field is a double quotation mark. The total number of different characters in this list should not be greater than the value of the biggestfont line in the DESC file.

The DESC.out and Font.out files were created as a result of executing the makedev program on the DESC file.

Prototype characters are provided for the charset section of the font table for fonts in large-character sets. Most characters in large-character sets, such as the Japanese, Chinese, and Korean character sets, have the same width. These prototype characters specify the width of characters with varying byte lengths. The kerning and code fields are not available for prototype character entries. These entries apply to all characters not explicitly defined in the charset section. It is assumed that the printer or typesetter code for characters handled through prototype characters is the same as the input code for the character after conversion by the iconv function. The following are the prototype character definitions:

X0 Width Width of all characters that return a value of 0 for csid().
X1 Width Width of all 1-byte characters not defined elsewhere.
X1 Width Width of all characters that return a value of 1 for csid().
X2 Width Width of all 2-byte characters not defined elsewhere.
Xi Width Width of all characters that return a value of i for csid().
X3 Width Width of all 3-byte characters not defined elsewhere.
X4 Width Width of all 4-byte characters not defined elsewhere.

For example, the following prototype character definitions apply to the Japanese character sets (both IBM-932 and IBM-eucJP):

X0   : alphanumeric characters
X1   : JIS level 1 and 2 Kanji characters in JISX0208.1990
X2   : Katakana characters
X3   : IBM selected characters


/usr/lib/font/devName/DESC.out file Contains the description file for phototypesetter specified by the Name variable.
/usr/lib/font/devName/bitmaps directory Contains bitmap files.
/usr/lib/font/devName/Font.out file Contains the font description file for phototypesetter specified by the Name variable.

Related Information

The troff file format.

The troff command.

The iconv subroutine.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]