sdk-world
v2026.11.05
PS2 SDK - world tier (copyleft-allowed, non-essential packages)
Toggle main menu visibility
Loading...
Searching...
No Matches
ftgxval.h
Go to the documentation of this file.
1
/****************************************************************************
2
*
3
* ftgxval.h
4
*
5
* FreeType API for validating TrueTypeGX/AAT tables (specification).
6
*
7
* Copyright (C) 2004-2025 by
8
* Masatake YAMATO, Redhat K.K,
9
* David Turner, Robert Wilhelm, and Werner Lemberg.
10
*
11
* This file is part of the FreeType project, and may only be used,
12
* modified, and distributed under the terms of the FreeType project
13
* license, LICENSE.TXT. By continuing to use, modify, or distribute
14
* this file you indicate that you have read the license and
15
* understand and accept it fully.
16
*
17
*/
18
19
/****************************************************************************
20
*
21
* gxvalid is derived from both gxlayout module and otvalid module.
22
* Development of gxlayout is supported by the Information-technology
23
* Promotion Agency(IPA), Japan.
24
*
25
*/
26
27
32
#ifndef FTGXVAL_H_
33
#define FTGXVAL_H_
34
35
#include <
freetype/freetype.h
>
36
37
#ifdef FREETYPE_H
38
#error "freetype.h of FreeType 1 has been loaded!"
39
#error "Please fix the directory search order for header files"
40
#error "so that freetype.h of FreeType 2 is found first."
41
#endif
42
43
44
FT_BEGIN_HEADER
45
46
47
/**************************************************************************
48
*
49
* @section:
50
* gx_validation
51
*
52
* @title:
53
* TrueTypeGX/AAT Validation
54
*
55
* @abstract:
56
* An API to validate TrueTypeGX/AAT tables.
57
*
58
* @description:
59
* This section contains the declaration of functions to validate some
60
* TrueTypeGX tables (feat, mort, morx, bsln, just, kern, opbd, trak,
61
* prop, lcar).
62
*
63
* @order:
64
* FT_TrueTypeGX_Validate
65
* FT_TrueTypeGX_Free
66
*
67
* FT_ClassicKern_Validate
68
* FT_ClassicKern_Free
69
*
70
* FT_VALIDATE_GX_LENGTH
71
* FT_VALIDATE_GXXXX
72
* FT_VALIDATE_CKERNXXX
73
*
74
*/
75
76
/**************************************************************************
77
*
78
*
79
* Warning: Use `FT_VALIDATE_XXX` to validate a table.
80
* Following definitions are for gxvalid developers.
81
*
82
*
83
*/
84
85
#define FT_VALIDATE_feat_INDEX 0
86
#define FT_VALIDATE_mort_INDEX 1
87
#define FT_VALIDATE_morx_INDEX 2
88
#define FT_VALIDATE_bsln_INDEX 3
89
#define FT_VALIDATE_just_INDEX 4
90
#define FT_VALIDATE_kern_INDEX 5
91
#define FT_VALIDATE_opbd_INDEX 6
92
#define FT_VALIDATE_trak_INDEX 7
93
#define FT_VALIDATE_prop_INDEX 8
94
#define FT_VALIDATE_lcar_INDEX 9
95
#define FT_VALIDATE_GX_LAST_INDEX FT_VALIDATE_lcar_INDEX
96
97
98
/**************************************************************************
99
*
100
* @macro:
101
* FT_VALIDATE_GX_LENGTH
102
*
103
* @description:
104
* The number of tables checked in this module. Use it as a parameter
105
* for the `table-length` argument of function @FT_TrueTypeGX_Validate.
106
*/
107
#define FT_VALIDATE_GX_LENGTH ( FT_VALIDATE_GX_LAST_INDEX + 1 )
108
109
/* */
110
111
/* Up to 0x1000 is used by otvalid.
112
Ox2xxx is reserved for feature OT extension. */
113
#define FT_VALIDATE_GX_START 0x4000
114
#define FT_VALIDATE_GX_BITFIELD( tag ) \
115
( FT_VALIDATE_GX_START << FT_VALIDATE_##tag##_INDEX )
116
117
118
/**************************************************************************
119
*
120
* @enum:
121
* FT_VALIDATE_GXXXX
122
*
123
* @description:
124
* A list of bit-field constants used with @FT_TrueTypeGX_Validate to
125
* indicate which TrueTypeGX/AAT Type tables should be validated.
126
*
127
* @values:
128
* FT_VALIDATE_feat ::
129
* Validate 'feat' table.
130
*
131
* FT_VALIDATE_mort ::
132
* Validate 'mort' table.
133
*
134
* FT_VALIDATE_morx ::
135
* Validate 'morx' table.
136
*
137
* FT_VALIDATE_bsln ::
138
* Validate 'bsln' table.
139
*
140
* FT_VALIDATE_just ::
141
* Validate 'just' table.
142
*
143
* FT_VALIDATE_kern ::
144
* Validate 'kern' table.
145
*
146
* FT_VALIDATE_opbd ::
147
* Validate 'opbd' table.
148
*
149
* FT_VALIDATE_trak ::
150
* Validate 'trak' table.
151
*
152
* FT_VALIDATE_prop ::
153
* Validate 'prop' table.
154
*
155
* FT_VALIDATE_lcar ::
156
* Validate 'lcar' table.
157
*
158
* FT_VALIDATE_GX ::
159
* Validate all TrueTypeGX tables (feat, mort, morx, bsln, just, kern,
160
* opbd, trak, prop and lcar).
161
*
162
*/
163
164
#define FT_VALIDATE_feat FT_VALIDATE_GX_BITFIELD( feat )
165
#define FT_VALIDATE_mort FT_VALIDATE_GX_BITFIELD( mort )
166
#define FT_VALIDATE_morx FT_VALIDATE_GX_BITFIELD( morx )
167
#define FT_VALIDATE_bsln FT_VALIDATE_GX_BITFIELD( bsln )
168
#define FT_VALIDATE_just FT_VALIDATE_GX_BITFIELD( just )
169
#define FT_VALIDATE_kern FT_VALIDATE_GX_BITFIELD( kern )
170
#define FT_VALIDATE_opbd FT_VALIDATE_GX_BITFIELD( opbd )
171
#define FT_VALIDATE_trak FT_VALIDATE_GX_BITFIELD( trak )
172
#define FT_VALIDATE_prop FT_VALIDATE_GX_BITFIELD( prop )
173
#define FT_VALIDATE_lcar FT_VALIDATE_GX_BITFIELD( lcar )
174
175
#define FT_VALIDATE_GX ( FT_VALIDATE_feat | \
176
FT_VALIDATE_mort | \
177
FT_VALIDATE_morx | \
178
FT_VALIDATE_bsln | \
179
FT_VALIDATE_just | \
180
FT_VALIDATE_kern | \
181
FT_VALIDATE_opbd | \
182
FT_VALIDATE_trak | \
183
FT_VALIDATE_prop | \
184
FT_VALIDATE_lcar )
185
186
187
/**************************************************************************
188
*
189
* @function:
190
* FT_TrueTypeGX_Validate
191
*
192
* @description:
193
* Validate various TrueTypeGX tables to assure that all offsets and
194
* indices are valid. The idea is that a higher-level library that
195
* actually does the text layout can access those tables without error
196
* checking (which can be quite time consuming).
197
*
198
* @input:
199
* face ::
200
* A handle to the input face.
201
*
202
* validation_flags ::
203
* A bit field that specifies the tables to be validated. See
204
* @FT_VALIDATE_GXXXX for possible values.
205
*
206
* table_length ::
207
* The size of the `tables` array. Normally, @FT_VALIDATE_GX_LENGTH
208
* should be passed.
209
*
210
* @output:
211
* tables ::
212
* The array where all validated sfnt tables are stored. The array
213
* itself must be allocated by a client.
214
*
215
* @return:
216
* FreeType error code. 0~means success.
217
*
218
* @note:
219
* This function only works with TrueTypeGX fonts, returning an error
220
* otherwise.
221
*
222
* After use, the application should deallocate the buffers pointed to by
223
* each `tables` element, by calling @FT_TrueTypeGX_Free. A `NULL` value
224
* indicates that the table either doesn't exist in the font, the
225
* application hasn't asked for validation, or the validator doesn't have
226
* the ability to validate the sfnt table.
227
*/
228
FT_EXPORT( FT_Error )
229
FT_TrueTypeGX_Validate( FT_Face face,
230
FT_UInt validation_flags,
231
FT_Bytes tables[FT_VALIDATE_GX_LENGTH],
232
FT_UInt table_length );
233
234
235
/**************************************************************************
236
*
237
* @function:
238
* FT_TrueTypeGX_Free
239
*
240
* @description:
241
* Free the buffer allocated by TrueTypeGX validator.
242
*
243
* @input:
244
* face ::
245
* A handle to the input face.
246
*
247
* table ::
248
* The pointer to the buffer allocated by @FT_TrueTypeGX_Validate.
249
*
250
* @note:
251
* This function must be used to free the buffer allocated by
252
* @FT_TrueTypeGX_Validate only.
253
*/
254
FT_EXPORT(
void
)
255
FT_TrueTypeGX_Free( FT_Face face,
256
FT_Bytes table );
257
258
259
/**************************************************************************
260
*
261
* @enum:
262
* FT_VALIDATE_CKERNXXX
263
*
264
* @description:
265
* A list of bit-field constants used with @FT_ClassicKern_Validate to
266
* indicate the classic kern dialect or dialects. If the selected type
267
* doesn't fit, @FT_ClassicKern_Validate regards the table as invalid.
268
*
269
* @values:
270
* FT_VALIDATE_MS ::
271
* Handle the 'kern' table as a classic Microsoft kern table.
272
*
273
* FT_VALIDATE_APPLE ::
274
* Handle the 'kern' table as a classic Apple kern table.
275
*
276
* FT_VALIDATE_CKERN ::
277
* Handle the 'kern' as either classic Apple or Microsoft kern table.
278
*/
279
#define FT_VALIDATE_MS ( FT_VALIDATE_GX_START << 0 )
280
#define FT_VALIDATE_APPLE ( FT_VALIDATE_GX_START << 1 )
281
282
#define FT_VALIDATE_CKERN ( FT_VALIDATE_MS | FT_VALIDATE_APPLE )
283
284
285
/**************************************************************************
286
*
287
* @function:
288
* FT_ClassicKern_Validate
289
*
290
* @description:
291
* Validate classic (16-bit format) kern table to assure that the
292
* offsets and indices are valid. The idea is that a higher-level
293
* library that actually does the text layout can access those tables
294
* without error checking (which can be quite time consuming).
295
*
296
* The 'kern' table validator in @FT_TrueTypeGX_Validate deals with both
297
* the new 32-bit format and the classic 16-bit format, while
298
* FT_ClassicKern_Validate only supports the classic 16-bit format.
299
*
300
* @input:
301
* face ::
302
* A handle to the input face.
303
*
304
* validation_flags ::
305
* A bit field that specifies the dialect to be validated. See
306
* @FT_VALIDATE_CKERNXXX for possible values.
307
*
308
* @output:
309
* ckern_table ::
310
* A pointer to the kern table.
311
*
312
* @return:
313
* FreeType error code. 0~means success.
314
*
315
* @note:
316
* After use, the application should deallocate the buffers pointed to by
317
* `ckern_table`, by calling @FT_ClassicKern_Free. A `NULL` value
318
* indicates that the table doesn't exist in the font.
319
*/
320
FT_EXPORT( FT_Error )
321
FT_ClassicKern_Validate( FT_Face face,
322
FT_UInt validation_flags,
323
FT_Bytes *ckern_table );
324
325
326
/**************************************************************************
327
*
328
* @function:
329
* FT_ClassicKern_Free
330
*
331
* @description:
332
* Free the buffer allocated by classic Kern validator.
333
*
334
* @input:
335
* face ::
336
* A handle to the input face.
337
*
338
* table ::
339
* The pointer to the buffer that is allocated by
340
* @FT_ClassicKern_Validate.
341
*
342
* @note:
343
* This function must be used to free the buffer allocated by
344
* @FT_ClassicKern_Validate only.
345
*/
346
FT_EXPORT(
void
)
347
FT_ClassicKern_Free( FT_Face face,
348
FT_Bytes table );
349
350
/* */
351
352
353
FT_END_HEADER
354
355
#endif
/* FTGXVAL_H_ */
356
357
358
/* END */
freetype.h
freetype
include
freetype
ftgxval.h
Generated by
1.18.0