3 font, subfont \- external format for fonts and subfonts
7 Fonts and subfonts are described in
10 External bitmap fonts are described by a plain text file that can be read using
12 The format of the file is a header followed by any number of
13 subfont range specifications.
14 The header contains two numbers: the height and the ascent, both in pixels.
15 The height is the inter-line spacing and the ascent is the distance
16 from the top of the line to the baseline. These numbers are chosen
17 to display consistently all the subfonts of the font.
18 A subfont range specification contains two or three numbers and a file name.
19 The numbers are the inclusive range of characters covered by the subfont,
20 with an optional starting position within the subfont,
21 and the file name names an external file suitable for
25 The minimum number of a covered range is mapped to the specified starting position
27 corresponding subfont.
28 If the subfont file name does not begin with a slash, it is taken relative to the
29 directory containing the font file.
30 Each field must be followed by some white space.
31 Each numeric field may be C-format decimal, octal, or hexadecimal.
33 External subfonts are represented in a more rigid format
34 that can be read and written using
40 The format for subfont files is: an image containing character glyphs,
41 followed by a subfont header, followed by character information.
42 The image has the format for external image files described in
44 The subfont header has 3
50 Each number is right-justified and blank padded in 11 characters, followed by a blank.
55 6-byte entries, each giving the
58 (2 bytes, low order byte first),
68 is used to calculate the image width
69 of the previous character; the other fields in the last
73 Note that the convention of using the character with value zero (NUL) to represent
74 characters of zero width (see
76 means that fonts should have, as their zeroth character,
77 one with non-zero width.
80 Font names in Plan 9 from User Space are
81 a small language describing a font.
82 The most basic form is the name of an existing bitmap font file,
83 following the convention:
85 .B /lib/font/bit/\fIname\fP/\fIrange\fP.\fIsize\fP.font
90 is approximately the height in pixels of the lower case letters
91 (without ascenders or descenders).
93 gives some indication of which characters will be available: for example
100 includes most European languages, punctuation marks, the International Phonetic
101 Alphabet, etc., but no Oriental languages.
103 includes every character for which appropriate-sized images exist on the system.
105 In Plan 9 from User Space, the font files are rooted in
109 but to keep old references working, paths beginning with
111 are interpreted as references to the actual font directory.
113 Fonts need not be stored on disk in the Plan 9 format.
114 If the font name has the form
115 .BR /mnt/font/\fIname\fP/\fIsize\fP/font ,
117 is invoked to synthesize a bitmap font from the operating system's installed vector fonts.
122 lists the available fonts.
127 If the font name has the form
128 .BR \fIscale\fP*\fIfontname\fP ,
131 is a small decimal integer, the
133 is loaded and then scaled by pixel repetition.
135 The Plan 9 bitmap fonts were designed for screens with pixel density around 100 DPI.
136 When used on screens with pixel density above 200 DPI,
137 the bitmap fonts are automatically pixel doubled.
138 Similarly, fonts loaded from
140 are automatically doubled in size by varying the effective
143 In both cases, the effect is that a single font name
144 can be used on both low- and high-density displays (or even in a window moved between differing displays)
145 while keeping roughly the same effective size.
147 For more control over the fonts used on low- and high-density displays,
148 if the font name has the form
149 .BR \fIlowfont\fP,\fIhighfont\fP ,
151 is used on low-density displays and
153 on high-density displays.
154 In effect, the behavior described above is that the font name
156 .B /lib/font/bit/lucsans/euro.8.font
161 .B /lib/font/bit/lucsans/euro.8.font,2*/lib/font/bit/lucsans/euro.8.font
166 .B /mnt/font/LucidaGrande/15a/font
171 .B /mnt/font/LucidaGrande/15a/font,/mnt/font/LucidaGrande/30a/font
174 Using an explicit comma-separated font pair allows finer control, such as
175 using a Plan 9 bitmap font on low-density displays but switching to
176 a system-installed vector font on high-density displays:
178 .B /lib/font/bit/lucsans/euro.8.font,/mnt/font/LucidaGrande/30a/font