Previous: , Up: Manipulating Type Size and Vertical Spacing   [Contents][Index]


5.20.3 Using Fractional Type Sizes

AT&T troff interpreted all type size measurements in points. Combined with integer arithmetic, this design choice made it impossible to support, for instance, ten and a half-point type. In GNU troff, an output device can select a scaling factor that subdivides a point into “scaled points”. A type size expressed in scaled points can thus represent a non-integral type size.

A scaled point is equal to 1/sizescale points, where sizescale is specified in the device description file DESC, and defaults to 1.85 Requests and escape sequences in GNU troff interpret arguments that represent a type size in scaled points, which the formatter multiplies by sizescale and converts to an integer. Arguments treated in this way comprise those to the escape sequences \H and \s, to the request ps, the third argument to the cs request, and the second and fourth arguments to the tkf request. Scaled points may be specified explicitly with the z scaling unit.

For example, if sizescale is 1000, then a scaled point is one thousandth of a point. The request ‘.ps 10.5’ is synonymous with ‘.ps 10.5z’ and sets the type size to 10,500 scaled points, or 10.5 points. Consequently, in GNU troff, the register .s can interpolate a non-integral type size.

Register: \n[.ps]

This read-only register interpolates the type size in scaled points; it is associated with the environment (see Environments).

It makes no sense to use the ‘z’ scaling unit in a numeric expression whose default scaling unit is neither ‘u’ nor ‘z’, so GNU troff disallows this. Similarly, it is nonsensical to use a scaling unit other than ‘z’ or ‘u’ in a numeric expression whose default scaling unit is ‘z’, and so GNU troff disallows this as well.

Another GNU troff scaling unit, ‘s’, multiplies by the number of basic units in a scaled point. Thus, ‘\n[.ps]s’ is equal to ‘1m’ by definition. Do not confuse the ‘s’ and ‘z’ scaling units.

Register: \n[.psr]
Register: \n[.sr]

Output devices may be limited in the type sizes they can employ. The .s and .ps registers represent the type size selected by the output driver as it understands a device’s capability. The last requested type size is interpolated in scaled points by the read-only register .psr and in points as a decimal fraction by the read-only string-valued register .sr. Both are associated with the environment (see Environments).

For example, if a type size of 10.95 points is requested, and the nearest size permitted by a sizes request (or by the sizes or sizescale directives in the device’s DESC file) is 11 points, the output driver uses the latter value.

The \s escape sequence offers the following syntax forms that work with fractional type sizes and accept scaling units. You may of course give them integral arguments. The delimited forms need not use the neutral apostrophe; see Delimiters.

\s[n]
\s'n'

Set the type size to n scaled points; n is a numeric expression with a default scaling unit of ‘z’.

\s[+n]
\s[-n]
\s+[n]
\s-[n]
\s'+n'
\s'-n'
\s+'n'
\s-'n'

Increase or decrease the type size by n scaled points; n is a numeric expression (which may start with a minus sign) with a default scaling unit of ‘z’.


Previous: , Up: Manipulating Type Size and Vertical Spacing   [Contents][Index]