1 058b0118 2005-01-03 devnull .TH FONT 7
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 058b0118 2005-01-03 devnull .IR cachechars (3).
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
24 058b0118 2005-01-03 devnull .IR 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.
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
37 058b0118 2005-01-03 devnull .I writesubfont
39 058b0118 2005-01-03 devnull .IR 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 058b0118 2005-01-03 devnull .IR image (7).
44 058b0118 2005-01-03 devnull The subfont header has 3
45 058b0118 2005-01-03 devnull decimal strings:
47 058b0118 2005-01-03 devnull .BR height ,
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
53 058b0118 2005-01-03 devnull consists of
55 058b0118 2005-01-03 devnull 6-byte entries, each giving the
56 058b0118 2005-01-03 devnull .B Fontchar
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 ,
63 058b0118 2005-01-03 devnull .BR width .
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.
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 058b0118 2005-01-03 devnull .IR 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
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:
85 b3a110af 2015-02-17 rsc .B /lib/font/bit/\fIname\fP/\fIrange\fP.\fIsize\fP.font
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).
93 b3a110af 2015-02-17 rsc gives some indication of which characters will be available: for example
98 b3a110af 2015-02-17 rsc .BR unicode .
100 b3a110af 2015-02-17 rsc includes most European languages, punctuation marks, the International Phonetic
101 b3a110af 2015-02-17 rsc Alphabet, etc., but no Oriental languages.
103 b3a110af 2015-02-17 rsc includes every character for which appropriate-sized images exist on the system.
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
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.
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 ,
117 b3a110af 2015-02-17 rsc is invoked to synthesize a bitmap font from the operating system's installed vector fonts.
122 b3a110af 2015-02-17 rsc lists the available fonts.
124 b3a110af 2015-02-17 rsc .IR fontsrv (4)
127 b3a110af 2015-02-17 rsc If the font name has the form
128 b3a110af 2015-02-17 rsc .BR \fIscale\fP*\fIfontname\fP ,
131 b3a110af 2015-02-17 rsc is a small decimal integer, the
133 b3a110af 2015-02-17 rsc is loaded and then scaled by pixel repetition.
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 b3a110af 2015-02-17 rsc .IR fontsrv (4)
140 b3a110af 2015-02-17 rsc are automatically doubled in size by varying the effective
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.
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 ,
151 b3a110af 2015-02-17 rsc is used on low-density displays and
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
156 b3a110af 2015-02-17 rsc .B /lib/font/bit/lucsans/euro.8.font
159 b3a110af 2015-02-17 rsc really means
161 b3a110af 2015-02-17 rsc .B /lib/font/bit/lucsans/euro.8.font,2*/lib/font/bit/lucsans/euro.8.font
164 b3a110af 2015-02-17 rsc and similarly
166 b3a110af 2015-02-17 rsc .B /mnt/font/LucidaGrande/15a/font
169 b3a110af 2015-02-17 rsc really means
171 b3a110af 2015-02-17 rsc .B /mnt/font/LucidaGrande/15a/font,/mnt/font/LucidaGrande/30a/font
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:
178 b3a110af 2015-02-17 rsc .B /lib/font/bit/lucsans/euro.8.font,/mnt/font/LucidaGrande/30a/font
181 058b0118 2005-01-03 devnull .SH FILES
182 c8b6342d 2005-01-13 devnull .TF \*9/font/*
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 058b0118 2005-01-03 devnull .IR graphics (3),
188 058b0118 2005-01-03 devnull .IR draw (3),
189 058b0118 2005-01-03 devnull .IR cachechars (3),
190 058b0118 2005-01-03 devnull .IR subfont (3)