summaryrefslogtreecommitdiffstats
path: root/doc/groff.html.node/Selecting-Fonts.html
blob: d6a59e7172c36b15f3927b2575c1a788219d6f50 (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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
<!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>Selecting Fonts (The GNU Troff Manual)</title>

<meta name="description" content="Selecting Fonts (The GNU Troff Manual)">
<meta name="keywords" content="Selecting Fonts (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="Using-Fonts.html" rel="up" title="Using Fonts">
<link href="Font-Families.html" rel="next" title="Font Families">
<link href="Using-Fonts.html" rel="prev" title="Using Fonts">
<style type="text/css">
<!--
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
div.example {margin-left: 3.2em}
span.r {font-family: initial; font-weight: normal; font-style: normal}
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="Selecting-Fonts">
<div class="nav-panel">
<p>
Next: <a href="Font-Families.html" accesskey="n" rel="next">Font Families</a>, Previous: <a href="Using-Fonts.html" accesskey="p" rel="prev">Using Fonts</a>, Up: <a href="Using-Fonts.html" accesskey="u" rel="up">Using Fonts</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="Selecting-Fonts-1">5.19.1 Selecting Fonts</h4>
<a class="index-entry-id" id="index-font_002c-selection"></a>

<p>We use <em class="dfn">font</em> to refer to any of several means of identifying a
font: by mounting position (&lsquo;<samp class="samp">3</samp>&rsquo;), by abstract style (&lsquo;<samp class="samp">B</samp>&rsquo;), or
by its identifier (&lsquo;<samp class="samp">TB</samp>&rsquo;).
</p>
<dl class="first-deffn">
<dt class="deffn" id="index-_002eft"><span class="category-def">Request: </span><span><strong class="def-name"><code class="t">.ft</code></strong> <var class="def-var-arguments">[<span class="r"><i class="slanted">font</i></span>]</var><a class="copiable-link" href='#index-_002eft'> &para;</a></span></dt>
<dd><a class="index-entry-id" id="index-ft"></a>
</dd><dt class="deffnx def-cmd-deffn" id="index-_005cff"><span class="category-def">Escape&nbsp;sequence: </span><span><strong class="def-name"><code class="t">\f</code><span class="r"><i class="slanted">f</i></span><code class="t"></code></strong><a class="copiable-link" href='#index-_005cff'> &para;</a></span></dt>
<dd><a class="index-entry-id" id="index-_005cf"></a>
</dd><dt class="deffnx def-cmd-deffn" id="index-_005cf_0028fn"><span class="category-def">Escape&nbsp;sequence: </span><span><strong class="def-name"><code class="t">\f(</code><span class="r"><i class="slanted">fn</i></span><code class="t"></code></strong><a class="copiable-link" href='#index-_005cf_0028fn'> &para;</a></span></dt>
<dt class="deffnx def-cmd-deffn" id="index-_005cf_005bfont_005d"><span class="category-def">Escape&nbsp;sequence: </span><span><strong class="def-name"><code class="t">\f[</code><span class="r"><i class="slanted">font</i></span><code class="t">]</code></strong><a class="copiable-link" href='#index-_005cf_005bfont_005d'> &para;</a></span></dt>
<dt class="deffnx def-cmd-deffn" id="index-_005cn_005b_002efn_005d"><span class="category-def">Register: </span><span><strong class="def-name"><code class="t">\n[.fn]</code></strong><a class="copiable-link" href='#index-_005cn_005b_002efn_005d'> &para;</a></span></dt>
<dd><a class="index-entry-id" id="index-_002efn"></a>
<a class="index-entry-id" id="index-changing-fonts-_0028ft_002c-_005cf_0029"></a>
<a class="index-entry-id" id="index-fonts_002c-changing-_0028ft_002c-_005cf_0029"></a>
<a class="index-entry-id" id="index-sty-request_002c-and-changing-fonts"></a>
<a class="index-entry-id" id="index-fam-request_002c-and-changing-fonts"></a>
<a class="index-entry-id" id="index-_005cF_002c-and-changing-fonts"></a>
<a class="index-entry-id" id="index-styles"></a>
<a class="index-entry-id" id="index-family"></a>
<a class="index-entry-id" id="index-DESC"></a>
<a class="index-entry-id" id="index-selecting-the-previous-font-_0028ft_0029"></a>
<a class="index-entry-id" id="index-previous-font_002c-selecting-_0028ft_0029"></a>
<a class="index-entry-id" id="index-font_002c-previous_002c-slecting-_0028ft_0029"></a>
<p>The <code class="code">ft</code> request selects the typeface <var class="var">font</var>.  If the argument
is absent or &lsquo;<samp class="samp">P</samp>&rsquo;, it selects the previously chosen font.  If
<var class="var">font</var> is a non-negative integer, it is interpreted as mounting
position; the font mounted there is selected.  If that position refers
to an abstract style, it is combined with the default family (see
<code class="code">fam</code> and <code class="code">\F</code> below) to make a resolved font name.  If the
mounting position is not a style and no font is mounted there, GNU
<code class="code">troff</code> emits a warning in category &lsquo;<samp class="samp">font</samp>&rsquo; and ignores the
request.
</p>
<p>If <var class="var">font</var> matches a style name, it is combined with the current
family to make a resolved font name.  Otherwise, <var class="var">font</var> is assumed
to already be a resolved font name.
</p>
<a class="index-entry-id" id="index-automatic-font-mounting"></a>
<a class="index-entry-id" id="index-font-mounting_002c-automatic"></a>
<a class="index-entry-id" id="index-mounting_002c-font_002c-automatic"></a>
<p>The resolved font name is subject to translation (see request <code class="code">ftr</code>
below).  Next, the (possibly translated) font name&rsquo;s mounting position
is looked up; if not mounted, <var class="var">font</var> is sought on the file system as
a font description file and, if located, automatically mounted at the
next available position (see register <code class="code">.fp</code> below).  If the font
was mounted using an identifier different from its font description file
name (see request <code class="code">fp</code> below), that file name is then looked up.
If a font description file for the resolved font name is not found, GNU
<code class="code">troff</code> emits a warning in category &lsquo;<samp class="samp">font</samp>&rsquo; and ignores the
request.
</p>
<p>The <code class="code">\f</code> escape sequence is similar, using one-character name (or
mounting position) <var class="var">f</var>, two-character name <var class="var">fn</var>, or a name
<var class="var">font</var> of arbitrary length.
<a class="index-entry-id" id="index-previous-font_002c-selecting-_0028_005cf_005b_005d_002c-_005cfP_0029"></a>
<a class="index-entry-id" id="index-font_002c-previous_002c-selecting-_0028_005cf_005b_005d_002c-_005cfP_0029"></a>
&lsquo;<samp class="samp">\f[]</samp>&rsquo; selects the previous font.  The syntax form &lsquo;<samp class="samp">\fP</samp>&rsquo; is
supported for backward compatibility, and &lsquo;<samp class="samp">\f[P]</samp>&rsquo; for consistency.
</p>
<div class="example">
<div class="group"><pre class="example-preformatted">eggs, bacon,
.ft I
spam,
.ft
and sausage.
.br
eggs, bacon, \fIspam,\fP and sausage.
    &rArr; eggs, bacon, <i class="slanted">spam,</i> and sausage
    &rArr; eggs, bacon, <i class="slanted">spam,</i> and sausage
</pre></div></div>

<p>The current and previously selected fonts are properties of the
environment (see <a class="pxref" href="Environments.html">Environments</a>).
</p>
<p>The read-only string-valued register <code class="code">.fn</code> contains the resolved
font name of the selected font.
</p>
<p><code class="code">\f</code> doesn&rsquo;t produce an input token in GNU <code class="code">troff</code>; it thus
can be used in requests that expect a single-character argument.  We can
assign a font to a margin character as follows (see <a class="pxref" href="Miscellaneous.html">Miscellaneous</a>).
</p>
<div class="example">
<div class="group"><pre class="example-preformatted">.mc \f[I]x\f[]
</pre></div></div>
</dd></dl>

<dl class="first-deffn">
<dt class="deffn" id="index-_002eftr"><span class="category-def">Request: </span><span><strong class="def-name"><code class="t">.ftr</code></strong> <var class="def-var-arguments">f [<span class="r"><i class="slanted">g</i></span>]</var><a class="copiable-link" href='#index-_002eftr'> &para;</a></span></dt>
<dd><a class="index-entry-id" id="index-ftr"></a>
<a class="index-entry-id" id="index-font-translation-_0028ftr_0029"></a>
<a class="index-entry-id" id="index-ft-request_002c-and-font-translations"></a>
<a class="index-entry-id" id="index-ul-request_002c-and-font-translations"></a>
<a class="index-entry-id" id="index-bd-request_002c-and-font-translations"></a>
<a class="index-entry-id" id="index-_005cf_002c-and-font-translations"></a>
<a class="index-entry-id" id="index-cs-request_002c-and-font-translations"></a>
<a class="index-entry-id" id="index-tkf-request_002c-and-font-translations"></a>
<a class="index-entry-id" id="index-special-request_002c-and-font-translations"></a>
<a class="index-entry-id" id="index-fspecial-request_002c-and-font-translations"></a>
<a class="index-entry-id" id="index-fp-request_002c-and-font-translations"></a>
<a class="index-entry-id" id="index-sty-request_002c-and-font-translations"></a>
<a class="index-entry-id" id="index-if-request_002c-and-font-translations"></a>
<a class="index-entry-id" id="index-ie-request_002c-and-font-translations"></a>
<a class="index-entry-id" id="index-while-request_002c-and-font-translations"></a>
<p>Translate font&nbsp;<var class="var">f</var> to font&nbsp;<var class="var">g</var>.  Whenever a font
named&nbsp;<var class="var">f</var> is referred to in a <code class="code">\f</code> escape sequence, in the
<code class="code">F</code> and <code class="code">S</code> conditional operators, or in the <code class="code">ft</code>,
<code class="code">ul</code>, <code class="code">bd</code>, <code class="code">cs</code>, <code class="code">tkf</code>, <code class="code">special</code>,
<code class="code">fspecial</code>, <code class="code">fp</code>, or <code class="code">sty</code> requests, font&nbsp;<var class="var">g</var> is
used.  If <var class="var">g</var> is missing or equal to&nbsp;<var class="var">f</var> the translation is
undone.
</p>
<p>Font translations cannot be chained.
</p>
<div class="example">
<div class="group"><pre class="example-preformatted">.ftr XXX TR
.ftr XXX YYY
.ft XXX
    error&rarr; warning: can't find font 'XXX'
</pre></div></div>
</dd></dl>

<dl class="first-deffn">
<dt class="deffn" id="index-_002efzoom"><span class="category-def">Request: </span><span><strong class="def-name"><code class="t">.fzoom</code></strong> <var class="def-var-arguments">f [<span class="r"><i class="slanted">zoom</i></span>]</var><a class="copiable-link" href='#index-_002efzoom'> &para;</a></span></dt>
<dd><a class="index-entry-id" id="index-fzoom"></a>
</dd><dt class="deffnx def-cmd-deffn" id="index-_005cn_005b_002ezoom_005d"><span class="category-def">Register: </span><span><strong class="def-name"><code class="t">\n[.zoom]</code></strong><a class="copiable-link" href='#index-_005cn_005b_002ezoom_005d'> &para;</a></span></dt>
<dd><a class="index-entry-id" id="index-_002ezoom"></a>
<a class="index-entry-id" id="index-magnification-of-a-font-_0028fzoom_0029"></a>
<a class="index-entry-id" id="index-font_002c-magnification-_0028fzoom_0029"></a>
<a class="index-entry-id" id="index-zoom-factor-of-a-font-_0028fzoom_0029"></a>
<a class="index-entry-id" id="index-factor_002c-zoom_002c-of-a-font-_0028fzoom_0029"></a>
<a class="index-entry-id" id="index-font_002c-zoom-factor-_0028fzoom_0029"></a>
<a class="index-entry-id" id="index-optical-size-of-a-font"></a>
<a class="index-entry-id" id="index-font_002c-optical-size"></a>
<a class="index-entry-id" id="index-size_002c-optical_002c-of-a-font"></a>
<p>Set magnification of font&nbsp;<var class="var">f</var> to factor <var class="var">zoom</var>, which must
be a non-negative integer multiple of 1/1000th.  This request is useful
to adjust the optical size of a font in relation to the others.  In the
example below, font <code class="code">CR</code> is magnified by 10% (the zoom factor is
thus 1.1).
</p>
<div class="example">
<div class="group"><pre class="example-preformatted">.fam P
.fzoom CR 1100
.ps 12
Palatino and \f[CR]Courier\f[]
</pre></div></div>

<p>A missing or zero value of <var class="var">zoom</var> is the same as a value of 1000,
which means no magnification.  <var class="var">f</var>&nbsp;must be a resolved font
name, not an abstract style.
</p>
<p>The magnification of a font is completely transparent to GNU
<code class="code">troff</code>; a change of the zoom factor doesn&rsquo;t cause any effect
except that the dimensions of glyphs, (word) spaces, kerns, etc., of the
affected font are adjusted accordingly.
</p>
<p>The zoom factor of the current font is available in the read-only
register &lsquo;<samp class="samp">.zoom</samp>&rsquo;, in multiples of 1/1000th.  It returns zero if
there is no magnification.
</p></dd></dl>


</div>
<hr>
<div class="nav-panel">
<p>
Next: <a href="Font-Families.html">Font Families</a>, Previous: <a href="Using-Fonts.html">Using Fonts</a>, Up: <a href="Using-Fonts.html">Using Fonts</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>