Blame


1 058b0118 2005-01-03 devnull .TH FONT 7
2 058b0118 2005-01-03 devnull .SH NAME
3 058b0118 2005-01-03 devnull font, subfont \- external format for fonts and subfonts
4 058b0118 2005-01-03 devnull .SH SYNOPSIS
5 058b0118 2005-01-03 devnull .B #include <draw.h>
6 058b0118 2005-01-03 devnull .SH DESCRIPTION
7 058b0118 2005-01-03 devnull Fonts and subfonts are described in
8 d32deab1 2020-08-16 rsc .MR cachechars (3) .
9 058b0118 2005-01-03 devnull .PP
10 b3a110af 2015-02-17 rsc External bitmap fonts are described by a plain text file that can be read using
11 058b0118 2005-01-03 devnull .IR openfont .
12 058b0118 2005-01-03 devnull The format of the file is a header followed by any number of
13 058b0118 2005-01-03 devnull subfont range specifications.
14 058b0118 2005-01-03 devnull The header contains two numbers: the height and the ascent, both in pixels.
15 058b0118 2005-01-03 devnull The height is the inter-line spacing and the ascent is the distance
16 058b0118 2005-01-03 devnull from the top of the line to the baseline. These numbers are chosen
17 058b0118 2005-01-03 devnull to display consistently all the subfonts of the font.
18 058b0118 2005-01-03 devnull A subfont range specification contains two or three numbers and a file name.
19 058b0118 2005-01-03 devnull The numbers are the inclusive range of characters covered by the subfont,
20 058b0118 2005-01-03 devnull with an optional starting position within the subfont,
21 058b0118 2005-01-03 devnull and the file name names an external file suitable for
22 058b0118 2005-01-03 devnull .I readsubfont
23 058b0118 2005-01-03 devnull (see
24 d32deab1 2020-08-16 rsc .MR graphics (3) ).
25 058b0118 2005-01-03 devnull The minimum number of a covered range is mapped to the specified starting position
26 058b0118 2005-01-03 devnull (default zero) of the
27 058b0118 2005-01-03 devnull corresponding subfont.
28 058b0118 2005-01-03 devnull If the subfont file name does not begin with a slash, it is taken relative to the
29 058b0118 2005-01-03 devnull directory containing the font file.
30 058b0118 2005-01-03 devnull Each field must be followed by some white space.
31 058b0118 2005-01-03 devnull Each numeric field may be C-format decimal, octal, or hexadecimal.
32 058b0118 2005-01-03 devnull .PP
33 058b0118 2005-01-03 devnull External subfonts are represented in a more rigid format
34 058b0118 2005-01-03 devnull that can be read and written using
35 058b0118 2005-01-03 devnull .I readsubfont
36 058b0118 2005-01-03 devnull and
37 058b0118 2005-01-03 devnull .I writesubfont
38 058b0118 2005-01-03 devnull (see
39 d32deab1 2020-08-16 rsc .MR subfont (3) ).
40 058b0118 2005-01-03 devnull The format for subfont files is: an image containing character glyphs,
41 058b0118 2005-01-03 devnull followed by a subfont header, followed by character information.
42 058b0118 2005-01-03 devnull The image has the format for external image files described in
43 d32deab1 2020-08-16 rsc .MR image (7) .
44 058b0118 2005-01-03 devnull The subfont header has 3
45 058b0118 2005-01-03 devnull decimal strings:
46 058b0118 2005-01-03 devnull .BR n ,
47 058b0118 2005-01-03 devnull .BR height ,
48 058b0118 2005-01-03 devnull and
49 058b0118 2005-01-03 devnull .BR ascent .
50 058b0118 2005-01-03 devnull Each number is right-justified and blank padded in 11 characters, followed by a blank.
51 058b0118 2005-01-03 devnull The character
52 058b0118 2005-01-03 devnull .B info
53 058b0118 2005-01-03 devnull consists of
54 058b0118 2005-01-03 devnull .BR n +1
55 058b0118 2005-01-03 devnull 6-byte entries, each giving the
56 058b0118 2005-01-03 devnull .B Fontchar
57 058b0118 2005-01-03 devnull .B x
58 058b0118 2005-01-03 devnull (2 bytes, low order byte first),
59 058b0118 2005-01-03 devnull .BR top ,
60 058b0118 2005-01-03 devnull .BR bottom ,
61 058b0118 2005-01-03 devnull .BR left ,
62 058b0118 2005-01-03 devnull and
63 058b0118 2005-01-03 devnull .BR width .
64 058b0118 2005-01-03 devnull The
65 058b0118 2005-01-03 devnull .B x
66 058b0118 2005-01-03 devnull field of the last
67 058b0118 2005-01-03 devnull .B Fontchar
68 058b0118 2005-01-03 devnull is used to calculate the image width
69 058b0118 2005-01-03 devnull of the previous character; the other fields in the last
70 058b0118 2005-01-03 devnull .B Fontchar
71 058b0118 2005-01-03 devnull are irrelevant.
72 058b0118 2005-01-03 devnull .PP
73 058b0118 2005-01-03 devnull Note that the convention of using the character with value zero (NUL) to represent
74 058b0118 2005-01-03 devnull characters of zero width (see
75 d32deab1 2020-08-16 rsc .MR draw (3) )
76 058b0118 2005-01-03 devnull means that fonts should have, as their zeroth character,
77 058b0118 2005-01-03 devnull one with non-zero width.
78 b3a110af 2015-02-17 rsc .SS "Font Names
79 b3a110af 2015-02-17 rsc .PP
80 b3a110af 2015-02-17 rsc Font names in Plan 9 from User Space are
81 b3a110af 2015-02-17 rsc a small language describing a font.
82 b3a110af 2015-02-17 rsc The most basic form is the name of an existing bitmap font file,
83 b3a110af 2015-02-17 rsc following the convention:
84 b3a110af 2015-02-17 rsc .IP
85 b3a110af 2015-02-17 rsc .B /lib/font/bit/\fIname\fP/\fIrange\fP.\fIsize\fP.font
86 b3a110af 2015-02-17 rsc .PD
87 b3a110af 2015-02-17 rsc .PP
88 b3a110af 2015-02-17 rsc where
89 b3a110af 2015-02-17 rsc .I size
90 b3a110af 2015-02-17 rsc is approximately the height in pixels of the lower case letters
91 b3a110af 2015-02-17 rsc (without ascenders or descenders).
92 b3a110af 2015-02-17 rsc .I Range
93 b3a110af 2015-02-17 rsc gives some indication of which characters will be available: for example
94 b3a110af 2015-02-17 rsc .BR ascii ,
95 b3a110af 2015-02-17 rsc .BR latin1 ,
96 b3a110af 2015-02-17 rsc .BR euro ,
97 b3a110af 2015-02-17 rsc or
98 b3a110af 2015-02-17 rsc .BR unicode .
99 b3a110af 2015-02-17 rsc .B Euro
100 b3a110af 2015-02-17 rsc includes most European languages, punctuation marks, the International Phonetic
101 10e46bde 2022-08-18 noreply Alphabet, etc., but no Asian languages.
102 b3a110af 2015-02-17 rsc .B Unicode
103 b3a110af 2015-02-17 rsc includes every character for which appropriate-sized images exist on the system.
104 b3a110af 2015-02-17 rsc .PP
105 b3a110af 2015-02-17 rsc In Plan 9 from User Space, the font files are rooted in
106 b3a110af 2015-02-17 rsc .B $PLAN9/font
107 b3a110af 2015-02-17 rsc instead of
108 b3a110af 2015-02-17 rsc .BR /lib/font/bit ,
109 b3a110af 2015-02-17 rsc but to keep old references working, paths beginning with
110 b3a110af 2015-02-17 rsc .B /lib/font/bit
111 b3a110af 2015-02-17 rsc are interpreted as references to the actual font directory.
112 b3a110af 2015-02-17 rsc .PP
113 b3a110af 2015-02-17 rsc Fonts need not be stored on disk in the Plan 9 format.
114 b3a110af 2015-02-17 rsc If the font name has the form
115 b3a110af 2015-02-17 rsc .BR /mnt/font/\fIname\fP/\fIsize\fP/font ,
116 b3a110af 2015-02-17 rsc .I fontsrv
117 b3a110af 2015-02-17 rsc is invoked to synthesize a bitmap font from the operating system's installed vector fonts.
118 b3a110af 2015-02-17 rsc The command
119 b3a110af 2015-02-17 rsc .B fontsrv
120 b3a110af 2015-02-17 rsc .B -p
121 b3a110af 2015-02-17 rsc .B .
122 b3a110af 2015-02-17 rsc lists the available fonts.
123 b3a110af 2015-02-17 rsc See
124 d32deab1 2020-08-16 rsc .MR fontsrv (4)
125 b3a110af 2015-02-17 rsc for more.
126 b3a110af 2015-02-17 rsc .PP
127 b3a110af 2015-02-17 rsc If the font name has the form
128 b3a110af 2015-02-17 rsc .BR \fIscale\fP*\fIfontname\fP ,
129 b3a110af 2015-02-17 rsc where
130 b3a110af 2015-02-17 rsc .I scale
131 10e46bde 2022-08-18 noreply is a small decimal integer, the
132 b3a110af 2015-02-17 rsc .I fontname
133 b3a110af 2015-02-17 rsc is loaded and then scaled by pixel repetition.
134 b3a110af 2015-02-17 rsc .PP
135 b3a110af 2015-02-17 rsc The Plan 9 bitmap fonts were designed for screens with pixel density around 100 DPI.
136 b3a110af 2015-02-17 rsc When used on screens with pixel density above 200 DPI,
137 b3a110af 2015-02-17 rsc the bitmap fonts are automatically pixel doubled.
138 b3a110af 2015-02-17 rsc Similarly, fonts loaded from
139 d32deab1 2020-08-16 rsc .MR fontsrv (4)
140 b3a110af 2015-02-17 rsc are automatically doubled in size by varying the effective
141 b3a110af 2015-02-17 rsc .I size
142 b3a110af 2015-02-17 rsc path element.
143 b3a110af 2015-02-17 rsc In both cases, the effect is that a single font name
144 b3a110af 2015-02-17 rsc can be used on both low- and high-density displays (or even in a window moved between differing displays)
145 b3a110af 2015-02-17 rsc while keeping roughly the same effective size.
146 b3a110af 2015-02-17 rsc .PP
147 b3a110af 2015-02-17 rsc For more control over the fonts used on low- and high-density displays,
148 b3a110af 2015-02-17 rsc if the font name has the form
149 b3a110af 2015-02-17 rsc .BR \fIlowfont\fP,\fIhighfont\fP ,
150 b3a110af 2015-02-17 rsc .I lowfont
151 b3a110af 2015-02-17 rsc is used on low-density displays and
152 b3a110af 2015-02-17 rsc .I highfont
153 b3a110af 2015-02-17 rsc on high-density displays.
154 b3a110af 2015-02-17 rsc In effect, the behavior described above is that the font name
155 b3a110af 2015-02-17 rsc .IP
156 b3a110af 2015-02-17 rsc .B /lib/font/bit/lucsans/euro.8.font
157 b3a110af 2015-02-17 rsc .PD
158 b3a110af 2015-02-17 rsc .PP
159 b3a110af 2015-02-17 rsc really means
160 b3a110af 2015-02-17 rsc .IP
161 b3a110af 2015-02-17 rsc .B /lib/font/bit/lucsans/euro.8.font,2*/lib/font/bit/lucsans/euro.8.font
162 b3a110af 2015-02-17 rsc .PD
163 b3a110af 2015-02-17 rsc .PP
164 b3a110af 2015-02-17 rsc and similarly
165 b3a110af 2015-02-17 rsc .IP
166 b3a110af 2015-02-17 rsc .B /mnt/font/LucidaGrande/15a/font
167 b3a110af 2015-02-17 rsc .PD
168 b3a110af 2015-02-17 rsc .PP
169 b3a110af 2015-02-17 rsc really means
170 b3a110af 2015-02-17 rsc .IP
171 b3a110af 2015-02-17 rsc .B /mnt/font/LucidaGrande/15a/font,/mnt/font/LucidaGrande/30a/font
172 b3a110af 2015-02-17 rsc .PD
173 b3a110af 2015-02-17 rsc .PP
174 b3a110af 2015-02-17 rsc Using an explicit comma-separated font pair allows finer control, such as
175 b3a110af 2015-02-17 rsc using a Plan 9 bitmap font on low-density displays but switching to
176 b3a110af 2015-02-17 rsc a system-installed vector font on high-density displays:
177 b3a110af 2015-02-17 rsc .IP
178 b3a110af 2015-02-17 rsc .B /lib/font/bit/lucsans/euro.8.font,/mnt/font/LucidaGrande/30a/font
179 b3a110af 2015-02-17 rsc .PD
180 b3a110af 2015-02-17 rsc .PP
181 058b0118 2005-01-03 devnull .SH FILES
182 c8b6342d 2005-01-13 devnull .TF \*9/font/*
183 058b0118 2005-01-03 devnull .TP
184 c8b6342d 2005-01-13 devnull .B \*9/font/*
185 058b0118 2005-01-03 devnull font directories
186 058b0118 2005-01-03 devnull .SH "SEE ALSO"
187 d32deab1 2020-08-16 rsc .MR graphics (3) ,
188 d32deab1 2020-08-16 rsc .MR draw (3) ,
189 d32deab1 2020-08-16 rsc .MR cachechars (3) ,
190 d32deab1 2020-08-16 rsc .MR subfont (3)