File: Using-Fractional-Type-Sizes.html

package info (click to toggle)
groff 1.23.0-10
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 34,108 kB
  • sloc: cpp: 74,810; ansic: 27,845; sh: 12,201; perl: 7,709; cs: 3,688; makefile: 906; awk: 91; sed: 80
file content (172 lines) | stat: -rw-r--r-- 11,144 bytes parent folder | download | duplicates (2)
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<!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>Using Fractional Type Sizes (The GNU Troff Manual)</title>

<meta name="description" content="Using Fractional Type Sizes (The GNU Troff Manual)">
<meta name="keywords" content="Using Fractional Type Sizes (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="Manipulating-Type-Size-and-Vertical-Spacing.html" rel="up" title="Manipulating Type Size and Vertical Spacing">
<link href="Changing-the-Type-Size.html" rel="prev" title="Changing the Type Size">
<style type="text/css">
<!--
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
span:hover a.copiable-link {visibility: visible}
strong.def-name {font-family: monospace; font-weight: bold; font-size: larger}
-->
</style>


</head>

<body lang="en">
<div class="subsection-level-extent" id="Using-Fractional-Type-Sizes">
<div class="nav-panel">
<p>
Previous: <a href="Changing-the-Type-Size.html" accesskey="p" rel="prev">Changing the Type Size</a>, Up: <a href="Manipulating-Type-Size-and-Vertical-Spacing.html" accesskey="u" rel="up">Manipulating Type Size and Vertical Spacing</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>
<h4 class="subsection" id="Using-Fractional-Type-Sizes-1">5.20.3 Using Fractional Type Sizes</h4>
<a class="index-entry-id" id="index-fractional-type-sizes"></a>
<a class="index-entry-id" id="index-fractional-point-sizes"></a>
<a class="index-entry-id" id="index-type-sizes_002c-fractional"></a>
<a class="index-entry-id" id="index-point-sizes_002c-fractional"></a>
<a class="index-entry-id" id="index-sizes_002c-fractional-type"></a>

<p>AT&amp;T <code class="code">troff</code> 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
<code class="code">troff</code>, an output device can select a scaling factor that
subdivides a point into &ldquo;scaled points&rdquo;.  A type size expressed in
scaled points can thus represent a non-integral type size.
</p>
<a class="index-entry-id" id="index-s-scaling-unit"></a>
<a class="index-entry-id" id="index-unit_002c-scaling_002c-s"></a>
<a class="index-entry-id" id="index-scaling-unit-s"></a>
<a class="index-entry-id" id="index-z-scaling-unit"></a>
<a class="index-entry-id" id="index-unit_002c-scaling_002c-z"></a>
<a class="index-entry-id" id="index-scaling-unit-z"></a>
<a class="index-entry-id" id="index-ps-request_002c-with-fractional-type-sizes"></a>
<a class="index-entry-id" id="index-cs-request_002c-with-fractional-type-sizes"></a>
<a class="index-entry-id" id="index-tkf-request_002c-with-fractional-type-sizes"></a>
<a class="index-entry-id" id="index-_005cH_002c-with-fractional-type-sizes"></a>
<a class="index-entry-id" id="index-_005cs_002c-with-fractional-type-sizes"></a>
<p>A <em class="dfn">scaled point</em> is equal to <em class="math">1/<var class="var">sizescale</var></em> points, where
<var class="var">sizescale</var> is specified in the device description file <samp class="file">DESC</samp>,
and defaults to&nbsp;1.<a class="footnote" id="DOCF85" href="groff.html_fot.html#FOOT85"><sup>85</sup></a>  Requests and escape sequences in GNU <code class="code">troff</code> interpret
arguments that represent a type size in scaled points, which the
formatter multiplies by <var class="var">sizescale</var> and converts to an integer.
Arguments treated in this way comprise those to the escape sequences
<code class="code">\H</code> and <code class="code">\s</code>, to the request <code class="code">ps</code>, the third argument to
the <code class="code">cs</code> request, and the second and fourth arguments to the
<code class="code">tkf</code> request.  Scaled points may be specified explicitly with the
<code class="code">z</code> scaling unit.
</p>
<p>For example, if <var class="var">sizescale</var> is&nbsp;1000, then a scaled point is one
thousandth of a point.  The request &lsquo;<samp class="samp">.ps 10.5</samp>&rsquo; is synonymous with
&lsquo;<samp class="samp">.ps 10.5z</samp>&rsquo; and sets the type size to 10,500&nbsp;scaled points, or
10.5&nbsp;points.  Consequently, in GNU <code class="code">troff</code>, the register
<code class="code">.s</code> can interpolate a non-integral type size.
</p>
<dl class="first-deffn">
<dt class="deffn" id="index-_005cn_005b_002eps_005d"><span class="category-def">Register: </span><span><strong class="def-name"><code class="t">\n[.ps]</code></strong><a class="copiable-link" href='#index-_005cn_005b_002eps_005d'> &para;</a></span></dt>
<dd><a class="index-entry-id" id="index-_002eps-3"></a>
<p>This read-only register interpolates the type size in scaled points; it
is associated with the environment (see <a class="pxref" href="Environments.html">Environments</a>).
</p></dd></dl>

<p>It makes no sense to use the &lsquo;<samp class="samp">z</samp>&rsquo; scaling unit in a numeric
expression whose default scaling unit is neither &lsquo;<samp class="samp">u</samp>&rsquo; nor &lsquo;<samp class="samp">z</samp>&rsquo;,
so GNU <code class="code">troff</code> disallows this.  Similarly, it is nonsensical to use
a scaling unit other than &lsquo;<samp class="samp">z</samp>&rsquo; or &lsquo;<samp class="samp">u</samp>&rsquo; in a numeric expression
whose default scaling unit is &lsquo;<samp class="samp">z</samp>&rsquo;, and so GNU <code class="code">troff</code>
disallows this as well.
</p>
<p>Another GNU <code class="code">troff</code> scaling unit, &lsquo;<samp class="samp">s</samp>&rsquo;, multiplies by the
number of basic units in a scaled point.  Thus, &lsquo;<samp class="samp">\n[.ps]s</samp>&rsquo; is equal
to &lsquo;<samp class="samp">1m</samp>&rsquo; by definition.  Do not confuse the &lsquo;<samp class="samp">s</samp>&rsquo; and &lsquo;<samp class="samp">z</samp>&rsquo;
scaling units.
</p>
<dl class="first-deffn">
<dt class="deffn" id="index-_005cn_005b_002epsr_005d"><span class="category-def">Register: </span><span><strong class="def-name"><code class="t">\n[.psr]</code></strong><a class="copiable-link" href='#index-_005cn_005b_002epsr_005d'> &para;</a></span></dt>
<dd><a class="index-entry-id" id="index-_002epsr"></a>
</dd><dt class="deffnx def-cmd-deffn" id="index-_005cn_005b_002esr_005d"><span class="category-def">Register: </span><span><strong class="def-name"><code class="t">\n[.sr]</code></strong><a class="copiable-link" href='#index-_005cn_005b_002esr_005d'> &para;</a></span></dt>
<dd><a class="index-entry-id" id="index-_002esr"></a>
<a class="index-entry-id" id="index-last_002drequested-type-size-registers-_0028_002epsr_002c-_002esr_0029"></a>
<a class="index-entry-id" id="index-type-size-registers_002c-last_002drequested-_0028_002epsr_002c-_002esr_0029"></a>
<a class="index-entry-id" id="index-last_002drequested-point-size-registers-_0028_002epsr_002c-_002esr_0029"></a>
<a class="index-entry-id" id="index-point-size-registers_002c-last_002drequested-_0028_002epsr_002c-_002esr_0029"></a>
<a class="index-entry-id" id="index-_002eps-register_002c-in-comparison-with-_002epsr"></a>
<a class="index-entry-id" id="index-_002es-register_002c-in-comparison-with-_002esr"></a>
<p>Output devices may be limited in the type sizes they can employ.  The
<code class="code">.s</code> and <code class="code">.ps</code> registers represent the type size selected by
the output driver as it understands a device&rsquo;s capability.  The last
<em class="emph">requested</em> type size is interpolated in scaled points by the
read-only register <code class="code">.psr</code> and in points as a decimal fraction by
the read-only string-valued register <code class="code">.sr</code>.  Both are associated
with the environment (see <a class="pxref" href="Environments.html">Environments</a>).
</p>
<p>For example, if a type size of 10.95 points is requested, and the
nearest size permitted by a <code class="code">sizes</code> request (or by the <code class="code">sizes</code>
or <code class="code">sizescale</code> directives in the device&rsquo;s <samp class="file">DESC</samp> file) is 11
points, the output driver uses the latter value.
</p></dd></dl>

<p>The <code class="code">\s</code> 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 <a class="ref" href="Delimiters.html">Delimiters</a>.
</p>
<dl class="table">
<dt><code class="code">\s[<var class="var">n</var>]</code></dt>
<dt><code class="code">\s'<var class="var">n</var>'</code></dt>
<dd><p>Set the type size to <var class="var">n</var>&nbsp;scaled points; <var class="var">n</var>&nbsp;is a
numeric expression with a default scaling unit of &lsquo;<samp class="samp">z</samp>&rsquo;.
</p>
</dd>
<dt><code class="code">\s[+<var class="var">n</var>]</code></dt>
<dt><code class="code">\s[-<var class="var">n</var>]</code></dt>
<dt><code class="code">\s+[<var class="var">n</var>]</code></dt>
<dt><code class="code">\s-[<var class="var">n</var>]</code></dt>
<dt><code class="code">\s'+<var class="var">n</var>'</code></dt>
<dt><code class="code">\s'-<var class="var">n</var>'</code></dt>
<dt><code class="code">\s+'<var class="var">n</var>'</code></dt>
<dt><code class="code">\s-'<var class="var">n</var>'</code></dt>
<dd><p>Increase or decrease the type size by <var class="var">n</var>&nbsp;scaled points;
<var class="var">n</var>&nbsp;is a numeric expression (which may start with a minus sign)
with a default scaling unit of &lsquo;<samp class="samp">z</samp>&rsquo;.
</p></dd>
</dl>



</div>
<hr>
<div class="nav-panel">
<p>
Previous: <a href="Changing-the-Type-Size.html">Changing the Type Size</a>, Up: <a href="Manipulating-Type-Size-and-Vertical-Spacing.html">Manipulating Type Size and Vertical Spacing</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>