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.41 A glyph therefore “starts” at its bottom-left corner. The formatter’s origin is one vee below the page top to prevent 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 that defines the zero point from which the formatter reckons the line indentation and length.42
Combining the foregoing facts results in an origin that lies at the page offset in the horizontal dimension and at the text baseline (using the default vertical spacing) in the vertical dimension. A document can change these prior to its first written or drawn output; see Line Layout and Manipulating Type Size and Vertical Spacing.
Vertical spacing has an impact on page-breaking decisions.
Generally,
when a break occurs,
the formatter automatically moves the drawing position
to the next text baseline.
If the formatter were already writing
to the last line that fits on the page,
advancing by one vee would place the next text baseline off the page.
To avoid that,
roff
formatters instruct the output driver to eject the page,
start a new one,
and again place the drawing position
at the page offset 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 also breaks 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]