1
/***************************************************************************/
5
/* FreeType API for validating TrueTypeGX/AAT tables (specification). */
7
/* Copyright 2004, 2005, 2006 by */
8
/* Masatake YAMATO, Redhat K.K, */
9
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
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. */
17
/***************************************************************************/
19
/***************************************************************************/
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. */
25
/***************************************************************************/
32
#include FT_FREETYPE_H
35
#error "freetype.h of FreeType 1 has been loaded!"
36
#error "Please fix the directory search order for header files"
37
#error "so that freetype.h of FreeType 2 is found first."
44
/*************************************************************************/
50
/* TrueTypeGX/AAT Validation */
53
/* An API to validate TrueTypeGX/AAT tables. */
56
/* This section contains the declaration of functions to validate */
57
/* some TrueTypeGX tables (feat, mort, morx, bsln, just, kern, opbd, */
58
/* trak, prop, lcar). */
60
/*************************************************************************/
63
/*************************************************************************/
66
/* Warning: Use FT_VALIDATE_XXX to validate a table. */
67
/* Following definitions are for gxvalid developers. */
70
/*************************************************************************/
72
#define FT_VALIDATE_feat_INDEX 0
73
#define FT_VALIDATE_mort_INDEX 1
74
#define FT_VALIDATE_morx_INDEX 2
75
#define FT_VALIDATE_bsln_INDEX 3
76
#define FT_VALIDATE_just_INDEX 4
77
#define FT_VALIDATE_kern_INDEX 5
78
#define FT_VALIDATE_opbd_INDEX 6
79
#define FT_VALIDATE_trak_INDEX 7
80
#define FT_VALIDATE_prop_INDEX 8
81
#define FT_VALIDATE_lcar_INDEX 9
82
#define FT_VALIDATE_GX_LAST_INDEX FT_VALIDATE_lcar_INDEX
85
/*************************************************************************
88
* FT_VALIDATE_GX_LENGTH
91
* The number of tables checked in this module. Use it as a parameter
92
* for the `table-length' argument of function @FT_TrueTypeGX_Validate.
94
#define FT_VALIDATE_GX_LENGTH (FT_VALIDATE_GX_LAST_INDEX + 1)
98
/* Up to 0x1000 is used by otvalid.
99
Ox2xxx is reserved for feature OT extension. */
100
#define FT_VALIDATE_GX_START 0x4000
101
#define FT_VALIDATE_GX_BITFIELD( tag ) \
102
( FT_VALIDATE_GX_START << FT_VALIDATE_##tag##_INDEX )
105
/**********************************************************************
111
* A list of bit-field constants used with @FT_TrueTypeGX_Validate to
112
* indicate which TrueTypeGX/AAT Type tables should be validated.
115
* FT_VALIDATE_feat ::
116
* Validate `feat' table.
118
* FT_VALIDATE_mort ::
119
* Validate `mort' table.
121
* FT_VALIDATE_morx ::
122
* Validate `morx' table.
124
* FT_VALIDATE_bsln ::
125
* Validate `bsln' table.
127
* FT_VALIDATE_just ::
128
* Validate `just' table.
130
* FT_VALIDATE_kern ::
131
* Validate `kern' table.
133
* FT_VALIDATE_opbd ::
134
* Validate `opbd' table.
136
* FT_VALIDATE_trak ::
137
* Validate `trak' table.
139
* FT_VALIDATE_prop ::
140
* Validate `prop' table.
142
* FT_VALIDATE_lcar ::
143
* Validate `lcar' table.
146
* Validate all TrueTypeGX tables (feat, mort, morx, bsln, just, kern,
147
* opbd, trak, prop and lcar).
151
#define FT_VALIDATE_feat FT_VALIDATE_GX_BITFIELD( feat )
152
#define FT_VALIDATE_mort FT_VALIDATE_GX_BITFIELD( mort )
153
#define FT_VALIDATE_morx FT_VALIDATE_GX_BITFIELD( morx )
154
#define FT_VALIDATE_bsln FT_VALIDATE_GX_BITFIELD( bsln )
155
#define FT_VALIDATE_just FT_VALIDATE_GX_BITFIELD( just )
156
#define FT_VALIDATE_kern FT_VALIDATE_GX_BITFIELD( kern )
157
#define FT_VALIDATE_opbd FT_VALIDATE_GX_BITFIELD( opbd )
158
#define FT_VALIDATE_trak FT_VALIDATE_GX_BITFIELD( trak )
159
#define FT_VALIDATE_prop FT_VALIDATE_GX_BITFIELD( prop )
160
#define FT_VALIDATE_lcar FT_VALIDATE_GX_BITFIELD( lcar )
162
#define FT_VALIDATE_GX ( FT_VALIDATE_feat | \
176
/**********************************************************************
179
* FT_TrueTypeGX_Validate
182
* Validate various TrueTypeGX tables to assure that all offsets and
183
* indices are valid. The idea is that a higher-level library which
184
* actually does the text layout can access those tables without
185
* error checking (which can be quite time consuming).
189
* A handle to the input face.
191
* validation_flags ::
192
* A bit field which specifies the tables to be validated. See
193
* @FT_VALIDATE_GXXXX for possible values.
196
* The size of the `tables' array. Normally, @FT_VALIDATE_GX_LENGTH
201
* The array where all validated sfnt tables are stored.
202
* The array itself must be allocated by a client.
205
* FreeType error code. 0~means success.
208
* This function only works with TrueTypeGX fonts, returning an error
211
* After use, the application should deallocate the buffers pointed to by
212
* each `tables' element, by calling @FT_TrueTypeGX_Free. A NULL value
213
* indicates that the table either doesn't exist in the font, the
214
* application hasn't asked for validation, or the validator doesn't have
215
* the ability to validate the sfnt table.
217
FT_EXPORT( FT_Error )
218
FT_TrueTypeGX_Validate( FT_Face face,
219
FT_UInt validation_flags,
220
FT_Bytes tables[FT_VALIDATE_GX_LENGTH],
221
FT_UInt table_length );
226
/**********************************************************************
232
* Free the buffer allocated by TrueTypeGX validator.
236
* A handle to the input face.
239
* The pointer to the buffer allocated by
240
* @FT_TrueTypeGX_Validate.
243
* This function must be used to free the buffer allocated by
244
* @FT_TrueTypeGX_Validate only.
247
FT_TrueTypeGX_Free( FT_Face face,
253
/**********************************************************************
256
* FT_VALIDATE_CKERNXXX
259
* A list of bit-field constants used with @FT_ClassicKern_Validate
260
* to indicate the classic kern dialect or dialects. If the selected
261
* type doesn't fit, @FT_ClassicKern_Validate regards the table as
266
* Handle the `kern' table as a classic Microsoft kern table.
268
* FT_VALIDATE_APPLE ::
269
* Handle the `kern' table as a classic Apple kern table.
271
* FT_VALIDATE_CKERN ::
272
* Handle the `kern' as either classic Apple or Microsoft kern table.
274
#define FT_VALIDATE_MS ( FT_VALIDATE_GX_START << 0 )
275
#define FT_VALIDATE_APPLE ( FT_VALIDATE_GX_START << 1 )
277
#define FT_VALIDATE_CKERN ( FT_VALIDATE_MS | FT_VALIDATE_APPLE )
282
/**********************************************************************
285
* FT_ClassicKern_Validate
288
* Validate classic (16-bit format) kern table to assure that the offsets
289
* and indices are valid. The idea is that a higher-level library which
290
* actually does the text layout can access those tables without error
291
* checking (which can be quite time consuming).
293
* The `kern' table validator in @FT_TrueTypeGX_Validate deals with both
294
* the new 32-bit format and the classic 16-bit format, while
295
* FT_ClassicKern_Validate only supports the classic 16-bit format.
299
* A handle to the input face.
301
* validation_flags ::
302
* A bit field which specifies the dialect to be validated. See
303
* @FT_VALIDATE_CKERNXXX for possible values.
307
* A pointer to the kern table.
310
* FreeType error code. 0~means success.
313
* After use, the application should deallocate the buffers pointed to by
314
* `ckern_table', by calling @FT_ClassicKern_Free. A NULL value
315
* indicates that the table doesn't exist in the font.
317
FT_EXPORT( FT_Error )
318
FT_ClassicKern_Validate( FT_Face face,
319
FT_UInt validation_flags,
320
FT_Bytes *ckern_table );
325
/**********************************************************************
328
* FT_ClassicKern_Free
331
* Free the buffer allocated by classic Kern validator.
335
* A handle to the input face.
338
* The pointer to the buffer that is allocated by
339
* @FT_ClassicKern_Validate.
342
* This function must be used to free the buffer allocated by
343
* @FT_ClassicKern_Validate only.
346
FT_ClassicKern_Free( FT_Face face,
355
#endif /* __FTGXVAL_H__ */