home *** CD-ROM | disk | FTP | other *** search
/ Encyclopedia of Graphics File Formats Companion / GFF_CD.ISO / formats / bdf / spec / bdf.ms next >
Text File  |  1994-05-09  |  8KB  |  270 lines

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