Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

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