1 | /***************************************************************************/
|
---|
2 | /* */
|
---|
3 | /* ftgxval.h */
|
---|
4 | /* */
|
---|
5 | /* FreeType API for validating TrueTypeGX/AAT tables (specification). */
|
---|
6 | /* */
|
---|
7 | /* Copyright 2004, 2005 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 |
|
---|
28 | #ifndef __FTGXVAL_H__
|
---|
29 | #define __FTGXVAL_H__
|
---|
30 |
|
---|
31 | #include <ft2build.h>
|
---|
32 | #include FT_FREETYPE_H
|
---|
33 |
|
---|
34 | #ifdef 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."
|
---|
38 | #endif
|
---|
39 |
|
---|
40 |
|
---|
41 | FT_BEGIN_HEADER
|
---|
42 |
|
---|
43 |
|
---|
44 | /*************************************************************************/
|
---|
45 | /* */
|
---|
46 | /* <Section> */
|
---|
47 | /* gx_validation */
|
---|
48 | /* */
|
---|
49 | /* <Title> */
|
---|
50 | /* TrueTypeGX/AAT Validation */
|
---|
51 | /* */
|
---|
52 | /* <Abstract> */
|
---|
53 | /* An API to validate TrueTypeGX/AAT tables. */
|
---|
54 | /* */
|
---|
55 | /* <Description> */
|
---|
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). */
|
---|
59 | /* */
|
---|
60 | /*************************************************************************/
|
---|
61 |
|
---|
62 |
|
---|
63 | /*************************************************************************/
|
---|
64 | /* */
|
---|
65 | /* */
|
---|
66 | /* Warning: Use FT_VALIDATE_XXX to validate a table. */
|
---|
67 | /* Following definitions are for gxvalid developers. */
|
---|
68 | /* */
|
---|
69 | /* */
|
---|
70 | /*************************************************************************/
|
---|
71 |
|
---|
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
|
---|
83 | #define FT_VALIDATE_GX_LENGTH (FT_VALIDATE_GX_LAST_INDEX + 1)
|
---|
84 |
|
---|
85 | /* Up to 0x1000 is used by otvalid.
|
---|
86 | Ox2xxx is reserved for feature OT extension. */
|
---|
87 | #define FT_VALIDATE_GX_START 0x4000
|
---|
88 | #define FT_VALIDATE_GX_BITFIELD( tag ) \
|
---|
89 | ( FT_VALIDATE_GX_START << FT_VALIDATE_##tag##_INDEX )
|
---|
90 |
|
---|
91 |
|
---|
92 | /**********************************************************************
|
---|
93 | *
|
---|
94 | * @enum:
|
---|
95 | * FT_VALIDATE_GXXXX
|
---|
96 | *
|
---|
97 | * @description:
|
---|
98 | * A list of bit-field constants used with @FT_TrueTypeGX_Validate to
|
---|
99 | * indicate which TrueTypeGX/AAT Type tables should be validated.
|
---|
100 | *
|
---|
101 | * @values:
|
---|
102 | * FT_VALIDATE_feat ::
|
---|
103 | * Validate `feat' table.
|
---|
104 | *
|
---|
105 | * @values:
|
---|
106 | * FT_VALIDATE_mort ::
|
---|
107 | * Validate `mort' table.
|
---|
108 | *
|
---|
109 | * @values:
|
---|
110 | * FT_VALIDATE_morx ::
|
---|
111 | * Validate `morx' table.
|
---|
112 | *
|
---|
113 | * @values:
|
---|
114 | * FT_VALIDATE_bsln ::
|
---|
115 | * Validate `bsln' table.
|
---|
116 | *
|
---|
117 | * @values:
|
---|
118 | * FT_VALIDATE_just ::
|
---|
119 | * Validate `just' table.
|
---|
120 | *
|
---|
121 | * @values:
|
---|
122 | * FT_VALIDATE_kern ::
|
---|
123 | * Validate `kern' table.
|
---|
124 | *
|
---|
125 | * @values:
|
---|
126 | * FT_VALIDATE_opbd ::
|
---|
127 | * Validate `opbd' table.
|
---|
128 | *
|
---|
129 | * @values:
|
---|
130 | * FT_VALIDATE_trak ::
|
---|
131 | * Validate `trak' table.
|
---|
132 | *
|
---|
133 | * @values:
|
---|
134 | * FT_VALIDATE_prop ::
|
---|
135 | * Validate `prop' table.
|
---|
136 | *
|
---|
137 | * @values:
|
---|
138 | * FT_VALIDATE_lcar ::
|
---|
139 | * Validate `lcar' table.
|
---|
140 | *
|
---|
141 | * @values:
|
---|
142 | * FT_VALIDATE_GX ::
|
---|
143 | * Validate all TrueTypeGX tables (feat, mort, morx, bsln, just, kern,
|
---|
144 | * opbd, trak, prop and lcar).
|
---|
145 | *
|
---|
146 | */
|
---|
147 |
|
---|
148 | #define FT_VALIDATE_feat FT_VALIDATE_GX_BITFIELD( feat )
|
---|
149 | #define FT_VALIDATE_mort FT_VALIDATE_GX_BITFIELD( mort )
|
---|
150 | #define FT_VALIDATE_morx FT_VALIDATE_GX_BITFIELD( morx )
|
---|
151 | #define FT_VALIDATE_bsln FT_VALIDATE_GX_BITFIELD( bsln )
|
---|
152 | #define FT_VALIDATE_just FT_VALIDATE_GX_BITFIELD( just )
|
---|
153 | #define FT_VALIDATE_kern FT_VALIDATE_GX_BITFIELD( kern )
|
---|
154 | #define FT_VALIDATE_opbd FT_VALIDATE_GX_BITFIELD( opbd )
|
---|
155 | #define FT_VALIDATE_trak FT_VALIDATE_GX_BITFIELD( trak )
|
---|
156 | #define FT_VALIDATE_prop FT_VALIDATE_GX_BITFIELD( prop )
|
---|
157 | #define FT_VALIDATE_lcar FT_VALIDATE_GX_BITFIELD( lcar )
|
---|
158 |
|
---|
159 | #define FT_VALIDATE_GX ( FT_VALIDATE_feat | \
|
---|
160 | FT_VALIDATE_mort | \
|
---|
161 | FT_VALIDATE_morx | \
|
---|
162 | FT_VALIDATE_bsln | \
|
---|
163 | FT_VALIDATE_just | \
|
---|
164 | FT_VALIDATE_kern | \
|
---|
165 | FT_VALIDATE_opbd | \
|
---|
166 | FT_VALIDATE_trak | \
|
---|
167 | FT_VALIDATE_prop | \
|
---|
168 | FT_VALIDATE_lcar )
|
---|
169 |
|
---|
170 |
|
---|
171 | /* */
|
---|
172 |
|
---|
173 | /**********************************************************************
|
---|
174 | *
|
---|
175 | * @function:
|
---|
176 | * FT_TrueTypeGX_Validate
|
---|
177 | *
|
---|
178 | * @description:
|
---|
179 | * Validate various TrueTypeGX tables to assure that all offsets and
|
---|
180 | * indices are valid. The idea is that a higher-level library which
|
---|
181 | * actually does the text layout can access those tables without
|
---|
182 | * error checking (which can be quite time consuming).
|
---|
183 | *
|
---|
184 | * @input:
|
---|
185 | * face ::
|
---|
186 | * A handle to the input face.
|
---|
187 | *
|
---|
188 | * validation_flags ::
|
---|
189 | * A bit field which specifies the tables to be validated. See
|
---|
190 | * @FT_VALIDATE_GXXXX for possible values.
|
---|
191 | *
|
---|
192 | * table_length ::
|
---|
193 | * The size of the `tables' array. Normally, `FT_VALIDATE_GX_LENGTH'
|
---|
194 | * should be passed.
|
---|
195 | *
|
---|
196 | * @output
|
---|
197 | * tables ::
|
---|
198 | * The array where all validated sfnt tables are stored.
|
---|
199 | * The array itself must be allocated by a client.
|
---|
200 | *
|
---|
201 | * @return:
|
---|
202 | * FreeType error code. 0 means success.
|
---|
203 | *
|
---|
204 | * @note:
|
---|
205 | * This function only works with TrueTypeGX fonts, returning an error
|
---|
206 | * otherwise.
|
---|
207 | *
|
---|
208 | * After use, the application should deallocate the buffers pointed to by
|
---|
209 | * each tables' element. A NULL value indicates that the table either
|
---|
210 | * doesn't exist in the font, the application hasn't asked for
|
---|
211 | * validation, or the validator doesn't have the ability to validate the
|
---|
212 | * sfnt table.
|
---|
213 | */
|
---|
214 | FT_EXPORT( FT_Error )
|
---|
215 | FT_TrueTypeGX_Validate( FT_Face face,
|
---|
216 | FT_UInt validation_flags,
|
---|
217 | FT_Bytes tables[FT_VALIDATE_GX_LENGTH],
|
---|
218 | FT_UInt table_length );
|
---|
219 |
|
---|
220 |
|
---|
221 | /* */
|
---|
222 |
|
---|
223 | /**********************************************************************
|
---|
224 | *
|
---|
225 | * @enum:
|
---|
226 | * FT_VALIDATE_CKERNXXX
|
---|
227 | *
|
---|
228 | * @description:
|
---|
229 | * A list of bit-field constants used with @FT_ClassicKern_Validate
|
---|
230 | * to indicate the classic kern dialect or dialects. If the selected
|
---|
231 | * type doesn't fit, @FT_ClassicKern_Validate regards the table as
|
---|
232 | * invalid.
|
---|
233 | *
|
---|
234 | * @values:
|
---|
235 | * FT_VALIDATE_MS ::
|
---|
236 | * Handle the `kern' table as a classic Microsoft kern table.
|
---|
237 | *
|
---|
238 | * @values:
|
---|
239 | * FT_VALIDATE_APPLE ::
|
---|
240 | * Handle the `kern' table as a classic Apple kern table.
|
---|
241 | *
|
---|
242 | * @values:
|
---|
243 | * FT_VALIDATE_CKERN ::
|
---|
244 | * Handle the `kern' as either classic Apple or Microsoft kern table.
|
---|
245 | */
|
---|
246 | #define FT_VALIDATE_MS ( FT_VALIDATE_GX_START << 0 )
|
---|
247 | #define FT_VALIDATE_APPLE ( FT_VALIDATE_GX_START << 1 )
|
---|
248 |
|
---|
249 | #define FT_VALIDATE_CKERN ( FT_VALIDATE_MS | FT_VALIDATE_APPLE )
|
---|
250 |
|
---|
251 |
|
---|
252 | /* */
|
---|
253 |
|
---|
254 | /**********************************************************************
|
---|
255 | *
|
---|
256 | * @function:
|
---|
257 | * FT_ClassicKern_Validate
|
---|
258 | *
|
---|
259 | * @description:
|
---|
260 | * Validate classic (16bit format) kern table to assure that the offsets
|
---|
261 | * and indices are valid. The idea is that a higher-level library which
|
---|
262 | * actually does the text layout can access those tables without error
|
---|
263 | * checking (which can be quite time consuming).
|
---|
264 | *
|
---|
265 | * The `kern' table validator in @FT_TrueTypeGX_Validate deals with both
|
---|
266 | * the new 32bit format and the classic 16bit format, while
|
---|
267 | * FT_ClassicKern_Validate only supports the classic 16bit format.
|
---|
268 | *
|
---|
269 | * @input:
|
---|
270 | * face ::
|
---|
271 | * A handle to the input face.
|
---|
272 | *
|
---|
273 | * validation_flags ::
|
---|
274 | * A bit field which specifies the dialect to be validated. See
|
---|
275 | * @FT_VALIDATE_CKERNXXX for possible values.
|
---|
276 | *
|
---|
277 | * @output
|
---|
278 | * ckern_table ::
|
---|
279 | * A pointer to the kern table.
|
---|
280 | *
|
---|
281 | * @return:
|
---|
282 | * FreeType error code. 0 means success.
|
---|
283 | *
|
---|
284 | * @note:
|
---|
285 | * After use, the application should deallocate the buffers pointed to by
|
---|
286 | * ckern_table. A NULL value indicates that the table doesn't exist in
|
---|
287 | * the font.
|
---|
288 | */
|
---|
289 | FT_EXPORT( FT_Error )
|
---|
290 | FT_ClassicKern_Validate( FT_Face face,
|
---|
291 | FT_UInt validation_flags,
|
---|
292 | FT_Bytes *ckern_table );
|
---|
293 |
|
---|
294 |
|
---|
295 | /* */
|
---|
296 |
|
---|
297 |
|
---|
298 | FT_END_HEADER
|
---|
299 |
|
---|
300 | #endif /* __FTGXVAL_H__ */
|
---|
301 |
|
---|
302 |
|
---|
303 | /* END */
|
---|