5.19.1 Changing Fonts

Request: .ft [font]
Escape sequence: \ff
Escape sequence: \f(fn
Escape sequence: \f[font]
Register: \n[.sty]

The ft request and the \f escape change the current font to font (one-character name f, two-character name fn).

If font is a style name (as set with the sty request or with the styles command in the DESC file), use it within the current font family (as set with the fam request, the \F escape, or the family command in the DESC file).

It is not possible to switch to a font with the name ‘DESC’ (whereas this name could be used as a style name; however, this is not recommended).

With no argument or using ‘P’ as an argument, ft switches to the previous font. Use \f[] to do this with an escape sequence. The old syntax forms \fP or \f[P] are also supported.

Fonts are generally specified as uppercase strings, which are usually 1 to 4 characters representing an abbreviation or acronym of the font name. This is no limitation, just a convention.

The example below produces two identical lines.

eggs, bacon,
.ft B
spam
.ft
and sausage.

eggs, bacon, \fBspam\fP and sausage.

\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 on the fly:

.mc \f[I]x\f[]

The current style name is available in the read-only string-valued register ‘.sty’; it is associated with the environment (see Environments). If the current font isn’t a style, interpolating ‘.sty’ produces nothing.

See Font Positions, for an alternative syntax.

Request: .ftr f [g]

Translate font f to font g. Whenever a font named f is referred to in a \f escape sequence, in the F and S conditional operators, or in the ft, ul, bd, cs, tkf, special, fspecial, fp, or sty requests, font g is used. If g is missing or equal to f the translation is undone.

Font translations cannot be chained.

.ftr XXX TR
.ftr XXX YYY
.ft XXX
    error→ warning: can't find font 'XXX'
Request: .fzoom f [zoom]
Register: \n[.zoom]

Set magnification of font f to factor zoom, which must be a non-negative integer multiple of 1/1000th. This request is useful to adjust the optical size of a font in relation to the others. In the example below, font CR is magnified by 10% (the zoom factor is thus 1.1).

.fam P
.fzoom CR 1100
.ps 12
Palatino and \f[CR]Courier\f[]

A missing or zero value of zoom is the same as a value of 1000, which means no magnification. f must be a real font name, not a style.

The magnification of a font is completely transparent to GNU troff; a change of the zoom factor doesn’t cause any effect except that the dimensions of glyphs, (word) spaces, kerns, etc., of the affected font are adjusted accordingly.

The zoom factor of the current font is available in the read-only register ‘.zoom’, in multiples of 1/1000th. It returns zero if there is no magnification.