FreeType font driver for BDF fonts version: 0.0.1 date: January 22, 2001 Francesco Zappa Nardelli Introduction ************ BDF (Bitmap Distribution Format) is a bitmap font format defined by Adobe, which is intended to be easily understood by both humans and computers. This code implements a BDF driver for the FreeType library, following the Adobe Specification V 2.2. For more details concerning the FreeType library, please check out www.freetype.org. The specification of the BDF font format is available from Adobe's web site. http://partners.adobe.com/asn/developer/PDFS/TN/5005.BDF_Spec.pdf Many good bitmap fonts in bdf format come with XFree86 (www.XFree86.org). They do not define vertical metrics, because the X Consortium BDF specification has removed them. Supported hardware ****************** The driver has been tested on linux/x86 and sunos5.5/sparc. In both cases the compiler was gcc. Building ******** You will need: * recent FreeType CVS (I have built it with 26 December 2000 CVS); this is available from http://www.freetype.org. Demo programs are also available, although they are shipped separately. The following instructions assume that the current directory is the toplevel of the FreeType distribution. You will probably need to change the paths given in the examples to match yours. 1. Untar the driver sources: $ cd /usr/local/src/freetype2 $ mv bdftypes.h include/freetype/internal/bdftypes.h $ mv ftdebug.h include/freetype/internal/ftdebug.h $ cd src $ tar -xvf ../bdf.tar In brief, you should add the directory src/bdf and the file include/freetype/internal/bdftypes.h to the freetype source tree. You should also update the ftdebug.h file. 2. Add the following line to the file freetype2/include/freetype/config/ftmodule.h: FT_USE_MODULE(bdf_driver_class) 3. Compile FreeType. Please refer to the INSTALL document for details. $ make setup $ make $ make install The resulting library is believed to be able to deal correctly with bdf fonts (check out the Known Problems section). Encodings ********* The variety of encodings that accompanies bdf fonts appears to encompass the small set defined in freetype.h. On the other hand, two properties that specify encoding and registry are usually defined in bdf fonts. I decided to make these two properties directly accessible, leaving to the client application the work of interpreting them. For instance: #include "pcftypes.h" /* include/freetype/internal/pcftypes.h */ FT_Face face; PCF_Public_Face pcfface; FT_New_Face( library,..., &face ); pcfface = (PCF_Public_Face)face; if ((pcfface->charset_registry == "ISO10646") && (pcfface->charset_encoding) == "1")) [..] Thus the driver always exports ``ft_encoding_none'' as face->charmap.encoding. FT_Get_Char_Index's behavior is unmodified, that is, it converts the ULong value given as argument into the corresponding glyph number. When the two properties are not available, Adobe Standard Encoding should be assumed. Known problems ************** - a font is entirely loaded into memory. Obviously, this is not the Right Thing(TM). If you have big fonts I suggest you convert them into PCF format (using the bdftopcf utility): the PCF font drive of FreeType can perform incremental glyph loading. When I have some time, I will implement on-demand glyph parsing. - except for encodings properties, client applications have no visibility of the PCF_Face object. This means that applications cannot directly access font tables and must trust FreeType. - currently, glyph names are ignored. I plan to give full visibility of the BDF_Face object in the next release of the driver, thus implementing also glyph names. - as I have never seen a BDF font that defines vertical metrics, vertical metrics are (parsed and) discarded. If you own a BDF font that defines vertical metrics, please, let me know (I will implement them in 5-10 minutes). License ******* Copyright (C) 2001 by Francesco Zappa Nardelli Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *** Portions of the driver (that is, bdflib.c and bdf.h): Copyright 2000 Computing Research Labs, New Mexico State University Copyright 2001 Francesco Zappa Nardelli Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Credits ******* This driver is based on excellent Mark Leisher's bdf library. If you find something good in this driver you should probably thank him, not me.