ReactOS 0.4.15-dev-8344-g0574987
otvgdef.c File Reference
#include "otvalid.h"
#include "otvcommn.h"
Include dependency graph for otvgdef.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define FT_COMPONENT   trace_otvgdef
 
#define AttachListFunc   otv_O_x_Ox
 
#define LigCaretListFunc   otv_O_x_Ox
 
#define CaretValueFunc   otv_CaretValue_validate
 

Functions

static void otv_O_x_Ox (FT_Bytes table, OTV_Validator otvalid)
 
static void otv_CaretValue_validate (FT_Bytes table, OTV_Validator otvalid)
 
static void otv_MarkGlyphSets_validate (FT_Bytes table, OTV_Validator otvalid)
 
 otv_GDEF_validate (FT_Bytes table, FT_Bytes gsub, FT_Bytes gpos, FT_UInt glyph_count, FT_Validator ftvalid)
 

Macro Definition Documentation

◆ AttachListFunc

#define AttachListFunc   otv_O_x_Ox

Definition at line 41 of file otvgdef.c.

◆ CaretValueFunc

#define CaretValueFunc   otv_CaretValue_validate

Definition at line 91 of file otvgdef.c.

◆ FT_COMPONENT

#define FT_COMPONENT   trace_otvgdef

Definition at line 30 of file otvgdef.c.

◆ LigCaretListFunc

#define LigCaretListFunc   otv_O_x_Ox

Definition at line 42 of file otvgdef.c.

Function Documentation

◆ otv_CaretValue_validate()

static void otv_CaretValue_validate ( FT_Bytes  table,
OTV_Validator  otvalid 
)
static

Definition at line 94 of file otvgdef.c.

96 {
98 FT_UInt CaretValueFormat;
99
100
101 OTV_ENTER;
102
103 OTV_LIMIT_CHECK( 4 );
104
105 CaretValueFormat = FT_NEXT_USHORT( p );
106
107 OTV_TRACE(( " (format = %d)\n", CaretValueFormat ));
108
109 switch ( CaretValueFormat )
110 {
111 case 1: /* CaretValueFormat1 */
112 /* skip Coordinate, no test */
113 break;
114
115 case 2: /* CaretValueFormat2 */
116 /* skip CaretValuePoint, no test */
117 break;
118
119 case 3: /* CaretValueFormat3 */
120 p += 2; /* skip Coordinate */
121
122 OTV_LIMIT_CHECK( 2 );
123
124 /* DeviceTable */
125 otv_Device_validate( table + FT_NEXT_USHORT( p ), otvalid );
126 break;
127
128 default:
130 }
131
132 OTV_EXIT;
133 }
#define FT_NEXT_USHORT(buffer)
Definition: ftstream.h:226
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
otv_Device_validate(FT_Bytes table, OTV_Validator otvalid)
Definition: otvcommn.c:307
#define OTV_TRACE(s)
Definition: otvcommn.h:230
#define OTV_EXIT
Definition: otvcommn.h:228
#define OTV_LIMIT_CHECK(_count)
Definition: otvcommn.h:91
#define OTV_ENTER
Definition: otvcommn.h:226

◆ otv_GDEF_validate()

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

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 }
static const WCHAR version[]
Definition: asmname.c:66
#define FT_TRACE3(varformat)
Definition: ftdebug.h:160
#define FT_TRACE4(varformat)
Definition: ftdebug.h:161
FT_BEGIN_HEADER typedef unsigned char FT_Bool
Definition: fttypes.h:108
unsigned short FT_UShort
Definition: fttypes.h:209
#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_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_RUN
Definition: otvcommn.h:235
#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_NEST2(x, y)
Definition: otvcommn.h:210
#define OTV_OPTIONAL_OFFSET32(_offset)
Definition: otvcommn.h:85
#define OTV_OPTIONAL_TABLE(_table)
Definition: otvcommn.h:73
#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
LOCAL int table_size
Definition: write.c:65

Referenced by otv_validate().

◆ otv_MarkGlyphSets_validate()

static void otv_MarkGlyphSets_validate ( FT_Bytes  table,
OTV_Validator  otvalid 
)
static

Definition at line 145 of file otvgdef.c.

147 {
148 FT_Bytes p = table;
149 FT_UInt MarkGlyphSetCount;
150
151
152 OTV_NAME_ENTER( "MarkGlyphSets" );
153
154 p += 2; /* skip Format */
155
156 OTV_LIMIT_CHECK( 2 );
157 MarkGlyphSetCount = FT_NEXT_USHORT( p );
158
159 OTV_TRACE(( " (MarkGlyphSetCount = %d)\n", MarkGlyphSetCount ));
160
161 OTV_LIMIT_CHECK( MarkGlyphSetCount * 4 ); /* CoverageOffsets */
162
163 for ( ; MarkGlyphSetCount > 0; MarkGlyphSetCount-- )
164 otv_Coverage_validate( table + FT_NEXT_ULONG( p ), otvalid, -1 );
165
166 OTV_EXIT;
167 }
#define FT_NEXT_ULONG(buffer)
Definition: ftstream.h:238
otv_Coverage_validate(FT_Bytes table, OTV_Validator otvalid, FT_Int expected_count)
Definition: otvcommn.c:41
#define OTV_NAME_ENTER(name)
Definition: otvcommn.h:227

Referenced by otv_GDEF_validate().

◆ otv_O_x_Ox()

static void otv_O_x_Ox ( FT_Bytes  table,
OTV_Validator  otvalid 
)
static

Definition at line 47 of file otvgdef.c.

49 {
51 FT_Bytes Coverage;
52 FT_UInt GlyphCount;
54
55
57
58 OTV_LIMIT_CHECK( 4 );
59 Coverage = table + FT_NEXT_USHORT( p );
60 GlyphCount = FT_NEXT_USHORT( p );
61
62 OTV_TRACE(( " (GlyphCount = %d)\n", GlyphCount ));
63
64 otv_Coverage_validate( Coverage, otvalid, (FT_Int)GlyphCount );
65 if ( GlyphCount != otv_Coverage_get_count( Coverage ) )
67
68 OTV_LIMIT_CHECK( GlyphCount * 2 );
69
70 otvalid->nesting_level++;
71 func = otvalid->func[otvalid->nesting_level];
72 otvalid->extra1 = 0;
73
74 for ( ; GlyphCount > 0; GlyphCount-- )
75 func( table + FT_NEXT_USHORT( p ), otvalid );
76
77 otvalid->nesting_level--;
78
80 }
signed int FT_Int
Definition: fttypes.h:220
#define FT_INVALID_DATA
Definition: ftvalid.h:150
GLenum func
Definition: glext.h:6028
otv_Coverage_get_count(FT_Bytes table)
Definition: otvcommn.c:175
void(* OTV_Validate_Func)(FT_Bytes table, OTV_Validator otvalid)
Definition: otvcommn.h:41