4 |
/* */ |
/* */ |
5 |
/* FreeType API for validating TrueTypeGX/AAT tables (specification). */ |
/* FreeType API for validating TrueTypeGX/AAT tables (specification). */ |
6 |
/* */ |
/* */ |
7 |
/* Copyright 2004 by */ |
/* Copyright 2004, 2005 by */ |
8 |
/* Masatake YAMATO, Redhat K.K, */ |
/* Masatake YAMATO, Redhat K.K, */ |
9 |
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
10 |
/* */ |
/* */ |
17 |
/***************************************************************************/ |
/***************************************************************************/ |
18 |
|
|
19 |
/***************************************************************************/ |
/***************************************************************************/ |
20 |
|
/* */ |
21 |
/* gxvalid is derived from both gxlayout module and otvalid module. */ |
/* gxvalid is derived from both gxlayout module and otvalid module. */ |
22 |
/* Development of gxlayout is support of Information-technology Promotion */ |
/* Development of gxlayout is supported by the Information-technology */ |
23 |
/* Agency(IPA), Japan. */ |
/* Promotion Agency(IPA), Japan. */ |
24 |
|
/* */ |
25 |
/***************************************************************************/ |
/***************************************************************************/ |
26 |
|
|
27 |
|
|
59 |
/* */ |
/* */ |
60 |
/*************************************************************************/ |
/*************************************************************************/ |
61 |
|
|
62 |
/***************************************************************************/ |
|
63 |
/* */ |
/*************************************************************************/ |
64 |
/* */ |
/* */ |
65 |
/* Warnings: Use FT_VALIDATE_XXX to validate a table. */ |
/* */ |
66 |
/* Following definitions are for gxvalid developers. */ |
/* 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 |
#define FT_VALIDATE_feat_INDEX 0 |
73 |
#define FT_VALIDATE_mort_INDEX 1 |
#define FT_VALIDATE_mort_INDEX 1 |
74 |
#define FT_VALIDATE_morx_INDEX 2 |
#define FT_VALIDATE_morx_INDEX 2 |
82 |
#define FT_VALIDATE_GX_LAST_INDEX FT_VALIDATE_lcar_INDEX |
#define FT_VALIDATE_GX_LAST_INDEX FT_VALIDATE_lcar_INDEX |
83 |
#define FT_VALIDATE_GX_LENGTH (FT_VALIDATE_GX_LAST_INDEX + 1) |
#define FT_VALIDATE_GX_LENGTH (FT_VALIDATE_GX_LAST_INDEX + 1) |
84 |
|
|
85 |
/* Up to 0x1000 is used by otvalid. |
/* Up to 0x1000 is used by otvalid. |
86 |
Ox2000 is reserved for feature ot extension. */ |
Ox2xxx is reserved for feature OT extension. */ |
87 |
#define FT_VALIDATE_GX_START 0x4000 |
#define FT_VALIDATE_GX_START 0x4000 |
88 |
#define FT_VALIDATE_GX_BITFIELD(tag) \ |
#define FT_VALIDATE_GX_BITFIELD( tag ) \ |
89 |
(FT_VALIDATE_GX_START << FT_VALIDATE_##tag##_INDEX) |
( FT_VALIDATE_GX_START << FT_VALIDATE_##tag##_INDEX ) |
90 |
|
|
91 |
|
|
92 |
/********************************************************************** |
/********************************************************************** |
100 |
* |
* |
101 |
* @values: |
* @values: |
102 |
* FT_VALIDATE_feat :: |
* FT_VALIDATE_feat :: |
103 |
* Validate feat table. |
* Validate `feat' table. |
104 |
* |
* |
105 |
* @values: |
* @values: |
106 |
* FT_VALIDATE_mort :: |
* FT_VALIDATE_mort :: |
107 |
* Validate mort table. |
* Validate `mort' table. |
108 |
* |
* |
109 |
* @values: |
* @values: |
110 |
* FT_VALIDATE_morx :: |
* FT_VALIDATE_morx :: |
111 |
* Validate morx table. |
* Validate `morx' table. |
112 |
* |
* |
113 |
* @values: |
* @values: |
114 |
* FT_VALIDATE_bsln :: |
* FT_VALIDATE_bsln :: |
115 |
* Validate bsln table. |
* Validate `bsln' table. |
116 |
* |
* |
117 |
* @values: |
* @values: |
118 |
* FT_VALIDATE_just :: |
* FT_VALIDATE_just :: |
119 |
* Validate just table. |
* Validate `just' table. |
120 |
* |
* |
121 |
* @values: |
* @values: |
122 |
* FT_VALIDATE_kern :: |
* FT_VALIDATE_kern :: |
123 |
* Validate kern table. |
* Validate `kern' table. |
124 |
* |
* |
125 |
* @values: |
* @values: |
126 |
* FT_VALIDATE_opbd :: |
* FT_VALIDATE_opbd :: |
127 |
* Validate opbd table. |
* Validate `opbd' table. |
128 |
* |
* |
129 |
* @values: |
* @values: |
130 |
* FT_VALIDATE_trak :: |
* FT_VALIDATE_trak :: |
131 |
* Validate trak table. |
* Validate `trak' table. |
132 |
* |
* |
133 |
* @values: |
* @values: |
134 |
* FT_VALIDATE_prop :: |
* FT_VALIDATE_prop :: |
135 |
* Validate prop table. |
* Validate `prop' table. |
136 |
* |
* |
137 |
* @values: |
* @values: |
138 |
* FT_VALIDATE_lcar :: |
* FT_VALIDATE_lcar :: |
139 |
* Validate lcar table. |
* Validate `lcar' table. |
140 |
* |
* |
141 |
* @values: |
* @values: |
142 |
* FT_VALIDATE_GX :: |
* FT_VALIDATE_GX :: |
145 |
* |
* |
146 |
*/ |
*/ |
147 |
|
|
148 |
#define FT_VALIDATE_feat FT_VALIDATE_GX_BITFIELD(feat) |
#define FT_VALIDATE_feat FT_VALIDATE_GX_BITFIELD( feat ) |
149 |
#define FT_VALIDATE_mort FT_VALIDATE_GX_BITFIELD(mort) |
#define FT_VALIDATE_mort FT_VALIDATE_GX_BITFIELD( mort ) |
150 |
#define FT_VALIDATE_morx FT_VALIDATE_GX_BITFIELD(morx) |
#define FT_VALIDATE_morx FT_VALIDATE_GX_BITFIELD( morx ) |
151 |
#define FT_VALIDATE_bsln FT_VALIDATE_GX_BITFIELD(bsln) |
#define FT_VALIDATE_bsln FT_VALIDATE_GX_BITFIELD( bsln ) |
152 |
#define FT_VALIDATE_just FT_VALIDATE_GX_BITFIELD(just) |
#define FT_VALIDATE_just FT_VALIDATE_GX_BITFIELD( just ) |
153 |
#define FT_VALIDATE_kern FT_VALIDATE_GX_BITFIELD(kern) |
#define FT_VALIDATE_kern FT_VALIDATE_GX_BITFIELD( kern ) |
154 |
#define FT_VALIDATE_opbd FT_VALIDATE_GX_BITFIELD(opbd) |
#define FT_VALIDATE_opbd FT_VALIDATE_GX_BITFIELD( opbd ) |
155 |
#define FT_VALIDATE_trak FT_VALIDATE_GX_BITFIELD(trak) |
#define FT_VALIDATE_trak FT_VALIDATE_GX_BITFIELD( trak ) |
156 |
#define FT_VALIDATE_prop FT_VALIDATE_GX_BITFIELD(prop) |
#define FT_VALIDATE_prop FT_VALIDATE_GX_BITFIELD( prop ) |
157 |
#define FT_VALIDATE_lcar FT_VALIDATE_GX_BITFIELD(lcar) |
#define FT_VALIDATE_lcar FT_VALIDATE_GX_BITFIELD( lcar ) |
158 |
|
|
159 |
#define FT_VALIDATE_GX ( FT_VALIDATE_feat | \ |
#define FT_VALIDATE_GX ( FT_VALIDATE_feat | \ |
160 |
FT_VALIDATE_mort | \ |
FT_VALIDATE_mort | \ |
161 |
FT_VALIDATE_morx | \ |
FT_VALIDATE_morx | \ |
162 |
FT_VALIDATE_bsln | \ |
FT_VALIDATE_bsln | \ |
163 |
FT_VALIDATE_just | \ |
FT_VALIDATE_just | \ |
164 |
FT_VALIDATE_kern | \ |
FT_VALIDATE_kern | \ |
165 |
FT_VALIDATE_opbd | \ |
FT_VALIDATE_opbd | \ |
166 |
FT_VALIDATE_trak | \ |
FT_VALIDATE_trak | \ |
167 |
FT_VALIDATE_prop | \ |
FT_VALIDATE_prop | \ |
168 |
FT_VALIDATE_lcar ) |
FT_VALIDATE_lcar ) |
169 |
|
|
170 |
|
|
190 |
* @FT_VALIDATE_GXXXX for possible values. |
* @FT_VALIDATE_GXXXX for possible values. |
191 |
* |
* |
192 |
* table_length :: |
* table_length :: |
193 |
* The length of tables. Generally FT_VALIDATE_GX_LENGTH should |
* The size of the `tables' array. Normally, `FT_VALIDATE_GX_LENGTH' |
194 |
* be passed. |
* should be passed. |
195 |
* |
* |
196 |
* @output |
* @output |
197 |
* tables :: |
* tables :: |
198 |
* The array where each validated sfnt tables are stored to. |
* The array where all validated sfnt tables are stored. |
199 |
* The array itself must be allocated by a client. |
* The array itself must be allocated by a client. |
200 |
* |
* |
201 |
* @return: |
* @return: |
205 |
* This function only works with TrueTypeGX fonts, returning an error |
* This function only works with TrueTypeGX fonts, returning an error |
206 |
* otherwise. |
* otherwise. |
207 |
* |
* |
208 |
* After use, the application should deallocate the buffers pointed by each |
* After use, the application should deallocate the buffers pointed to by |
209 |
* tables' element. A NULL value indicates that the table either |
* each tables' element. A NULL value indicates that the table either |
210 |
* doesn't exist in the font, the application hasn't asked for validation, or |
* doesn't exist in the font, the application hasn't asked for |
211 |
* the validator doesn't have ability to validate the sfnt table. |
* validation, or the validator doesn't have the ability to validate the |
212 |
|
* sfnt table. |
213 |
*/ |
*/ |
214 |
FT_EXPORT( FT_Error ) |
FT_EXPORT( FT_Error ) |
215 |
FT_TrueTypeGX_Validate( FT_Face face, |
FT_TrueTypeGX_Validate( FT_Face face, |
216 |
FT_UInt validation_flags, |
FT_UInt validation_flags, |
217 |
FT_Bytes tables[FT_VALIDATE_GX_LENGTH], |
FT_Bytes tables[FT_VALIDATE_GX_LENGTH], |
218 |
FT_UInt table_length ); |
FT_UInt table_length ); |
|
|
|
219 |
|
|
220 |
|
|
221 |
/* */ |
/* */ |
227 |
* |
* |
228 |
* @description: |
* @description: |
229 |
* A list of bit-field constants used with @FT_ClassicKern_Validate |
* A list of bit-field constants used with @FT_ClassicKern_Validate |
230 |
* to indicate (a) classic kern dialect(s). |
* 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: |
* @values: |
235 |
* FT_VALIDATE_MS :: |
* FT_VALIDATE_MS :: |
236 |
* Validate the kern table as it has classic Microsoft kern dialect. |
* Handle the `kern' table as a classic Microsoft kern table. |
|
* If @FT_ClassicKern_Validate detects the table has the other |
|
|
* dialect, it regards the table invalid. |
|
237 |
* |
* |
238 |
* @values: |
* @values: |
239 |
* FT_VALIDATE_APPLE :: |
* FT_VALIDATE_APPLE :: |
240 |
* Validate the kern table as it has classic Apple kern dialect. |
* Handle the `kern' table as a classic Apple kern table. |
|
* If @FT_ClassicKern_Validate detects the table has the other |
|
|
* dialect, it regards the table invalid. |
|
241 |
* |
* |
242 |
* @values: |
* @values: |
243 |
* FT_VALIDATE_CKERN :: |
* FT_VALIDATE_CKERN :: |
244 |
* Validate the kern table as it has classic Apple kern dialect or |
* Handle the `kern' as either classic Apple or Microsoft kern table. |
|
* Microsoft kern dialect. |
|
245 |
*/ |
*/ |
246 |
#define FT_VALIDATE_MS (FT_VALIDATE_GX_START << 0) |
#define FT_VALIDATE_MS ( FT_VALIDATE_GX_START << 0 ) |
247 |
#define FT_VALIDATE_APPLE (FT_VALIDATE_GX_START << 1) |
#define FT_VALIDATE_APPLE ( FT_VALIDATE_GX_START << 1 ) |
248 |
|
|
249 |
#define FT_VALIDATE_CKERN ( FT_VALIDATE_MS | FT_VALIDATE_APPLE ) |
#define FT_VALIDATE_CKERN ( FT_VALIDATE_MS | FT_VALIDATE_APPLE ) |
250 |
|
|
257 |
* FT_ClassicKern_Validate |
* FT_ClassicKern_Validate |
258 |
* |
* |
259 |
* @description: |
* @description: |
260 |
* Validate classic(16bit format) kern table to assure that the offsets |
* Validate classic (16bit format) kern table to assure that the offsets |
261 |
* and indices are valid. The idea is that a higher-level library |
* and indices are valid. The idea is that a higher-level library which |
262 |
* which actually does the text layout can access those tables without |
* actually does the text layout can access those tables without error |
263 |
* error checking (which can be quite time consuming). |
* checking (which can be quite time consuming). |
264 |
* |
* |
265 |
* Kern table validator in @FT_TrueTypeGX_Validate deals both |
* The `kern' table validator in @FT_TrueTypeGX_Validate deals with both |
266 |
* new 32 bit format and classic 16 bit format. In other hand |
* the new 32bit format and the classic 16bit format, while |
267 |
* this function supports only the classic 16 bit format. |
* FT_ClassicKern_Validate only supports the classic 16bit format. |
268 |
* |
* |
269 |
* @input: |
* @input: |
270 |
* face :: |
* face :: |
282 |
* FreeType error code. 0 means success. |
* FreeType error code. 0 means success. |
283 |
* |
* |
284 |
* @note: |
* @note: |
285 |
* After use, the application should deallocate the buffers pointed by |
* After use, the application should deallocate the buffers pointed to by |
286 |
* ckern_table. A NULL value indicates that the table either |
* ckern_table. A NULL value indicates that the table doesn't exist in |
287 |
* doesn't exist in the font. |
* the font. |
288 |
*/ |
*/ |
289 |
FT_EXPORT( FT_Error ) |
FT_EXPORT( FT_Error ) |
290 |
FT_ClassicKern_Validate( FT_Face face, |
FT_ClassicKern_Validate( FT_Face face, |
291 |
FT_UInt validation_flags, |
FT_UInt validation_flags, |
292 |
FT_Bytes *ckern_table ); |
FT_Bytes *ckern_table ); |
293 |
|
|
294 |
|
|
295 |
/* */ |
/* */ |