README (5972B)
1 FreeType font driver for BDF fonts 2 3 Francesco Zappa Nardelli 4 <francesco.zappa.nardelli@ens.fr> 5 6 7 Introduction 8 ************ 9 10 BDF (Bitmap Distribution Format) is a bitmap font format defined by Adobe, 11 which is intended to be easily understood by both humans and computers. 12 This code implements a BDF driver for the FreeType library, following the 13 Adobe Specification V 2.2. The specification of the BDF font format is 14 available from Adobe's web site: 15 16 https://adobe-type-tools.github.io/font-tech-notes/pdfs/5005.BDF_Spec.pdf 17 18 Many good bitmap fonts in bdf format come with XFree86 (www.XFree86.org). 19 They do not define vertical metrics, because the X Consortium BDF 20 specification has removed them. 21 22 23 Encodings 24 ********* 25 26 [This section is out of date, retained for historical reasons. BDF 27 properties can be retrieved with `FT_Get_BDF_Property`, character set ID 28 values with `FT_Get_BDF_Charset_ID`.] 29 30 The variety of encodings that accompanies bdf fonts appears to encompass the 31 small set defined in freetype.h. On the other hand, two properties that 32 specify encoding and registry are usually defined in bdf fonts. 33 34 I decided to make these two properties directly accessible, leaving to the 35 client application the work of interpreting them. For instance: 36 37 38 #include FT_INTERNAL_BDF_TYPES_H 39 40 FT_Face face; 41 BDF_Public_Face bdfface; 42 43 44 FT_New_Face( library, ..., &face ); 45 46 bdfface = (BDF_Public_Face)face; 47 48 if ( ( bdfface->charset_registry == "ISO10646" ) && 49 ( bdfface->charset_encoding == "1" ) ) 50 [..] 51 52 53 Thus the driver always exports `ft_encoding_none' as face->charmap.encoding. 54 FT_Get_Char_Index's behavior is unmodified, that is, it converts the ULong 55 value given as argument into the corresponding glyph number. 56 57 If the two properties are not available, Adobe Standard Encoding should be 58 assumed. 59 60 61 Anti-Aliased Bitmaps 62 ******************** 63 64 The driver supports an extension to the BDF format as used in Mark Leisher's 65 xmbdfed bitmap font editor. Microsoft's SBIT tool expects bitmap fonts in 66 that format for adding anti-aliased them to TrueType fonts. It introduces a 67 fourth field to the `SIZE' keyword which gives the bpp value (bits per 68 pixel) of the glyph data in the font. Possible values are 1 (the default), 69 2 (four gray levels), 4 (16 gray levels), and 8 (256 gray levels). The 70 driver returns either a bitmap with 1 bit per pixel or a pixmap with 8bits 71 per pixel (using 4, 16, and 256 gray levels, respectively). 72 73 74 Known problems 75 ************** 76 77 - A font is entirely loaded into memory. Obviously, this is not the Right 78 Thing(TM). If you have big fonts I suggest you convert them into PCF 79 format (using the bdftopcf utility): the PCF font drive of FreeType can 80 perform incremental glyph loading. 81 82 When I have some time, I will implement on-demand glyph parsing. 83 84 - Except for encodings properties, client applications have no visibility of 85 the PCF_Face object. This means that applications cannot directly access 86 font tables and must trust FreeType. 87 88 - Currently, glyph names are ignored. 89 90 I plan to give full visibility of the BDF_Face object in an upcoming 91 revision of the driver, thus implementing also glyph names. 92 93 - As I have never seen a BDF font that defines vertical metrics, vertical 94 metrics are (parsed and) discarded. If you own a BDF font that defines 95 vertical metrics, please let me know (I will implement them in 5-10 96 minutes). 97 98 99 License 100 ******* 101 102 Copyright (C) 2001-2002 by Francesco Zappa Nardelli 103 104 Permission is hereby granted, free of charge, to any person obtaining 105 a copy of this software and associated documentation files (the 106 "Software"), to deal in the Software without restriction, including 107 without limitation the rights to use, copy, modify, merge, publish, 108 distribute, sublicense, and/or sell copies of the Software, and to 109 permit persons to whom the Software is furnished to do so, subject to 110 the following conditions: 111 112 The above copyright notice and this permission notice shall be 113 included in all copies or substantial portions of the Software. 114 115 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 116 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 117 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 118 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 119 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 120 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 121 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 122 123 *** Portions of the driver (that is, bdflib.c and bdf.h): 124 125 Copyright 2000 Computing Research Labs, New Mexico State University 126 Copyright 2001-2002, 2011 Francesco Zappa Nardelli 127 128 Permission is hereby granted, free of charge, to any person obtaining a 129 copy of this software and associated documentation files (the "Software"), 130 to deal in the Software without restriction, including without limitation 131 the rights to use, copy, modify, merge, publish, distribute, sublicense, 132 and/or sell copies of the Software, and to permit persons to whom the 133 Software is furnished to do so, subject to the following conditions: 134 135 The above copyright notice and this permission notice shall be included in 136 all copies or substantial portions of the Software. 137 138 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 139 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 140 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 141 THE COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY BE LIABLE FOR ANY 142 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT 143 OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR 144 THE USE OR OTHER DEALINGS IN THE SOFTWARE. 145 146 147 Credits 148 ******* 149 150 This driver is based on excellent Mark Leisher's bdf library. If you 151 find something good in this driver you should probably thank him, not 152 me.