Font Families
-------------
Due to the variety of fonts available, `gtroff' has added the
concept of "font families" and "font styles". The fonts are specified
as the concatenation of the font family and style. Specifying a font
without the family part causes `gtroff' to use that style of the
current family.
Currently, only POSTSCRIPT fonts are set up to this mechanism. By
default, `gtroff' uses the Times family with the four styles `R', `I',
`B', and `BI'.
This way, it is possible to use the basic four fonts and to select a
different font family on the command line (Note:Groff Options).
- Request: .fam [family]
- Register: \n[.fam]
Switch font family to FAMILY. If no argument is given, switch
back to the previous font family. The current font family is
available in the read-only number register `.fam' (this is a
string-valued register); it is associated with the current
environment.
spam,
.fam H \" helvetica family
spam, \" used font is family H + style R = HR
.ft B \" family H + style B = font HB
spam,
.fam T \" times family
spam, \" used font is family T + style B = TB
.ft AR \" font AR (not a style)
baked beans,
.ft R \" family T + style R = font TR
and spam.
- Request: .sty n style
Associate STYLE with font position N. A font position can be
associated either with a font or with a style. The current font
is the index of a font position and so is also either a font or a
style. When it is a style, the font that is actually used is the
font the name of which is the concatenation of the name of the
current family and the name of the current style. For example, if
the current font is 1 and font position 1 is associated with
style `R' and the current font family is `T', then font `TR' will
be used. If the current font is not a style, then the current
family is ignored. When the requests `cs', `bd', `tkf', `uf', or
`fspecial' are applied to a style, then they will instead be
applied to the member of the current family corresponding to that
style.
N must be a non-negative integer value.
The default family can be set with the `-f' option (Note:Groff
Options). The `styles' command in the `DESC' file controls
which font positions (if any) are initially associated with styles
rather than fonts. For example, the default setting for
POSTSCRIPT fonts
styles R I B BI
is equivalent to
.sty 1 R
.sty 2 I
.sty 3 B
.sty 4 BI
`.fam' always checks whether the current font position is valid;
this can give surprising results if the current font position is
associated with a style.
In the following example, we want to access the POSTSCRIPT font
`FooBar' from the font family `Foo':
.sty \n[.fp] Bar
.fam Foo
=> warning: can't find font `FooR'
The default font position at start-up is 1; for the POSTSCRIPT
device, this is associated with style `R', so `gtroff' tries to
open `FooR'.
A solution to this problem is to use a dummy font like the
following:
.fp 0 dummy TR \" set up dummy font at position 0
.sty \n[.fp] Bar \" register style `Bar'
.ft 0 \" switch to font at position 0
.fam Foo \" activate family `Foo'
.ft Bar \" switch to font `FooBar'
Note:Font Positions.