3
FreeType font driver for pcf fonts
5
Copyright (C) 2000, 2001, 2002, 2003 by
6
Francesco Zappa Nardelli
8
Permission is hereby granted, free of charge, to any person obtaining a copy
9
of this software and associated documentation files (the "Software"), to deal
10
in the Software without restriction, including without limitation the rights
11
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
copies of the Software, and to permit persons to whom the Software is
13
furnished to do so, subject to the following conditions:
15
The above copyright notice and this permission notice shall be included in
16
all copies or substantial portions of the Software.
18
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
33
#include FT_INTERNAL_DRIVER_H
34
#include FT_INTERNAL_STREAM_H
39
typedef struct PCF_TableRec_
46
} PCF_TableRec, *PCF_Table;
49
typedef struct PCF_TocRec_
55
} PCF_TocRec, *PCF_Toc;
58
typedef struct PCF_ParsePropertyRec_
64
} PCF_ParsePropertyRec, *PCF_ParseProperty;
67
typedef struct PCF_PropertyRec_
80
} PCF_PropertyRec, *PCF_Property;
83
typedef struct PCF_Compressed_MetricRec_
85
FT_Byte leftSideBearing;
86
FT_Byte rightSideBearing;
87
FT_Byte characterWidth;
91
} PCF_Compressed_MetricRec, *PCF_Compressed_Metric;
94
typedef struct PCF_MetricRec_
96
FT_Short leftSideBearing;
97
FT_Short rightSideBearing;
98
FT_Short characterWidth;
104
} PCF_MetricRec, *PCF_Metric;
107
typedef struct PCF_AccelRec_
110
FT_Byte constantMetrics;
111
FT_Byte terminalFont;
112
FT_Byte constantWidth;
115
FT_Byte drawDirection;
119
PCF_MetricRec minbounds;
120
PCF_MetricRec maxbounds;
121
PCF_MetricRec ink_minbounds;
122
PCF_MetricRec ink_maxbounds;
124
} PCF_AccelRec, *PCF_Accel;
127
typedef struct PCF_EncodingRec_
132
} PCF_EncodingRec, *PCF_Encoding;
135
typedef struct PCF_FaceRec_
139
FT_StreamRec gzip_stream;
140
FT_Stream gzip_source;
142
char* charset_encoding;
143
char* charset_registry;
149
PCF_Property properties;
154
PCF_Encoding encodings;
156
FT_Short defaultChar;
158
FT_ULong bitmapsFormat;
160
FT_CharMap charmap_handle;
161
FT_CharMapRec charmap; /* a single charmap per face */
163
} PCF_FaceRec, *PCF_Face;
166
/* macros for pcf font format */
171
#define PCF_FILE_VERSION ( ( 'p' << 24 ) | \
174
#define PCF_FORMAT_MASK 0xFFFFFF00L
176
#define PCF_DEFAULT_FORMAT 0x00000000L
177
#define PCF_INKBOUNDS 0x00000200L
178
#define PCF_ACCEL_W_INKBOUNDS 0x00000100L
179
#define PCF_COMPRESSED_METRICS 0x00000100L
181
#define PCF_FORMAT_MATCH( a, b ) \
182
( ( (a) & PCF_FORMAT_MASK ) == ( (b) & PCF_FORMAT_MASK ) )
184
#define PCF_GLYPH_PAD_MASK ( 3 << 0 )
185
#define PCF_BYTE_MASK ( 1 << 2 )
186
#define PCF_BIT_MASK ( 1 << 3 )
187
#define PCF_SCAN_UNIT_MASK ( 3 << 4 )
189
#define PCF_BYTE_ORDER( f ) \
190
( ( (f) & PCF_BYTE_MASK ) ? MSBFirst : LSBFirst )
191
#define PCF_BIT_ORDER( f ) \
192
( ( (f) & PCF_BIT_MASK ) ? MSBFirst : LSBFirst )
193
#define PCF_GLYPH_PAD_INDEX( f ) \
194
( (f) & PCF_GLYPH_PAD_MASK )
195
#define PCF_GLYPH_PAD( f ) \
196
( 1 << PCF_GLYPH_PAD_INDEX( f ) )
197
#define PCF_SCAN_UNIT_INDEX( f ) \
198
( ( (f) & PCF_SCAN_UNIT_MASK ) >> 4 )
199
#define PCF_SCAN_UNIT( f ) \
200
( 1 << PCF_SCAN_UNIT_INDEX( f ) )
201
#define PCF_FORMAT_BITS( f ) \
202
( (f) & ( PCF_GLYPH_PAD_MASK | \
205
PCF_SCAN_UNIT_MASK ) )
207
#define PCF_SIZE_TO_INDEX( s ) ( (s) == 4 ? 2 : (s) == 2 ? 1 : 0 )
208
#define PCF_INDEX_TO_SIZE( b ) ( 1 << b )
210
#define PCF_FORMAT( bit, byte, glyph, scan ) \
211
( ( PCF_SIZE_TO_INDEX( scan ) << 4 ) | \
212
( ( (bit) == MSBFirst ? 1 : 0 ) << 3 ) | \
213
( ( (byte) == MSBFirst ? 1 : 0 ) << 2 ) | \
214
( PCF_SIZE_TO_INDEX( glyph ) << 0 ) )
216
#define PCF_PROPERTIES ( 1 << 0 )
217
#define PCF_ACCELERATORS ( 1 << 1 )
218
#define PCF_METRICS ( 1 << 2 )
219
#define PCF_BITMAPS ( 1 << 3 )
220
#define PCF_INK_METRICS ( 1 << 4 )
221
#define PCF_BDF_ENCODINGS ( 1 << 5 )
222
#define PCF_SWIDTHS ( 1 << 6 )
223
#define PCF_GLYPH_NAMES ( 1 << 7 )
224
#define PCF_BDF_ACCELERATORS ( 1 << 8 )
226
#define GLYPHPADOPTIONS 4 /* I'm not sure about this */
229
pcf_load_font( FT_Stream,
234
#endif /* __PCF_H__ */