|
|
1.1 root 1: .TH FONT 5
2: .CT 1 writing_output
3: .SH NAME
4: font \- description files for troff
5: .SH DESCRIPTION
6: Directories
7: .BI /usr/lib/font/dev dest
8: describe typesetters,
9: where
10: .I dest
11: is as in the
12: .B -T
13: option of
14: .IR troff (1).
15: Such directories contain files named as in FILES below.
16: .PP
17: Lines of a typesetter description in file
18: .F DESC
19: have the following forms.
20: .TF paperlength\ n
21: .TP
22: .BI res " n
23: Resolution of device is
24: .I n
25: basic units per inch.
26: .PD0
27: .TP
28: .BI hor " n
29: Horizontal motion occurs in increments of
30: .I n
31: units.
32: .TP
33: .BI vert " n
34: Vertical motion occurs in increments of
35: .I n
36: units.
37: .TP
38: .BI unitwidth " n
39: Widths are given for pointsize
40: .I n.
41: .TP
42: .BI sizescale " n
43: Scaling for fractional pointsizes, not used.
44: .TP
45: .BI paperwidth " n
46: Width of paper is
47: .I n
48: units.
49: .TP
50: .BI paperlength " n
51: Length of paper is
52: .I n
53: units.
54: .TP
55: .BI biggestfont " n
56: Maximum number of characters in a font is
57: .I n.
58: .TP
59: .BI sizes " n n n ... " 0
60: Pointsizes
61: .I "n ...
62: are available.
63: .TP
64: .BI fonts " n name ...
65: Number of initial fonts followed by their names,
66: for example
67: .br
68: .L
69: fonts 4 R I B S
70: .TP
71: .B charset
72: This line comes last, followed by
73: a list of special character names for
74: the device, separated by spaces or newlines, as
75: .BR bu
76: for
77: .BR \e(bu
78: .PD
79: .PP
80: Lines of a font description file have the following forms.
81: .TF paperlength\ n
82: .TP
83: .BI name " name
84: name of the font,
85: such as
86: .B R
87: or
88: .B CW
89: .PD 0
90: .TP
91: .BI internalname " name
92: The typesetter's name for the font, independent of the
93: .I troff
94: name or font position.
95: .TP
96: .B special
97: A
98: .I troff
99: special font, logically part of all non-special fonts.
100: .TP
101: .BI ligatures " name ... " 0
102: The named ligatures are available.
103: Legal names are
104: .BR "ff fi fl ffi ffl" .
105: .TP
106: .BI spacewidth " n
107: Space is
108: .I n
109: units wide (default 1/3 of an em).
110: .TP
111: .B charset
112: Must come last.
113: Each line following
114: .B charset
115: describes one character thus:
116: .PD
117: .IP
118: .I "name width height code
119: .IP
120: .I Name
121: is either a single ASCII character or a special character listed in
122: .FR DESC .
123: .I Width
124: is in basic units.
125: .I Height
126: is 1 if the character descends below
127: the baseline,
128: 2 if it rises above the letter `a',
129: 3 if it both rises and
130: descends, 0 for neither.
131: .I Code
132: is the number sent to the typesetter to produce the character.
133: If a character name is a synonym for the preceding one,
134: its width, height, and code may be replaced by one double quote
135: \fL"\fR.
136: .PP
137: Lines beginning with
138: .B #
139: are comments in both
140: .B DESC
141: and font description files.
142: .PP
143: .I Troff
144: and its postprocessors use the binary versions as compiled by
145: a program
146: .I makedev.
147: .ig
148: .PP
149: The file
150: .I DESC.out
151: starts with the
152: .I dev
153: structure,
154: defined by
155: .IR dev.h :
156: .CW
157: .ta0.6i 1.8i
158: /*
159: dev.h: characteristics of a typesetter
160: * /
161:
162: \s-1struct dev {
163: unsigned short\ filesize;\ \ /* number of bytes in file, */
164: \0\0 \0\0\0\0\0 /* excluding dev part */
165: short res; /* basic resolution in goobies/inch */
166: short hor; /* goobies horizontally */
167: short vert;
168: short unitwidth; /* size at which widths are given*/
169: short nfonts;\0 /* number fonts physically available */
170: short nsizes;\0 /* number of pointsizes */
171: short sizescale; /* scaling for fractional pointsizes */
172: short paperwidth; /* max line length in units */
173: short paperlength; /* max paper length in units */
174: short nchtab;\0 /* number of funny names in chtab */
175: short lchname; /* length of chname table */
176: short biggestfont; /* max # of chars in a font */
177: short spare; /* in case of expansion */\f1
178: };
179: .CE
180: .IR filesize
181: is just the size of everything in
182: .I DESC.out
183: excluding the
184: .I dev
185: structure.
186: .I nfonts
187: is the number of different font positions available.
188: .I nsizes
189: is the number of different pointsizes supported by this typesetter.
190: .I nchtab
191: is the number of special character names.
192: .I lchname
193: is the total number of characters,
194: including nulls,
195: needed to list all
196: the special character names.
197: At the end of the structure is one spare for later expansions.
198: .PP
199: Immediately following the
200: .I dev
201: structure are a number of tables.
202: First is the
203: .I sizes
204: table,
205: which contains
206: .I nsizes
207: + 1 shorts(a null at the end),
208: describing the pointsizes of text
209: available on this device.
210: The second table is the
211: .IR funny_char_index_table .
212: It contains indexes into the table that follows it,
213: the
214: .IR funny_char_strings .
215: The indexes point to the beginning of each special character name
216: that is stored in the
217: .I funny_char_strings
218: table.
219: The
220: .I funny_char_strings
221: table is
222: .I lchname
223: characters long,
224: while the
225: .I funny_char_index_table
226: is
227: .I nchtab
228: shorts long.
229: .PP
230: Following the
231: .I dev
232: structure will occur
233: .I nfonts
234: .I {font}.out
235: files,
236: which are used to initialize the font positions.
237: These
238: .I {font}.out
239: files,
240: which also exist as separate files,
241: begin with a
242: .I Font
243: structure and then are followed by four character arrays:
244: .CW
245: \s-1struct Font { /* characteristics of a font */
246: char nwfont; /* number of width entries */
247: char specfont; /* 1 == special font */
248: char ligfont; /* 1 == ligatures exist on this font */
249: char namefont[10]; /* name of this font, e.g., R */
250: char intname[10]; /* internal name of font, in ASCII */
251: }\s+1;
252: .CE
253: The
254: .I Font
255: structure tells how many defined characters there are in
256: the font, whether the font is a "special" font and if it contains
257: ligatures.
258: It also has the ASCII name of the font,
259: which should
260: match the name of the file it appears in,
261: and the internal
262: name of the font on the typesetting device
263: .RI ( intname ).
264: The internal name is
265: independent of the font position and name that
266: .B troff
267: knows about.
268: For
269: example, you might say mount R in position 4,
270: but when asking
271: the typesetter to actually produce a character from the R
272: font,
273: the postprocessor which instructs the typesetter would
274: use
275: .IR intname .
276: .PP
277: The first three character arrays are specific for the font and run
278: in parallel.
279: The first array,
280: .IR widths ,
281: contains the width of each character
282: relative to
283: .IR unitwidth .
284: .I unitwidth
285: is defined in
286: .IR DESC .
287: The second array,
288: .IR height ,
289: contains height information.
290: If a character rises
291: above the letter 'a',
292: 02 is set.
293: If it descends below the line,
294: 01 is set.
295: The third array,
296: .IR codes ,
297: contains the code that is sent to
298: the typesetter to produce the character.
299: .PP
300: The fourth array is defined by the device description in
301: .IR DESC .
302: It is the
303: .IR font_index_table .
304: This table contains indexes into the
305: .IR width ,
306: .IR height ,
307: and
308: .I code
309: tables for each character.
310: The order that characters appear in these three
311: tables is arbitrary and changes from one font to the next.
312: In order for
313: .B troff
314: to be able to translate from ASCII and the special character names to these
315: arbitrary tables,
316: the
317: .I font_index_table
318: is created with an order that is constant for each device.
319: The number of entries in this table is 96 plus the number of special
320: character names for this device.
321: The value
322: 96 is
323: 128 - 32,
324: the number of printable characters in the
325: ASCII alphabet.
326: To determine whether a normal ASCII character exists,
327: .B troff
328: takes the ASCII value of the character,
329: subtracts 32,
330: and looks in the
331: .IR font_index_table .
332: If it finds a 0,
333: the character is not defined in this font.
334: If it
335: finds anything else,
336: that is the index into
337: .IR widths ,
338: .IR height ,
339: and
340: .I codes
341: that describe that character.
342: .PP
343: To look up a special character name,
344: for example
345: .BR \e(pl ,
346: the mathematical plus sign,
347: and determine whether it appears
348: in a particular font or not,
349: the following procedure is followed.
350: A
351: .I counter
352: is set to 0 and an index to a special character name
353: is picked out of the
354: .I counter'th
355: position in the
356: .IR funny_char_index_table .
357: A string comparison is performed between
358: .I funny_char_strings [ funny_char_index_table
359: .I [ counter ] ]
360: and the special character name,
361: in
362: our example
363: .BR pl ,
364: and if it matches,
365: then
366: .B troff
367: refers to this character as (96 +
368: .IR counter ).
369: When it wants to
370: determine whether a specific font supports this character,
371: it
372: looks in
373: .IR font_index_table "[96 + " counter ].
374: .PP
375: The 0th element of the
376: .I width
377: array defines the width of a space.
378: If that element is 0, the width of
379: a space is taken to be 1/3 the width of the
380: .LR \e(em
381: character.
382: ..
383: .SH FILES
384: .TF /usr/lib/font/dev*
385: .TP
386: .F /usr/lib/font/dev*
387: typesetter description directory
388: .TP
389: .F DESC
390: typesetter description (ASCII)
391: .TP
392: .F DESC.out
393: typesetter description (binary); created by
394: .I makedev
395: .TP
396: .I font
397: description of the named
398: .I font
399: (ASCII)
400: .TP
401: .IB font .out
402: description of the named
403: .I font
404: (binary); created by
405: .I makedev
406: .TP
407: .F /n/bowell/usr/src/cmd/troff/makedev
408: .SH "SEE ALSO"
409: .IR troff (1)
410: .br
411: B. W. Kernighan,
412: `A Typesetter-Independent Troff',
413: this manual, Volume 2
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.