sdk-world v2026.11.05
PS2 SDK - world tier (copyleft-allowed, non-essential packages)
Loading...
Searching...
No Matches
pfrtypes.h
Go to the documentation of this file.
1/****************************************************************************
2 *
3 * pfrtypes.h
4 *
5 * FreeType PFR data structures (specification only).
6 *
7 * Copyright (C) 2002-2025 by
8 * David Turner, Robert Wilhelm, and Werner Lemberg.
9 *
10 * This file is part of the FreeType project, and may only be used,
11 * modified, and distributed under the terms of the FreeType project
12 * license, LICENSE.TXT. By continuing to use, modify, or distribute
13 * this file you indicate that you have read the license and
14 * understand and accept it fully.
15 *
16 */
17
18
23#ifndef PFRTYPES_H_
24#define PFRTYPES_H_
25
27
28FT_BEGIN_HEADER
29
30 /************************************************************************/
31
32 /* the PFR Header structure */
33 typedef struct PFR_HeaderRec_
34 {
35 FT_UInt32 signature;
36 FT_UInt version;
37 FT_UInt signature2;
38 FT_UInt header_size;
39
40 FT_UInt log_dir_size;
41 FT_UInt log_dir_offset;
42
43 FT_UInt log_font_max_size;
44 FT_UInt32 log_font_section_size;
45 FT_UInt32 log_font_section_offset;
46
47 FT_UInt32 phy_font_max_size;
48 FT_UInt32 phy_font_section_size;
49 FT_UInt32 phy_font_section_offset;
50
51 FT_UInt gps_max_size;
52 FT_UInt32 gps_section_size;
53 FT_UInt32 gps_section_offset;
54
55 FT_UInt max_blue_values;
56 FT_UInt max_x_orus;
57 FT_UInt max_y_orus;
58
59 FT_UInt phy_font_max_size_high;
60 FT_UInt color_flags;
61
62 FT_UInt32 bct_max_size;
63 FT_UInt32 bct_set_max_size;
64 FT_UInt32 phy_bct_set_max_size;
65
66 FT_UInt num_phy_fonts;
67 FT_UInt max_vert_stem_snap;
68 FT_UInt max_horz_stem_snap;
69 FT_UInt max_chars;
70
71 } PFR_HeaderRec, *PFR_Header;
72
73
74 /* used in `color_flags' field of the PFR_Header */
75#define PFR_FLAG_BLACK_PIXEL 0x01U
76#define PFR_FLAG_INVERT_BITMAP 0x02U
77
78
79 /************************************************************************/
80
81 typedef struct PFR_LogFontRec_
82 {
83 FT_UInt32 size;
84 FT_UInt32 offset;
85
86 FT_Int32 matrix[4];
87 FT_UInt stroke_flags;
88 FT_Int stroke_thickness;
89 FT_Int bold_thickness;
90 FT_Int32 miter_limit;
91
92 FT_UInt32 phys_size;
93 FT_UInt32 phys_offset;
94
95 } PFR_LogFontRec, *PFR_LogFont;
96
97
98#define PFR_LINE_JOIN_MITER 0x00U
99#define PFR_LINE_JOIN_ROUND 0x01U
100#define PFR_LINE_JOIN_BEVEL 0x02U
101#define PFR_LINE_JOIN_MASK ( PFR_LINE_JOIN_ROUND | PFR_LINE_JOIN_BEVEL )
102
103#define PFR_LOG_STROKE 0x04U
104#define PFR_LOG_2BYTE_STROKE 0x08U
105#define PFR_LOG_BOLD 0x10U
106#define PFR_LOG_2BYTE_BOLD 0x20U
107#define PFR_LOG_EXTRA_ITEMS 0x40U
108
109
110 /************************************************************************/
111
112#define PFR_BITMAP_2BYTE_CHARCODE 0x01U
113#define PFR_BITMAP_2BYTE_SIZE 0x02U
114#define PFR_BITMAP_3BYTE_OFFSET 0x04U
115
116 /* not part of the specification but used for implementation */
117#define PFR_BITMAP_CHARCODES_VALIDATED 0x40U
118#define PFR_BITMAP_VALID_CHARCODES 0x80U
119
120
121 typedef struct PFR_BitmapCharRec_
122 {
123 FT_UInt char_code;
124 FT_UInt gps_size;
125 FT_UInt32 gps_offset;
126
127 } PFR_BitmapCharRec, *PFR_BitmapChar;
128
129
130#define PFR_STRIKE_2BYTE_XPPM 0x01U
131#define PFR_STRIKE_2BYTE_YPPM 0x02U
132#define PFR_STRIKE_3BYTE_SIZE 0x04U
133#define PFR_STRIKE_3BYTE_OFFSET 0x08U
134#define PFR_STRIKE_2BYTE_COUNT 0x10U
135
136
137 typedef struct PFR_StrikeRec_
138 {
139 FT_UInt x_ppm;
140 FT_UInt y_ppm;
141 FT_UInt flags;
142
143 FT_UInt32 gps_size;
144 FT_UInt32 gps_offset;
145
146 FT_UInt32 bct_size;
147 FT_UInt32 bct_offset;
148
149 /* optional */
150 FT_UInt num_bitmaps;
151 PFR_BitmapChar bitmaps;
152
153 } PFR_StrikeRec, *PFR_Strike;
154
155
156 /************************************************************************/
157
158 typedef struct PFR_CharRec_
159 {
160 FT_UInt char_code;
161 FT_Int advance;
162 FT_UInt gps_size;
163 FT_UInt32 gps_offset;
164
165 } PFR_CharRec, *PFR_Char;
166
167
168 /************************************************************************/
169
170 typedef struct PFR_DimensionRec_
171 {
172 FT_UInt standard;
173 FT_UInt num_stem_snaps;
174 FT_Int* stem_snaps;
175
176 } PFR_DimensionRec, *PFR_Dimension;
177
178 /************************************************************************/
179
180 typedef struct PFR_KernItemRec_* PFR_KernItem;
181
182 typedef struct PFR_KernItemRec_
183 {
184 PFR_KernItem next;
185 FT_Byte pair_count;
186 FT_Byte flags;
187 FT_Short base_adj;
188 FT_UInt pair_size;
189 FT_Offset offset;
190 FT_UInt32 pair1;
191 FT_UInt32 pair2;
192
193 } PFR_KernItemRec;
194
195
196#define PFR_KERN_INDEX( g1, g2 ) \
197 ( ( (FT_UInt32)(g1) << 16 ) | (FT_UInt16)(g2) )
198
199#define PFR_KERN_PAIR_INDEX( pair ) \
200 PFR_KERN_INDEX( (pair)->glyph1, (pair)->glyph2 )
201
202#define PFR_NEXT_KPAIR( p ) ( p += 2, \
203 ( (FT_UInt32)p[-2] << 16 ) | p[-1] )
204
205
206 /************************************************************************/
207
208 typedef struct PFR_PhyFontRec_
209 {
210 FT_Memory memory;
211 FT_UInt32 offset;
212
213 FT_UInt font_ref_number;
214 FT_UInt outline_resolution;
215 FT_UInt metrics_resolution;
216 FT_BBox bbox;
217 FT_UInt flags;
218 FT_Int standard_advance;
219
220 FT_Int ascent; /* optional, bbox.yMax if not present */
221 FT_Int descent; /* optional, bbox.yMin if not present */
222 FT_Int leading; /* optional, 0 if not present */
223
224 PFR_DimensionRec horizontal;
225 PFR_DimensionRec vertical;
226
227 FT_String* font_id;
228 FT_String* family_name;
229 FT_String* style_name;
230
231 FT_UInt num_strikes;
232 FT_UInt max_strikes;
233 PFR_StrikeRec* strikes;
234
235 FT_UInt num_blue_values;
236 FT_Int *blue_values;
237 FT_UInt blue_fuzz;
238 FT_UInt blue_scale;
239
240 FT_UInt num_chars;
241 FT_Offset chars_offset;
242 PFR_Char chars;
243
244 FT_UInt num_kern_pairs;
245 PFR_KernItem kern_items;
246 PFR_KernItem* kern_items_tail;
247
248 /* not part of the spec, but used during load */
249 FT_ULong bct_offset;
250 FT_Byte* cursor;
251
252 } PFR_PhyFontRec, *PFR_PhyFont;
253
254
255#define PFR_PHY_VERTICAL 0x01U
256#define PFR_PHY_2BYTE_CHARCODE 0x02U
257#define PFR_PHY_PROPORTIONAL 0x04U
258#define PFR_PHY_ASCII_CODE 0x08U
259#define PFR_PHY_2BYTE_GPS_SIZE 0x10U
260#define PFR_PHY_3BYTE_GPS_OFFSET 0x20U
261#define PFR_PHY_EXTRA_ITEMS 0x80U
262
263
264#define PFR_KERN_2BYTE_CHAR 0x01U
265#define PFR_KERN_2BYTE_ADJ 0x02U
266
267
268 /************************************************************************/
269
270#define PFR_GLYPH_YCOUNT 0x01U
271#define PFR_GLYPH_XCOUNT 0x02U
272#define PFR_GLYPH_1BYTE_XYCOUNT 0x04U
273
274#define PFR_GLYPH_SINGLE_EXTRA_ITEMS 0x08U
275#define PFR_GLYPH_COMPOUND_EXTRA_ITEMS 0x40U
276
277#define PFR_GLYPH_IS_COMPOUND 0x80U
278
279
280 /* controlled coordinate */
281 typedef struct PFR_CoordRec_
282 {
283 FT_UInt org;
284 FT_UInt cur;
285
286 } PFR_CoordRec, *PFR_Coord;
287
288
289 typedef struct PFR_SubGlyphRec_
290 {
291 FT_Fixed x_scale;
292 FT_Fixed y_scale;
293 FT_Int x_delta;
294 FT_Int y_delta;
295 FT_UInt32 gps_offset;
296 FT_UInt gps_size;
297
298 } PFR_SubGlyphRec, *PFR_SubGlyph;
299
300
301#define PFR_SUBGLYPH_XSCALE 0x10U
302#define PFR_SUBGLYPH_YSCALE 0x20U
303#define PFR_SUBGLYPH_2BYTE_SIZE 0x40U
304#define PFR_SUBGLYPH_3BYTE_OFFSET 0x80U
305
306
307 typedef struct PFR_GlyphRec_
308 {
309 FT_Byte format;
310
311#if 0
312 FT_UInt num_x_control;
313 FT_UInt num_y_control;
314#endif
315 FT_UInt max_xy_control;
316 FT_Pos* x_control;
317 FT_Pos* y_control;
318
319
320 FT_UInt num_subs;
321 FT_UInt max_subs;
322 PFR_SubGlyphRec* subs;
323
324 FT_GlyphLoader loader;
325 FT_Bool path_begun;
326
327 } PFR_GlyphRec, *PFR_Glyph;
328
329
330FT_END_HEADER
331
332#endif /* PFRTYPES_H_ */
333
334
335/* END */