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.

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). Without an argument, GNU troff selects the previous font family; if there is none, it falls back to the device’s default174 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; this datum is associated with the environment.175

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.

GNU troff does not tokenize \F when reading it; it thus can be used in requests that expect a single-character argument. We can assign a font family to a margin character as follows.176

.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. Applying the requests cs, bd, tkf, uf, or fspecial to an abstract style affects the member of the default family corresponding to that style.

GNU troff’s -f command-line option (recall Groff Options) and fam request set the default family. The styles directive in the output device’s DESC file controls which mounting positions (if any) initially associate with abstract styles rather than fonts, and the sty request updates this association.

Caution: GNU troff does not validate the style argument. 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.177 Otherwise, ‘.sty’ interpolates nothing.


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