Next: , Previous: , Up: Using Fonts   [Contents][Index]

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 (recall Groff Options).

Fonts for the devices ps, pdf, dvi, lj4, lbp, and the X11 devices support this mechanism. By default, GNU troff uses the Times family with the four styles ‘R’, ‘I’, ‘B’, and ‘BI’.

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 none, is it falls back to the device’s default76 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
.ft CR    \" Courier roman (default family not changed)
.ft       \" back to Helvetica bold
.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 doesn’t produce an input token in GNU troff. As a consequence, it can be used in requests like mc (which expects a single character as an argument) to change the font family on the fly.

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

Associate an abstract style style with mounting position n, 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 current family corresponding to that style.

The default family can be set with the -f option (see Groff 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]
    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.

Next: , Previous: , Up: Using Fonts   [Contents][Index]