ReactOS 0.4.15-dev-8241-g63935f8
otvalid.h File Reference
#include <ft2build.h>
#include "otverror.h"
Include dependency graph for otvalid.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

FT_BEGIN_HEADER otv_BASE_validate (FT_Bytes table, FT_Validator valid)
 
 otv_GDEF_validate (FT_Bytes table, FT_Bytes gsub, FT_Bytes gpos, FT_UInt glyph_count, FT_Validator valid)
 
 otv_GPOS_validate (FT_Bytes table, FT_UInt glyph_count, FT_Validator valid)
 
 otv_GSUB_validate (FT_Bytes table, FT_UInt glyph_count, FT_Validator valid)
 
 otv_JSTF_validate (FT_Bytes table, FT_Bytes gsub, FT_Bytes gpos, FT_UInt glyph_count, FT_Validator valid)
 
 otv_MATH_validate (FT_Bytes table, FT_UInt glyph_count, FT_Validator ftvalid)
 

Function Documentation

◆ otv_BASE_validate()

FT_BEGIN_HEADER otv_BASE_validate ( FT_Bytes  table,
FT_Validator  valid 
)

Definition at line 280 of file otvbase.c.

282 {
283 OTV_ValidatorRec otvalidrec;
284 OTV_Validator otvalid = &otvalidrec;
285 FT_Bytes p = table;
288
289 OTV_OPTIONAL_TABLE( HorizAxis );
290 OTV_OPTIONAL_TABLE( VertAxis );
291
292 OTV_OPTIONAL_TABLE32( itemVarStore );
293
294
295 otvalid->root = ftvalid;
296
297 FT_TRACE3(( "validating BASE table\n" ));
298 OTV_INIT;
299
300 OTV_LIMIT_CHECK( 4 );
301
302 if ( FT_NEXT_USHORT( p ) != 1 ) /* majorVersion */
304
305 version = FT_NEXT_USHORT( p ); /* minorVersion */
306
307 table_size = 8;
308 switch ( version )
309 {
310 case 0:
311 OTV_LIMIT_CHECK( 4 );
312 break;
313
314 case 1:
315 OTV_LIMIT_CHECK( 8 );
316 table_size += 4;
317 break;
318
319 default:
321 }
322
323 OTV_OPTIONAL_OFFSET( HorizAxis );
324 OTV_SIZE_CHECK( HorizAxis );
325 if ( HorizAxis )
326 otv_Axis_validate( table + HorizAxis, otvalid );
327
328 OTV_OPTIONAL_OFFSET( VertAxis );
329 OTV_SIZE_CHECK( VertAxis );
330 if ( VertAxis )
331 otv_Axis_validate( table + VertAxis, otvalid );
332
333 if ( version > 0 )
334 {
335 OTV_OPTIONAL_OFFSET32( itemVarStore );
336 OTV_SIZE_CHECK32( itemVarStore );
337 if ( itemVarStore )
338 OTV_TRACE(( " [omitting itemVarStore validation]\n" )); /* XXX */
339 }
340
341 FT_TRACE4(( "\n" ));
342 }
static const WCHAR version[]
Definition: asmname.c:66
#define FT_TRACE3(varformat)
Definition: ftdebug.h:160
#define FT_TRACE4(varformat)
Definition: ftdebug.h:161
#define FT_NEXT_USHORT(buffer)
Definition: ftstream.h:226
unsigned short FT_UShort
Definition: fttypes.h:209
unsigned int FT_UInt
Definition: fttypes.h:231
const FT_Byte * FT_Bytes
Definition: fttypes.h:165
#define FT_INVALID_FORMAT
Definition: ftvalid.h:142
GLfloat GLfloat p
Definition: glext.h:8902
static void otv_Axis_validate(FT_Bytes table, OTV_Validator otvalid)
Definition: otvbase.c:252
#define OTV_TRACE(s)
Definition: otvcommn.h:230
#define OTV_SIZE_CHECK(_size)
Definition: otvcommn.h:97
typedefFT_BEGIN_HEADER struct OTV_ValidatorRec_ * OTV_Validator
Definition: otvcommn.h:39
#define OTV_SIZE_CHECK32(_size)
Definition: otvcommn.h:119
#define OTV_OPTIONAL_TABLE32(_table)
Definition: otvcommn.h:76
#define OTV_OPTIONAL_OFFSET(_offset)
Definition: otvcommn.h:79
#define OTV_INIT
Definition: otvcommn.h:225
#define OTV_OPTIONAL_OFFSET32(_offset)
Definition: otvcommn.h:85
#define OTV_LIMIT_CHECK(_count)
Definition: otvcommn.h:91
#define OTV_OPTIONAL_TABLE(_table)
Definition: otvcommn.h:73
LOCAL int table_size
Definition: write.c:65

Referenced by otv_validate().

◆ otv_GDEF_validate()

otv_GDEF_validate ( FT_Bytes  table,
FT_Bytes  gsub,
FT_Bytes  gpos,
FT_UInt  glyph_count,
FT_Validator  valid 
)

Definition at line 181 of file otvgdef.c.

186 {
187 OTV_ValidatorRec otvalidrec;
188 OTV_Validator otvalid = &otvalidrec;
189 FT_Bytes p = table;
192 FT_Bool need_MarkAttachClassDef = 1;
193
194 OTV_OPTIONAL_TABLE( GlyphClassDef );
195 OTV_OPTIONAL_TABLE( AttachListOffset );
196 OTV_OPTIONAL_TABLE( LigCaretListOffset );
197 OTV_OPTIONAL_TABLE( MarkAttachClassDef );
198 OTV_OPTIONAL_TABLE( MarkGlyphSetsDef );
199
200 OTV_OPTIONAL_TABLE32( itemVarStore );
201
202
203 otvalid->root = ftvalid;
204
205 FT_TRACE3(( "validating GDEF table\n" ));
206 OTV_INIT;
207
208 OTV_LIMIT_CHECK( 4 );
209
210 if ( FT_NEXT_USHORT( p ) != 1 ) /* majorVersion */
212
213 version = FT_NEXT_USHORT( p ); /* minorVersion */
214
215 table_size = 10;
216 switch ( version )
217 {
218 case 0:
219 /* MarkAttachClassDef has been added to the OpenType */
220 /* specification without increasing GDEF's version, */
221 /* so we use this ugly hack to find out whether the */
222 /* table is needed actually. */
223
224 need_MarkAttachClassDef = FT_BOOL(
227
228 if ( need_MarkAttachClassDef )
229 {
230 OTV_LIMIT_CHECK( 8 );
231 table_size += 2;
232 }
233 else
234 OTV_LIMIT_CHECK( 6 ); /* OpenType < 1.2 */
235
236 break;
237
238 case 2:
239 OTV_LIMIT_CHECK( 10 );
240 table_size += 4;
241 break;
242
243 case 3:
244 OTV_LIMIT_CHECK( 14 );
245 table_size += 8;
246 break;
247
248 default:
250 }
251
252 otvalid->glyph_count = glyph_count;
253
254 OTV_OPTIONAL_OFFSET( GlyphClassDef );
255 OTV_SIZE_CHECK( GlyphClassDef );
256 if ( GlyphClassDef )
257 otv_ClassDef_validate( table + GlyphClassDef, otvalid );
258
259 OTV_OPTIONAL_OFFSET( AttachListOffset );
260 OTV_SIZE_CHECK( AttachListOffset );
261 if ( AttachListOffset )
262 {
263 OTV_NEST2( AttachList, AttachPoint );
264 OTV_RUN( table + AttachListOffset, otvalid );
265 }
266
267 OTV_OPTIONAL_OFFSET( LigCaretListOffset );
268 OTV_SIZE_CHECK( LigCaretListOffset );
269 if ( LigCaretListOffset )
270 {
271 OTV_NEST3( LigCaretList, LigGlyph, CaretValue );
272 OTV_RUN( table + LigCaretListOffset, otvalid );
273 }
274
275 if ( need_MarkAttachClassDef )
276 {
277 OTV_OPTIONAL_OFFSET( MarkAttachClassDef );
278 OTV_SIZE_CHECK( MarkAttachClassDef );
279 if ( MarkAttachClassDef )
280 otv_ClassDef_validate( table + MarkAttachClassDef, otvalid );
281 }
282
283 if ( version > 0 )
284 {
285 OTV_OPTIONAL_OFFSET( MarkGlyphSetsDef );
286 OTV_SIZE_CHECK( MarkGlyphSetsDef );
287 if ( MarkGlyphSetsDef )
288 otv_MarkGlyphSets_validate( table + MarkGlyphSetsDef, otvalid );
289 }
290
291 if ( version > 2 )
292 {
293 OTV_OPTIONAL_OFFSET32( itemVarStore );
294 OTV_SIZE_CHECK32( itemVarStore );
295 if ( itemVarStore )
296 OTV_TRACE(( " [omitting itemVarStore validation]\n" )); /* XXX */
297 }
298
299 FT_TRACE4(( "\n" ));
300 }
FT_BEGIN_HEADER typedef unsigned char FT_Bool
Definition: fttypes.h:108
#define FT_BOOL(x)
Definition: fttypes.h:578
otv_ClassDef_validate(FT_Bytes table, OTV_Validator otvalid)
Definition: otvcommn.c:221
otv_GSUBGPOS_have_MarkAttachmentType_flag(FT_Bytes table)
Definition: otvcommn.c:1057
#define OTV_RUN
Definition: otvcommn.h:235
#define OTV_NEST2(x, y)
Definition: otvcommn.h:210
#define OTV_NEST3(x, y, z)
Definition: otvcommn.h:217
static void otv_MarkGlyphSets_validate(FT_Bytes table, OTV_Validator otvalid)
Definition: otvgdef.c:145

Referenced by otv_validate().

◆ otv_GPOS_validate()

otv_GPOS_validate ( FT_Bytes  table,
FT_UInt  glyph_count,
FT_Validator  valid 
)

Definition at line 982 of file otvgpos.c.

985 {
986 OTV_ValidatorRec validrec;
987 OTV_Validator otvalid = &validrec;
988 FT_Bytes p = table;
991 FT_UInt ScriptList, FeatureList, LookupList;
992
993 OTV_OPTIONAL_TABLE32( featureVariations );
994
995
996 otvalid->root = ftvalid;
997
998 FT_TRACE3(( "validating GPOS table\n" ));
999 OTV_INIT;
1000
1001 OTV_LIMIT_CHECK( 4 );
1002
1003 if ( FT_NEXT_USHORT( p ) != 1 ) /* majorVersion */
1005
1006 version = FT_NEXT_USHORT( p ); /* minorVersion */
1007
1008 table_size = 10;
1009 switch ( version )
1010 {
1011 case 0:
1012 OTV_LIMIT_CHECK( 6 );
1013 break;
1014
1015 case 1:
1016 OTV_LIMIT_CHECK( 10 );
1017 table_size += 4;
1018 break;
1019
1020 default:
1022 }
1023
1024 ScriptList = FT_NEXT_USHORT( p );
1026 LookupList = FT_NEXT_USHORT( p );
1027
1028 otvalid->type_count = 9;
1029 otvalid->type_funcs = (OTV_Validate_Func*)otv_gpos_validate_funcs;
1030 otvalid->glyph_count = glyph_count;
1031
1032 otv_LookupList_validate( table + LookupList,
1033 otvalid );
1035 otvalid );
1037 otvalid );
1038
1039 if ( version > 0 )
1040 {
1041 OTV_OPTIONAL_OFFSET32( featureVariations );
1042 OTV_SIZE_CHECK32( featureVariations );
1043 if ( featureVariations )
1044 OTV_TRACE(( " [omitting featureVariations validation]\n" )); /* XXX */
1045 }
1046
1047 FT_TRACE4(( "\n" ));
1048 }
struct tagFeatureList FeatureList
otv_ScriptList_validate(FT_Bytes table, FT_Bytes features, OTV_Validator otvalid)
Definition: otvcommn.c:594
otv_FeatureList_validate(FT_Bytes table, FT_Bytes lookups, OTV_Validator otvalid)
Definition: otvcommn.c:473
otv_LookupList_validate(FT_Bytes table, OTV_Validator otvalid)
Definition: otvcommn.c:393
void(* OTV_Validate_Func)(FT_Bytes table, OTV_Validator otvalid)
Definition: otvcommn.h:41
static const OTV_Validate_Func otv_gpos_validate_funcs[9]
Definition: otvgpos.c:943

Referenced by otv_validate().

◆ otv_GSUB_validate()

otv_GSUB_validate ( FT_Bytes  table,
FT_UInt  glyph_count,
FT_Validator  valid 
)

Definition at line 548 of file otvgsub.c.

551 {
552 OTV_ValidatorRec otvalidrec;
553 OTV_Validator otvalid = &otvalidrec;
554 FT_Bytes p = table;
557 FT_UInt ScriptList, FeatureList, LookupList;
558
559 OTV_OPTIONAL_TABLE32( featureVariations );
560
561
562 otvalid->root = ftvalid;
563
564 FT_TRACE3(( "validating GSUB table\n" ));
565 OTV_INIT;
566
567 OTV_LIMIT_CHECK( 4 );
568
569 if ( FT_NEXT_USHORT( p ) != 1 ) /* majorVersion */
571
572 version = FT_NEXT_USHORT( p ); /* minorVersion */
573
574 table_size = 10;
575 switch ( version )
576 {
577 case 0:
578 OTV_LIMIT_CHECK( 6 );
579 break;
580
581 case 1:
582 OTV_LIMIT_CHECK( 10 );
583 table_size += 4;
584 break;
585
586 default:
588 }
589
590 ScriptList = FT_NEXT_USHORT( p );
592 LookupList = FT_NEXT_USHORT( p );
593
594 otvalid->type_count = 8;
595 otvalid->type_funcs = (OTV_Validate_Func*)otv_gsub_validate_funcs;
596 otvalid->glyph_count = glyph_count;
597
598 otv_LookupList_validate( table + LookupList,
599 otvalid );
601 otvalid );
603 otvalid );
604
605 if ( version > 0 )
606 {
607 OTV_OPTIONAL_OFFSET32( featureVariations );
608 OTV_SIZE_CHECK32( featureVariations );
609 if ( featureVariations )
610 OTV_TRACE(( " [omitting featureVariations validation]\n" )); /* XXX */
611 }
612
613 FT_TRACE4(( "\n" ));
614 }
static const OTV_Validate_Func otv_gsub_validate_funcs[8]
Definition: otvgsub.c:522

Referenced by otv_validate().

◆ otv_JSTF_validate()

otv_JSTF_validate ( FT_Bytes  table,
FT_Bytes  gsub,
FT_Bytes  gpos,
FT_UInt  glyph_count,
FT_Validator  valid 
)

Definition at line 205 of file otvjstf.c.

210 {
211 OTV_ValidatorRec otvalidrec;
212 OTV_Validator otvalid = &otvalidrec;
213 FT_Bytes p = table;
214 FT_UInt JstfScriptCount;
215
216
217 otvalid->root = ftvalid;
218
219
220 FT_TRACE3(( "validating JSTF table\n" ));
221 OTV_INIT;
222
223 OTV_LIMIT_CHECK( 6 );
224
225 if ( FT_NEXT_ULONG( p ) != 0x10000UL ) /* Version */
227
228 JstfScriptCount = FT_NEXT_USHORT( p );
229
230 FT_TRACE3(( " (JstfScriptCount = %d)\n", JstfScriptCount ));
231
232 OTV_LIMIT_CHECK( JstfScriptCount * 6 );
233
234 if ( gsub )
235 otvalid->extra1 = otv_GSUBGPOS_get_Lookup_count( gsub );
236 else
237 otvalid->extra1 = 0;
238
239 if ( gpos )
240 otvalid->extra2 = otv_GSUBGPOS_get_Lookup_count( gpos );
241 else
242 otvalid->extra2 = 0;
243
244 otvalid->glyph_count = glyph_count;
245
246 /* JstfScriptRecord */
247 for ( ; JstfScriptCount > 0; JstfScriptCount-- )
248 {
249 p += 4; /* skip JstfScriptTag */
250
251 /* JstfScript */
253 }
254
255 FT_TRACE4(( "\n" ));
256 }
#define FT_NEXT_ULONG(buffer)
Definition: ftstream.h:238
otv_GSUBGPOS_get_Lookup_count(FT_Bytes table)
Definition: otvcommn.c:1047
static void otv_JstfScript_validate(FT_Bytes table, OTV_Validator otvalid)
Definition: otvjstf.c:148

Referenced by otv_validate().

◆ otv_MATH_validate()

otv_MATH_validate ( FT_Bytes  table,
FT_UInt  glyph_count,
FT_Validator  ftvalid 
)

Definition at line 416 of file otvmath.c.

419 {
420 OTV_ValidatorRec otvalidrec;
421 OTV_Validator otvalid = &otvalidrec;
422 FT_Bytes p = table;
423 FT_UInt MathConstants, MathGlyphInfo, MathVariants;
424
425
426 otvalid->root = ftvalid;
427
428 FT_TRACE3(( "validating MATH table\n" ));
429 OTV_INIT;
430
431 OTV_LIMIT_CHECK( 10 );
432
433 if ( FT_NEXT_ULONG( p ) != 0x10000UL ) /* Version */
435
436 MathConstants = FT_NEXT_USHORT( p );
437 MathGlyphInfo = FT_NEXT_USHORT( p );
438 MathVariants = FT_NEXT_USHORT( p );
439
440 otvalid->glyph_count = glyph_count;
441
442 otv_MathConstants_validate( table + MathConstants,
443 otvalid );
444 otv_MathGlyphInfo_validate( table + MathGlyphInfo,
445 otvalid );
446 otv_MathVariants_validate ( table + MathVariants,
447 otvalid );
448
449 FT_TRACE4(( "\n" ));
450 }
static void otv_MathConstants_validate(FT_Bytes table, OTV_Validator otvalid)
Definition: otvmath.c:46
static void otv_MathGlyphInfo_validate(FT_Bytes table, OTV_Validator otvalid)
Definition: otvmath.c:225
static void otv_MathVariants_validate(FT_Bytes table, OTV_Validator otvalid)
Definition: otvmath.c:355

Referenced by otv_validate().