1\&
2.sp 1
3.ce 4
4\s+1\fBBitmap Distribution Format\fP\s-1
5
6\s+1\fBVersion 2.1\fP\s-1
7
8X Window System Standard
9
10X Version 11, Release 6.8
11.sp 3
12Copyright 1984, 1987, 1988 Adobe Systems, Inc.
13.sp 1
14Permission to use, copy, modify, and distribute this
15software and its documentation for any purpose and without
16fee is hereby granted, provided that the above copyright
17notice appear in all copies and that both that copyright
18notice and this permission notice appear in supporting
19documentation.
20.sp 3
21.na
22.LP
23.XS
24Bitmap Distribution Format
25.XE
26.LP
27The Bitmap Distribution Format (BDF), Version 2.1,
28is an X Consortium standard for font interchange, 
29intended to be easily understood by both humans and computers.
30.SH
31File Format
32.LP
33Character bitmap information will be distributed in an USASCII-encoded,
34human-readable form.
35Each file is encoded in the printable characters (octal 40 through 176) of
36USASCII plus carriage return and linefeed.
37Each file consists of a sequence of variable-length lines.
38Each line is terminated either by a carriage return (octal 015) 
39and linefeed (octal 012) or by just a linefeed.
40.LP
41The information about a particular family and face at one size 
42and orientation will be contained in one file.
43The file begins with information pertaining to the face as a whole, 
44followed by the information and bitmaps for the individual characters.
45.LP
46A font bitmap description file has the following general form, 
47where each item is contained on a separate line of text in the file.
48Tokens on a line are separated by spaces. 
49Keywords are in upper case, and must appear in upper case in the file.
50.IP 1. 5
51The word STARTFONT followed by a version number indicating the exact
52file format used.
53The version described here is 2.1.
54.IP 2. 5
55Lines beginning with the word COMMENT may appear anywhere between the
56STARTFONT line and the ENDFONT line.
57These lines are ignored by font compilers.
58.IP 3. 5
59The word FONT followed by either the XLFD font name (as specified in part III)
60or some private font name.
61Creators of private font name syntaxes are encouraged to register unique font
62name prefixes with the X Consortium to prevent naming conflicts.
63Note that the name continues all the way to the end of the line 
64and may contain spaces.
65.IP 4. 5
66The word SIZE followed by the \fIpoint size\fP
67of the characters, the \fIx resolution\fP, and the \fIy resolution\fP
68of the device for which these characters were intended.
69.IP 5. 5
70The word FONTBOUNDINGBOX followed by the \fIwidth in x\fP, 
71\fIheight in y\fP, and the x and y displacement of the lower left corner 
72from the \fIorigin\fP.
73(See the examples in the next section.) 
74.IP 6. 5
75Optionally, the word STARTPROPERTIES followed by the number of properties
76(\^\fIp\fP\^) that follow.
77.IP 7. 5
78Then come \fIp\fP lines consisting of a word for the \fIproperty name\fP 
79followed by either an integer or string surrounded by double-quote (octal 042).
80Internal double-quote characters are indicated by using two in a row.
81.IP
82Properties named FONT_ASCENT, FONT_DESCENT, and DEFAULT_CHAR
83should be provided to define the logical font-ascent and font-descent
84and the default-char for the font.
85These properties will be removed from the actual font properties 
86in the binary form produced by a compiler.
87If these properties are not provided, 
88a compiler may reject the font or may compute (arbitrary) values 
89for these properties.
90.IP 8. 5
91The property section, if it exists, is terminated by ENDPROPERTIES.
92.IP 9. 5
93The word CHARS followed by the number of character segments (\^\fIc\fP\^) 
94that follow.
95.IP 10. 5
96Then come \fIc\fP character segments of the form:
97.RS
98.IP a. 5
99The word STARTCHAR followed by up to 14 characters (no blanks) of
100descriptive \fIname\fP of the glyph.
101.IP b. 5
102The word ENCODING followed by one of the following forms:
103.RS
104.IP i. 5
105<n> \- the glyph index, that is, a positive integer representing 
106the character code used to access the glyph in X requests,
107as defined by the encoded character set given by the 
108CHARSET_REGISTRY-CHARSET_ENCODING font properties for XLFD conforming fonts.
109If these XLFD font properties are not defined, 
110the encoding scheme is font-dependent.
111.IP ii. 5
112\-1 <n> \- equivalent to form above.
113This syntax is provided for backward compatibility with previous versions 
114of this specification and is not recommended for use with new fonts.
115.IP iii. 5
116\-1 \- an unencoded glyph.
117Some font compilers may discard unencoded glyphs,
118but, in general, the glyph names may be used by font compilers 
119and X servers to implement dynamic mapping of glyph repertoires 
120to character encodings as seen through the X protocol.
121.RE
122.IP c. 5
123The word SWIDTH followed by the \fIscalable width\fP in x and y of character.
124Scalable widths are in units of 1/1000th of the size of the character.
125If the size of the character is \fIp\fP points,
126the width information must be scaled by \fIp\fP/1000 to get the width 
127of the character in printer's points.
128This width information should be considered as a vector indicating the position
129of the next character's origin relative to the origin of this character.
130To convert the scalable width to the width in device pixels,
131multiply SWIDTH times \fIp\fP/1000 times \fIr\fP/72,
132where \fIr\fP is the device resolution in pixels per inch.
133The result is a real number giving the ideal print width in device pixels.
134The actual device width must of course be an integral number of device pixels
135and is given in the next entry.
136The SWIDTH y value should always be zero for a standard X font.
137.IP d. 5
138The word DWIDTH followed by the width in x and y of the character 
139in device units.
140Like the SWIDTH,
141this width information is a vector indicating the position 
142of the next character's origin relative to the origin of this character.
143Note that the DWIDTH of a given ``hand-tuned'' WYSIWYG glyph may deviate
144slightly from its ideal device-independent width given by SWIDTH in order
145to improve its typographic characteristics on a display.
146The DWIDTH y value should always be zero for a standard X font.
147.IP e. 5
148The word BBX followed by the width in x (\^\fIBBw\fP\^), \fIheight\fP in y
149(\^\fIBBh\fP\^), and x and y displacement (\^\fIBBox\fP, \fIBBoy\fP\^) 
150of the lower left corner from the \fIorigin\fP of the character.
151.IP f. 5
152The optional word ATTRIBUTES followed by the attributes 
153as 4 \fIhex-encoded\fP characters.
154The interpretation of these attributes is undefined in this document.
155.IP g. 5
156The word BITMAP.
157.IP h. 5
158\fIh\fP lines of \fIhex-encoded\fP bitmap, 
159padded on the right with zeros to the nearest byte (that is, multiple of 8).
160.IP i. 5
161The word ENDCHAR.
162.RE
163.IP 11. 5
164The file is terminated with the word ENDFONT.
165.SH
166Metric Information
167.LP
168Figures 1 and 2 best illustrate the bitmap format and
169character metric information.
170.bp
171\&
172.sp 30
173.ce 5
174BBw = 9, BBh = 22, BBox = -2, BBoy = -6
175DWIDTH = 8 0
176SWIDTH = 355 0
177``+'' = character origin and width
178
179Figure 1: An example of a descender
180.bp
181\&
182.sp 30
183.ce 4
184BBh = 6, BBw = 4, BBox = +2, BBoy = +12
185DWIDTH = 5 0
186SWIDTH = 223 0
187
188Figure 2: An example with the origin outside the bounding box
189.bp
190.SH
191An Example File
192.LP
193The following is an abbreviated example of a bitmap file containing 
194the specification of two characters (the j and quoteright 
195in figures 1 and 2).
196.LP
197.Ds 
198STARTFONT 2.1
199COMMENT This is a sample font in 2.1 format.
200FONT -Adobe-Helvetica-Bold-R-Normal--24-240-75-75-P-65-ISO8859-1
201SIZE 24 75 75
202FONTBOUNDINGBOX 9 24 -2 -6
203STARTPROPERTIES 19
204FOUNDRY "Adobe"
205FAMILY "Helvetica"
206WEIGHT_NAME "Bold"
207SLANT "R"
208SETWIDTH_NAME "Normal"
209ADD_STYLE_NAME ""
210PIXEL_SIZE 24
211POINT_SIZE 240
212RESOLUTION_X 75
213RESOLUTION_Y 75
214SPACING "P"
215AVERAGE_WIDTH 65
216CHARSET_REGISTRY "ISO8859"
217CHARSET_ENCODING "1"
218MIN_SPACE 4
219FONT_ASCENT 21
220FONT_DESCENT 7
221COPYRIGHT "Copyright (c) 1987 Adobe Systems, Inc."
222NOTICE "Helvetica is a registered trademark of Linotype Inc."
223ENDPROPERTIES
224CHARS 2
225STARTCHAR j
226ENCODING 106
227SWIDTH 355 0
228DWIDTH 8 0
229BBX 9 22 -2 -6
230BITMAP
2310380
2320380
2330380
2340380
2350000
2360700
2370700
2380700
2390700
2400E00
2410E00
2420E00
2430E00
2440E00
2451C00
2461C00
2471C00
2481C00
2493C00
2507800
251F000
252E000
253ENDCHAR
254STARTCHAR quoteright
255ENCODING 39
256SWIDTH 223 0
257DWIDTH 5 0
258BBX 4 6 2 12
259ATTRIBUTES 01C0
260BITMAP
26170
26270
26370
26460
265E0
266C0
267ENDCHAR
268ENDFONT
269.De
270