Next: Measurements, Previous: Text, Up: GNU troff Reference [Contents][Index]
roff
systems format text under certain assumptions about the size
of the output medium, or page. For the formatter to correctly break a
line it is filling, it must know the line length, which it derives from
the page width (see Line Layout). For it to decide whether to write
an output line to the current page or wait until the next one, it must
know the page length (see Page Layout).
A device’s resolution converts practical units like inches or centimeters to basic units, a convenient length measure for the output device or file format. The formatter and output driver use basic units to reckon page measurements. The device description file defines its resolution and page dimensions (see DESC File Format).
A page is a two-dimensional structure upon which a roff
system imposes a rectangular coordinate system with its origin near the
upper left corner. Coordinate values are in basic units and increase
down and to the right. Useful ones are typically positive and within
numeric ranges corresponding to the page boundaries.
Text is arranged on a one-dimensional lattice of text baselines from the top to the bottom of the page. A text baseline is a (usually invisible) line upon which the glyphs of a typeface are aligned. Vertical spacing is the distance between adjacent text baselines. Typographic tradition sets this quantity to 120% of the type size. Typographers term this unit a vee.
While the formatter (and, later, output driver) is processing a page, it keeps track of its drawing position, which is the location at which the next glyph will be written, from which the next motion will be measured, or where a geometric object will commence rendering. Notionally, glyphs are drawn from the text baseline upward and to the right.40 A glyph therefore “starts” at its bottom-left corner. The formatter’s origin is thus one vee below the page top, preventing a glyph from lying partially or wholly off the page.
Further, it is conventional not to write or draw at the extreme edges of the page. Typesetters configure a page offset, a rightward shift from the left edge.41
Vertical spacing has an impact on page-breaking decisions. Generally,
when a break occurs, the formatter moves the drawing position to the
next text baseline automatically. If the formatter were already writing
to the last line that would fit on the page, advancing by one vee would
place the next text baseline off the page. Rather than let that happen,
roff
formatters instruct the output driver to eject the page,
start a new one, and again set the drawing position to one vee below the
page top; this is a page break.
When the last line of input text corresponds to the last output line that fits on the page, the break caused by the end of input will also break the page, producing a useless blank one. Macro packages keep users from having to confront this difficulty by setting “traps” (see Traps); moreover, all but the simplest page layouts tend to have headers and footers, or at least bear vertical margins of at least one vee.
Next: Measurements, Previous: Text, Up: GNU troff Reference [Contents][Index]