sdk-world v2026.11.05
PS2 SDK - world tier (copyleft-allowed, non-essential packages)
Loading...
Searching...
No Matches
pcf.h
Go to the documentation of this file.
1/* pcf.h
2
3 FreeType font driver for pcf fonts
4
5 Copyright (C) 2000, 2001, 2002, 2003, 2006, 2010 by
6 Francesco Zappa Nardelli
7
8Permission is hereby granted, free of charge, to any person obtaining a copy
9of this software and associated documentation files (the "Software"), to deal
10in the Software without restriction, including without limitation the rights
11to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12copies of the Software, and to permit persons to whom the Software is
13furnished to do so, subject to the following conditions:
14
15The above copyright notice and this permission notice shall be included in
16all copies or substantial portions of the Software.
17
18THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24THE SOFTWARE.
25*/
26
27
32#ifndef PCF_H_
33#define PCF_H_
34
35
38
39
40FT_BEGIN_HEADER
41
42 typedef struct PCF_TableRec_
43 {
44 FT_ULong type;
45 FT_ULong format;
46 FT_ULong size;
47 FT_ULong offset;
48
49 } PCF_TableRec, *PCF_Table;
50
51
52 typedef struct PCF_TocRec_
53 {
54 FT_ULong version;
55 FT_ULong count;
56 PCF_Table tables;
57
58 } PCF_TocRec, *PCF_Toc;
59
60
61 typedef struct PCF_ParsePropertyRec_
62 {
63 FT_Long name;
64 FT_Byte isString;
65 FT_Long value;
66
67 } PCF_ParsePropertyRec, *PCF_ParseProperty;
68
69
70 typedef struct PCF_PropertyRec_
71 {
72 FT_String* name;
73 FT_Byte isString;
74
75 union
76 {
77 FT_String* atom;
78 FT_Long l;
79 FT_ULong ul;
80
81 } value;
82
83 } PCF_PropertyRec, *PCF_Property;
84
85
87 {
88 FT_Byte leftSideBearing;
89 FT_Byte rightSideBearing;
90 FT_Byte characterWidth;
91 FT_Byte ascent;
92 FT_Byte descent;
93
94 } PCF_Compressed_MetricRec, *PCF_Compressed_Metric;
95
96
97 typedef struct PCF_MetricRec_
98 {
99 FT_Short leftSideBearing;
100 FT_Short rightSideBearing;
101 FT_Short characterWidth;
102 FT_Short ascent;
103 FT_Short descent;
104 FT_Short attributes;
105
106 FT_ULong bits; /* offset into the PCF_BITMAPS table */
107
108 } PCF_MetricRec, *PCF_Metric;
109
110
111 typedef struct PCF_EncRec_
112 {
113 FT_UShort firstCol;
114 FT_UShort lastCol;
115 FT_UShort firstRow;
116 FT_UShort lastRow;
117 FT_UShort defaultChar;
118
119 FT_UShort* offset;
120
121 } PCF_EncRec, *PCF_Enc;
122
123
124 typedef struct PCF_AccelRec_
125 {
126 FT_Byte noOverlap;
127 FT_Byte constantMetrics;
128 FT_Byte terminalFont;
129 FT_Byte constantWidth;
130 FT_Byte inkInside;
131 FT_Byte inkMetrics;
132 FT_Byte drawDirection;
133 FT_Long fontAscent;
134 FT_Long fontDescent;
135 FT_Long maxOverlap;
136 PCF_MetricRec minbounds;
137 PCF_MetricRec maxbounds;
138 PCF_MetricRec ink_minbounds;
139 PCF_MetricRec ink_maxbounds;
140
141 } PCF_AccelRec, *PCF_Accel;
142
143
144 /*
145 * This file uses X11 terminology for PCF data; an `encoding' in X11 speak
146 * is the same as a `character code' in FreeType speak.
147 */
148 typedef struct PCF_FaceRec_
149 {
150 FT_FaceRec root;
151
152 FT_StreamRec comp_stream;
153 FT_Stream comp_source;
154
155 char* charset_encoding;
156 char* charset_registry;
157
158 PCF_TocRec toc;
159 PCF_AccelRec accel;
160
161 int nprops;
162 PCF_Property properties;
163
164 FT_ULong nmetrics;
165 PCF_Metric metrics;
166
167 PCF_EncRec enc;
168
169 FT_ULong bitmapsFormat;
170
171 } PCF_FaceRec, *PCF_Face;
172
173
174 typedef struct PCF_DriverRec_
175 {
176 FT_DriverRec root;
177
178 FT_Bool no_long_family_names;
179
180 } PCF_DriverRec, *PCF_Driver;
181
182
183 /* macros for pcf font format */
184
185#define LSBFirst 0
186#define MSBFirst 1
187
188#define PCF_FILE_VERSION ( ( 'p' << 24 ) | \
189 ( 'c' << 16 ) | \
190 ( 'f' << 8 ) | 1 )
191#define PCF_FORMAT_MASK 0xFFFFFF00UL
192
193#define PCF_DEFAULT_FORMAT 0x00000000UL
194#define PCF_INKBOUNDS 0x00000200UL
195#define PCF_ACCEL_W_INKBOUNDS 0x00000100UL
196#define PCF_COMPRESSED_METRICS 0x00000100UL
197
198#define PCF_FORMAT_MATCH( a, b ) \
199 ( ( (a) & PCF_FORMAT_MASK ) == ( (b) & PCF_FORMAT_MASK ) )
200
201#define PCF_GLYPH_PAD_MASK ( 3 << 0 )
202#define PCF_BYTE_MASK ( 1 << 2 )
203#define PCF_BIT_MASK ( 1 << 3 )
204#define PCF_SCAN_UNIT_MASK ( 3 << 4 )
205
206#define PCF_BYTE_ORDER( f ) \
207 ( ( (f) & PCF_BYTE_MASK ) ? MSBFirst : LSBFirst )
208#define PCF_BIT_ORDER( f ) \
209 ( ( (f) & PCF_BIT_MASK ) ? MSBFirst : LSBFirst )
210#define PCF_GLYPH_PAD_INDEX( f ) \
211 ( (f) & PCF_GLYPH_PAD_MASK )
212#define PCF_GLYPH_PAD( f ) \
213 ( 1 << PCF_GLYPH_PAD_INDEX( f ) )
214#define PCF_SCAN_UNIT_INDEX( f ) \
215 ( ( (f) & PCF_SCAN_UNIT_MASK ) >> 4 )
216#define PCF_SCAN_UNIT( f ) \
217 ( 1 << PCF_SCAN_UNIT_INDEX( f ) )
218#define PCF_FORMAT_BITS( f ) \
219 ( (f) & ( PCF_GLYPH_PAD_MASK | \
220 PCF_BYTE_MASK | \
221 PCF_BIT_MASK | \
222 PCF_SCAN_UNIT_MASK ) )
223
224#define PCF_SIZE_TO_INDEX( s ) ( (s) == 4 ? 2 : (s) == 2 ? 1 : 0 )
225#define PCF_INDEX_TO_SIZE( b ) ( 1 << b )
226
227#define PCF_FORMAT( bit, byte, glyph, scan ) \
228 ( ( PCF_SIZE_TO_INDEX( scan ) << 4 ) | \
229 ( ( (bit) == MSBFirst ? 1 : 0 ) << 3 ) | \
230 ( ( (byte) == MSBFirst ? 1 : 0 ) << 2 ) | \
231 ( PCF_SIZE_TO_INDEX( glyph ) << 0 ) )
232
233#define PCF_PROPERTIES ( 1 << 0 )
234#define PCF_ACCELERATORS ( 1 << 1 )
235#define PCF_METRICS ( 1 << 2 )
236#define PCF_BITMAPS ( 1 << 3 )
237#define PCF_INK_METRICS ( 1 << 4 )
238#define PCF_BDF_ENCODINGS ( 1 << 5 )
239#define PCF_SWIDTHS ( 1 << 6 )
240#define PCF_GLYPH_NAMES ( 1 << 7 )
241#define PCF_BDF_ACCELERATORS ( 1 << 8 )
242
243#define GLYPHPADOPTIONS 4 /* I'm not sure about this */
244
245 FT_LOCAL( FT_Error )
246 pcf_load_font( FT_Stream stream,
247 PCF_Face face,
248 FT_Long face_index );
249
250FT_END_HEADER
251
252#endif /* PCF_H_ */
253
254
255/* END */