5.19.2 Font Families

To accommodate the wide variety of fonts available, GNU troff distinguishes font families and font styles. A resolved font name is the catenation of a font family and a style. Selecting an abstract style causes GNU troff to combine it with the default font family.

You can thus compose a document using abstract styles exclusively for its body or running text—selecting a specific family only for titles or examples, for instance—and change the default family on the command line.

Request: .fam [family]
Register: \n[.fam]
Escape sequence: \Ff
Escape sequence: \F(fm
Escape sequence: \F[family]

Set the default font family, used in combination with abstract styles to construct a resolved font name, to family (one-character name f, two-character name fm). If no argument is given, GNU troff selects the previous font family; if there are none, it falls back to the device’s default91 or its own (‘T’).

The \F escape sequence works similarly. In disanalogy to \f, ‘\FP’ makes ‘P’ the default family. Use ‘\F[]’ to select the previous default family. The default font family is available in the read-only string-valued register .fam; it is associated with the environment (see Environments).

spam,     \" startup defaults are T (Times) R (roman)
.fam H    \" make Helvetica the default family
spam,     \" family H + style R = HR
.ft B     \" family H + style B = HB
spam,
.ft CR    \" Courier roman (default family not changed)
spam,
.ft       \" back to Helvetica bold
spam,
.fam T    \" make Times the default family
spam,     \" family T + style B = TB
.ft AR    \" font AR (not a style)
baked beans,
.ft R     \" family T + style R = TR
and spam.

\F is not tokenized when GNU troff reads its input; it instead updates the environment. It thus can be used in requests that expect a single-character argument. We can thus alter the font family when writing a margin character as follows (see Miscellaneous).

.mc \F[P]x\F[]
Request: .sty pos style
Register: \n[.sty]

Associate an abstract style style with mounting position pos, which must be a non-negative integer. If the requests cs, bd, tkf, uf, or fspecial are applied to an abstract style, they are instead applied to the member of the default family corresponding to that style.

The default family can be set with the -f option (see Options). The styles command in the DESC file controls which font positions (if any) are initially associated with abstract styles rather than fonts.

Caution: The style argument is not validated. Errors may occur later, when the formatter attempts to construct a resolved font name, or format a character for output.

.nr BarPos \n[.fp]
.sty \n[.fp] Bar
.fam Foo
.ft \n[BarPos]
.tm .f=\n[.f]
A
    error→ error: no font family named 'Foo' exists
    error→ .f=41
    error→ error: cannot format glyph: no current font

When an abstract style has been selected, the read-only string-valued register ‘.sty’ interpolates its name; this datum is associated with the environment (see Environments). Otherwise, ‘.sty’ interpolates nothing.