summaryrefslogtreecommitdiffstats
path: root/doc/groff.html.node/Page-Geometry.html
blob: 14865332065c84f552ddf040d3a2d073b132a6a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<!DOCTYPE html>
<html>
<!-- Created by GNU Texinfo 7.0.3, https://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- This manual documents GNU troff version 1.23.0.

Copyright � 1994-2023 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
copy of the license is included in the section entitled "GNU Free
Documentation License". -->
<title>Page Geometry (The GNU Troff Manual)</title>

<meta name="description" content="Page Geometry (The GNU Troff Manual)">
<meta name="keywords" content="Page Geometry (The GNU Troff Manual)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta name="viewport" content="width=device-width,initial-scale=1">

<link href="index.html" rel="start" title="Top">
<link href="Request-Index.html" rel="index" title="Request Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="GNU-troff-Reference.html" rel="up" title="GNU troff Reference">
<link href="Measurements.html" rel="next" title="Measurements">
<link href="Text.html" rel="prev" title="Text">


</head>

<body lang="en">
<div class="section-level-extent" id="Page-Geometry">
<div class="nav-panel">
<p>
Next: <a href="Measurements.html" accesskey="n" rel="next">Measurements</a>, Previous: <a href="Text.html" accesskey="p" rel="prev">Text</a>, Up: <a href="GNU-troff-Reference.html" accesskey="u" rel="up">GNU <code class="code">troff</code> Reference</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Request-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<h3 class="section" id="Page-Geometry-1">5.2 Page Geometry</h3>
<a class="index-entry-id" id="index-page_002c-geometry-of"></a>
<a class="index-entry-id" id="index-geometry_002c-page"></a>

<p><code class="code">roff</code> 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 <a class="pxref" href="Line-Layout.html">Line Layout</a>).  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 <a class="pxref" href="Page-Layout.html">Page Layout</a>).
</p>
<a class="index-entry-id" id="index-device-resolution"></a>
<a class="index-entry-id" id="index-resolution_002c-device"></a>
<a class="index-entry-id" id="index-basic-units"></a>
<a class="index-entry-id" id="index-units_002c-basic"></a>
<a class="index-entry-id" id="index-machine-units"></a>
<a class="index-entry-id" id="index-units_002c-machine"></a>
<p>A device&rsquo;s <em class="dfn">resolution</em> converts practical units like inches or
centimeters to <em class="dfn">basic units</em>, 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 <a class="pxref" href="DESC-File-Format.html"><samp class="file">DESC</samp> File Format</a>).
</p>
<a class="index-entry-id" id="index-page"></a>
<p>A <em class="dfn">page</em> is a two-dimensional structure upon which a <code class="code">roff</code>
system imposes a rectangular coordinate system with its upper left
corner as the origin.  Coordinate values are in basic units and increase
down and to the right.  Useful ones are therefore always positive and
within numeric ranges corresponding to the page boundaries.
</p>
<a class="index-entry-id" id="index-drawing-position"></a>
<a class="index-entry-id" id="index-position_002c-drawing"></a>
<p>While the formatter (and, later, output driver) is processing a page, it
keeps track of its <em class="dfn">drawing position</em>, 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.
<a class="index-entry-id" id="index-text-baseline"></a>
<a class="index-entry-id" id="index-baseline_002c-text"></a>
Notionally, glyphs are drawn from the text baseline upward and to the
right.<a class="footnote" id="DOCF33" href="groff.html_fot.html#FOOT33"><sup>33</sup></a>  The <em class="dfn">text baseline</em> is a (usually invisible) line upon
which the glyphs of a typeface are aligned.  A glyph therefore
&ldquo;starts&rdquo; at its bottom-left corner.  If drawn at the origin, a typical
letter glyph would lie partially or wholly off the page, depending on
whether, like &ldquo;g&rdquo;, it features a descender below the baseline.
</p>
<a class="index-entry-id" id="index-page-offset"></a>
<a class="index-entry-id" id="index-offset_002c-page"></a>
<p>Such a situation is nearly always undesirable.  It is furthermore
conventional not to write or draw at the extreme edges of the page.
Therefore the initial drawing position of a <code class="code">roff</code> formatter is not
at the origin, but below and to the right of it.  This rightward shift
from the left edge is known as the <em class="dfn">page
offset</em>.<a class="footnote" id="DOCF34" href="groff.html_fot.html#FOOT34"><sup>34</sup></a>  The downward shift leaves room for a text output
line.
</p>
<p>Text is arranged on a one-dimensional lattice of text baselines from the
top to the bottom of the page.
<a class="index-entry-id" id="index-vertical-spacing"></a>
<a class="index-entry-id" id="index-spacing_002c-vertical"></a>
<a class="index-entry-id" id="index-vee"></a>
<em class="dfn">Vertical spacing</em> is the distance between adjacent text baselines.
Typographic tradition sets this quantity to 120% of the type size.  The
initial drawing position is one unit of vertical spacing below the page
top.  Typographers term this unit a <i class="slanted">vee</i>.
</p>
<a class="index-entry-id" id="index-page-break"></a>
<a class="index-entry-id" id="index-break_002c-page"></a>
<a class="index-entry-id" id="index-page-ejection"></a>
<a class="index-entry-id" id="index-ejection_002c-page"></a>
<p>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,
<code class="code">roff</code> 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 <em class="dfn">page break</em>.
</p>
<p>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 &ldquo;traps&rdquo;
(see <a class="pxref" href="Traps.html">Traps</a>); moreover, all but the simplest page layouts tend to
have headers and footers, or at least bear vertical margins larger than
one vee.
</p>


</div>
<hr>
<div class="nav-panel">
<p>
Next: <a href="Measurements.html">Measurements</a>, Previous: <a href="Text.html">Text</a>, Up: <a href="GNU-troff-Reference.html">GNU <code class="code">troff</code> Reference</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Request-Index.html" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>