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