summaryrefslogtreecommitdiff
path: root/static/unix-v10/man5/font.5
blob: 39d4c7a33ffda736af164a92c4fa078e285be981 (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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
.TH FONT 5
.CT 1 writing_output
.SH NAME
font \- description files for troff
.SH DESCRIPTION
Directories
.BI /usr/lib/font/dev dest
describe typesetters,
where
.I dest
is as in the
.B -T
option of
.IR troff (1).
Such directories contain files named as in FILES below.
.PP
Lines of a typesetter description in file
.F DESC
have the following forms.
.TF paperlength\ n
.TP
.BI res " n
Resolution of device is
.I n
basic units per inch.
.PD0
.TP
.BI hor " n
Horizontal motion occurs in increments of
.I n
units.
.TP
.BI vert " n
Vertical motion occurs in increments of
.I n
units.
.TP
.BI unitwidth " n
Widths are given for pointsize
.I n.
.TP
.BI sizescale " n
Scaling for fractional pointsizes, not used.
.TP
.BI paperwidth " n
Width of paper is
.I n
units.
.TP
.BI paperlength " n
Length of paper is
.I n
units.
.TP
.BI biggestfont " n
Maximum number of characters in a font is
.I n.
.TP
.BI sizes " n n n ... " 0
Pointsizes
.I "n ...
are available.
.TP
.BI fonts " n name ...
Number of initial fonts followed by their names,
for example
.br
.L
fonts 4 R I B S
.TP 
.B charset
This line comes last, followed by
a list of special character names for
the device, separated by spaces or newlines, as
.BR bu
for
.BR \e(bu
.PD
.PP
Lines of a font description file have the following forms.
.TF paperlength\ n
.TP
.BI name " name
name of the font,
such as
.B R
or
.B CW
.PD 0
.TP
.BI internalname " name
The typesetter's name for the font, independent of the
.I troff
name or font position.
.TP
.B special
A
.I troff
special font, logically part of all non-special fonts.
.TP
.BI ligatures " name ... " 0
The named ligatures are available.
Legal names are
.BR "ff fi fl ffi ffl" .
.TP
.BI spacewidth " n
Space is
.I n
units wide (default 1/3 of an em).
.TP
.B charset
Must come last.
Each line following
.B charset
describes one character thus:
.PD
.IP
.I "name  width  height  code
.IP
.I Name
is either a single ASCII character or a special character listed in
.FR DESC .
.I Width
is in basic units.
.I Height
is 1 if the character descends below
the baseline,
2 if it rises above the letter `a',
3 if it both rises and
descends, 0 for neither.
.I Code
is the number sent to the typesetter to produce the character.
If a character name is a synonym for the preceding one,
its width, height, and code may be replaced by one double quote
\fL"\fR.
.PP
Lines beginning with
.B #
are comments in both
.B DESC
and font description files.
.PP
.I Troff
and its postprocessors use the binary versions as compiled by
a program
.I makedev.
.ig
.PP
The file
.I DESC.out
starts with the
.I dev
structure,
defined by
.IR dev.h :
.CW
.ta0.6i 1.8i
 /*
dev.h: characteristics of a typesetter
* /

\s-1struct dev {
unsigned short\ filesize;\ \ /* number of bytes in file, */
\0\0	\0\0\0\0\0	/* excluding dev part */
short	res;		/* basic resolution in goobies/inch */
short	hor;		/* goobies horizontally */
short	vert;
short	unitwidth;	/* size at which widths are given*/
short	nfonts;\0	/* number fonts physically available */
short	nsizes;\0	/* number of pointsizes */
short	sizescale;	/* scaling for fractional pointsizes */
short	paperwidth;	/* max line length in units */
short	paperlength;	/* max paper length in units */
short	nchtab;\0	/* number of funny names in chtab */
short	lchname;	/* length of chname table */
short	biggestfont;	/* max # of chars in a font */
short	spare;	/* in case of expansion */\f1
};
.CE
.IR filesize
is just the size of everything in
.I DESC.out
excluding the
.I dev
structure.
.I nfonts
is the number of different font positions available.
.I nsizes
is the number of different pointsizes supported by this typesetter.
.I nchtab
is the number of special character names.
.I lchname
is the total number of characters,
including nulls,
needed to list all
the special character names.
At the end of the structure is one spare for later expansions.
.PP
Immediately following the
.I dev
structure are a number of tables.
First is the
.I sizes
table,
which contains
.I nsizes
+ 1 shorts(a null at the end),
describing the pointsizes of text
available on this device.
The second table is the
.IR funny_char_index_table .
It contains indexes into the table that follows it,
the
.IR funny_char_strings .
The indexes point to the beginning of each special character name
that is stored in the
.I funny_char_strings
table.
The
.I funny_char_strings
table is
.I lchname
characters long,
while the
.I funny_char_index_table
is
.I nchtab
shorts long.
.PP
Following the
.I dev
structure will occur
.I nfonts
.I {font}.out
files,
which are used to initialize the font positions.
These
.I {font}.out
files,
which also exist as separate files,
begin with a
.I Font
structure and then are followed by four character arrays:
.CW
\s-1struct Font {	  /* characteristics of a font */
char	 nwfont;	 /* number of width entries */
char	 specfont;	 /* 1 == special font */
char	  ligfont;	 /* 1 == ligatures exist on this font */
char	 namefont[10]; /* name of this font, e.g., R */
char	 intname[10];  /* internal name of font, in ASCII */
}\s+1;
.CE
The
.I Font
structure tells how many defined characters there are in
the font, whether the font is a "special" font and if it contains
ligatures.
It also has the ASCII name of the font,
which should
match the name of the file it appears in,
and the internal
name of the font on the typesetting device
.RI ( intname ).
The internal name is
independent of the font position and name that
.B troff
knows about.
For
example, you might say mount R in position 4,
but when asking
the typesetter to actually produce a character from the R
font,
the postprocessor which instructs the typesetter would
use
.IR intname .
.PP
The first three character arrays are specific for the font and run
in parallel.
The first array,
.IR widths ,
contains the width of each character
relative to
.IR unitwidth .
.I unitwidth
is defined in
.IR DESC .
The second array,
.IR height ,
contains height information.
If a character rises
above the letter 'a',
02 is set.
If it descends below the line,
01 is set.
The third array,
.IR codes ,
contains the code that is sent to
the typesetter to produce the character.
.PP
The fourth array is defined by the device description in
.IR DESC .
It is the
.IR font_index_table .
This table contains indexes into the
.IR width ,
.IR height ,
and
.I code
tables for each character.
The order that characters appear in these three
tables is arbitrary and changes from one font to the next.
In order for
.B troff
to be able to translate from ASCII and the special character names to these
arbitrary tables,
the
.I font_index_table
is created with an order that is constant for each device.
The number of entries in this table is 96 plus the number of special
character names for this device.
The value
96 is
128 - 32,
the number of printable characters in the
ASCII alphabet.
To determine whether a normal ASCII character exists,
.B troff
takes the ASCII value of the character,
subtracts 32,
and looks in the
.IR font_index_table .
If it finds a 0,
the character is not defined in this font.
If it
finds anything else,
that is the index into
.IR widths ,
.IR height ,
and
.I codes
that describe that character.
.PP
To look up a special character name,
for example
.BR \e(pl ,
the mathematical plus sign,
and determine whether it appears
in a particular font or not,
the following procedure is followed.
A
.I counter
is set to 0 and an index to a special character name
is picked out of the
.I counter'th
position in the
.IR funny_char_index_table .
A string comparison is performed between
.I funny_char_strings [ funny_char_index_table
.I [ counter ] ]
and the special character name,
in
our example
.BR pl ,
and if it matches,
then
.B troff
refers to this character as (96 +
.IR counter ).
When it wants to
determine whether a specific font supports this character,
it
looks in
.IR font_index_table "[96 + " counter ].
.PP
The 0th element of the
.I width
array defines the width of a space.
If that element is 0, the width of
a space is taken to be 1/3 the width of the
.LR \e(em 
character.
..
.SH FILES
.TF /usr/lib/font/dev*
.TP
.F /usr/lib/font/dev*
typesetter description directory
.TP
.F DESC
typesetter description (ASCII)
.TP
.F DESC.out
typesetter description (binary); created by
.I makedev
.TP
.I font
description of the named
.I font
(ASCII)
.TP
.IB font .out
description of the named
.I font
(binary); created by
.I makedev
.TP
.F /n/bowell/usr/src/cmd/troff/makedev
.SH "SEE ALSO"
.IR troff (1)
.br
B. W. Kernighan,
`A Typesetter-Independent Troff',
this manual, Volume 2