ReactOS 0.4.15-dev-8344-g0574987
otvmath.c File Reference
#include "otvalid.h"
#include "otvcommn.h"
#include "otvgpos.h"
Include dependency graph for otvmath.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_otvmath
 

Functions

static void otv_MathConstants_validate (FT_Bytes table, OTV_Validator otvalid)
 
static void otv_MathItalicsCorrectionInfo_validate (FT_Bytes table, OTV_Validator otvalid, FT_Int isItalic)
 
static void otv_MathKern_validate (FT_Bytes table, OTV_Validator otvalid)
 
static void otv_MathKernInfo_validate (FT_Bytes table, OTV_Validator otvalid)
 
static void otv_MathGlyphInfo_validate (FT_Bytes table, OTV_Validator otvalid)
 
static void otv_GlyphAssembly_validate (FT_Bytes table, OTV_Validator otvalid)
 
static void otv_MathGlyphConstruction_validate (FT_Bytes table, OTV_Validator otvalid)
 
static void otv_MathVariants_validate (FT_Bytes table, OTV_Validator otvalid)
 
 otv_MATH_validate (FT_Bytes table, FT_UInt glyph_count, FT_Validator ftvalid)
 

Macro Definition Documentation

◆ FT_COMPONENT

#define FT_COMPONENT   trace_otvmath

Definition at line 33 of file otvmath.c.

Function Documentation

◆ otv_GlyphAssembly_validate()

static void otv_GlyphAssembly_validate ( FT_Bytes  table,
OTV_Validator  otvalid 
)
static

Definition at line 274 of file otvmath.c.

276 {
277 FT_Bytes p = table;
278 FT_UInt pcnt, table_size;
279 FT_UInt i;
280
281 OTV_OPTIONAL_TABLE( DeviceTableOffset );
282
283
284 /* OTV_NAME_ENTER( "GlyphAssembly" ); */
285
286 OTV_LIMIT_CHECK( 6 );
287
288 p += 2; /* Skip the Italics Correction value */
289 OTV_OPTIONAL_OFFSET( DeviceTableOffset );
290 pcnt = FT_NEXT_USHORT( p );
291
292 OTV_LIMIT_CHECK( 8 * pcnt );
293 table_size = 6 + 8 * pcnt;
294
295 OTV_SIZE_CHECK( DeviceTableOffset );
296 if ( DeviceTableOffset )
297 otv_Device_validate( table + DeviceTableOffset, otvalid );
298
299 for ( i = 0; i < pcnt; i++ )
300 {
301 FT_UInt gid;
302
303
304 gid = FT_NEXT_USHORT( p );
305 if ( gid >= otvalid->glyph_count )
307 p += 2*4; /* skip the Start, End, Full, and Flags fields */
308 }
309
310 /* OTV_EXIT; */
311 }
#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_GLYPH_ID
Definition: ftvalid.h:146
GLfloat GLfloat p
Definition: glext.h:8902
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
otv_Device_validate(FT_Bytes table, OTV_Validator otvalid)
Definition: otvcommn.c:307
#define OTV_SIZE_CHECK(_size)
Definition: otvcommn.h:97
#define OTV_OPTIONAL_OFFSET(_offset)
Definition: otvcommn.h:79
#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_MathGlyphConstruction_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 }
#define FT_TRACE3(varformat)
Definition: ftdebug.h:160
#define FT_TRACE4(varformat)
Definition: ftdebug.h:161
#define FT_NEXT_ULONG(buffer)
Definition: ftstream.h:238
#define FT_INVALID_FORMAT
Definition: ftvalid.h:142
typedefFT_BEGIN_HEADER struct OTV_ValidatorRec_ * OTV_Validator
Definition: otvcommn.h:39
#define OTV_INIT
Definition: otvcommn.h:225
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().

◆ otv_MathConstants_validate()

static void otv_MathConstants_validate ( FT_Bytes  table,
OTV_Validator  otvalid 
)
static

Definition at line 46 of file otvmath.c.

48 {
50 FT_UInt i;
52
53 OTV_OPTIONAL_TABLE( DeviceTableOffset );
54
55
56 OTV_NAME_ENTER( "MathConstants" );
57
58 /* 56 constants, 51 have device tables */
59 OTV_LIMIT_CHECK( 2 * ( 56 + 51 ) );
60 table_size = 2 * ( 56 + 51 );
61
62 p += 4 * 2; /* First 4 constants have no device tables */
63 for ( i = 0; i < 51; i++ )
64 {
65 p += 2; /* skip the value */
66 OTV_OPTIONAL_OFFSET( DeviceTableOffset );
67 OTV_SIZE_CHECK( DeviceTableOffset );
68 if ( DeviceTableOffset )
69 otv_Device_validate( table + DeviceTableOffset, otvalid );
70 }
71
73 }
#define OTV_EXIT
Definition: otvcommn.h:228
#define OTV_NAME_ENTER(name)
Definition: otvcommn.h:227

Referenced by otv_MATH_validate().

◆ otv_MathGlyphConstruction_validate()

static void otv_MathGlyphConstruction_validate ( FT_Bytes  table,
OTV_Validator  otvalid 
)
static

Definition at line 315 of file otvmath.c.

317 {
318 FT_Bytes p = table;
319 FT_UInt vcnt, table_size;
320 FT_UInt i;
321
322 OTV_OPTIONAL_TABLE( GlyphAssembly );
323
324
325 /* OTV_NAME_ENTER( "MathGlyphConstruction" ); */
326
327 OTV_LIMIT_CHECK( 4 );
328
329 OTV_OPTIONAL_OFFSET( GlyphAssembly );
330 vcnt = FT_NEXT_USHORT( p );
331
332 OTV_LIMIT_CHECK( 4 * vcnt );
333 table_size = 4 + 4 * vcnt;
334
335 for ( i = 0; i < vcnt; i++ )
336 {
337 FT_UInt gid;
338
339
340 gid = FT_NEXT_USHORT( p );
341 if ( gid >= otvalid->glyph_count )
343 p += 2; /* skip the size */
344 }
345
346 OTV_SIZE_CHECK( GlyphAssembly );
347 if ( GlyphAssembly )
348 otv_GlyphAssembly_validate( table+GlyphAssembly, otvalid );
349
350 /* OTV_EXIT; */
351 }
static void otv_GlyphAssembly_validate(FT_Bytes table, OTV_Validator otvalid)
Definition: otvmath.c:274

Referenced by otv_MathVariants_validate().

◆ otv_MathGlyphInfo_validate()

static void otv_MathGlyphInfo_validate ( FT_Bytes  table,
OTV_Validator  otvalid 
)
static

Definition at line 225 of file otvmath.c.

227 {
228 FT_Bytes p = table;
229 FT_UInt MathItalicsCorrectionInfo, MathTopAccentAttachment;
230 FT_UInt ExtendedShapeCoverage, MathKernInfo;
231
232
233 OTV_NAME_ENTER( "MathGlyphInfo" );
234
235 OTV_LIMIT_CHECK( 8 );
236
237 MathItalicsCorrectionInfo = FT_NEXT_USHORT( p );
238 MathTopAccentAttachment = FT_NEXT_USHORT( p );
239 ExtendedShapeCoverage = FT_NEXT_USHORT( p );
240 MathKernInfo = FT_NEXT_USHORT( p );
241
242 if ( MathItalicsCorrectionInfo )
244 table + MathItalicsCorrectionInfo, otvalid, TRUE );
245
246 /* Italic correction and Top Accent Attachment have the same format */
247 if ( MathTopAccentAttachment )
249 table + MathTopAccentAttachment, otvalid, FALSE );
250
251 if ( ExtendedShapeCoverage )
252 {
253 OTV_NAME_ENTER( "ExtendedShapeCoverage" );
254 otv_Coverage_validate( table + ExtendedShapeCoverage, otvalid, -1 );
255 OTV_EXIT;
256 }
257
258 if ( MathKernInfo )
259 otv_MathKernInfo_validate( table + MathKernInfo, otvalid );
260
261 OTV_EXIT;
262 }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
otv_Coverage_validate(FT_Bytes table, OTV_Validator otvalid, FT_Int expected_count)
Definition: otvcommn.c:41
static void otv_MathItalicsCorrectionInfo_validate(FT_Bytes table, OTV_Validator otvalid, FT_Int isItalic)
Definition: otvmath.c:86
static void otv_MathKernInfo_validate(FT_Bytes table, OTV_Validator otvalid)
Definition: otvmath.c:178

Referenced by otv_MATH_validate().

◆ otv_MathItalicsCorrectionInfo_validate()

static void otv_MathItalicsCorrectionInfo_validate ( FT_Bytes  table,
OTV_Validator  otvalid,
FT_Int  isItalic 
)
static

Definition at line 86 of file otvmath.c.

89 {
91 FT_UInt i, cnt, table_size;
92
93 OTV_OPTIONAL_TABLE( Coverage );
94 OTV_OPTIONAL_TABLE( DeviceTableOffset );
95
96 FT_UNUSED( isItalic ); /* only used if tracing is active */
97
98
99 OTV_NAME_ENTER( isItalic ? "MathItalicsCorrectionInfo"
100 : "MathTopAccentAttachment" );
101
102 OTV_LIMIT_CHECK( 4 );
103
104 OTV_OPTIONAL_OFFSET( Coverage );
105 cnt = FT_NEXT_USHORT( p );
106
107 OTV_LIMIT_CHECK( 4 * cnt );
108 table_size = 4 + 4 * cnt;
109
110 OTV_SIZE_CHECK( Coverage );
111 otv_Coverage_validate( table + Coverage, otvalid, (FT_Int)cnt );
112
113 for ( i = 0; i < cnt; i++ )
114 {
115 p += 2; /* Skip the value */
116 OTV_OPTIONAL_OFFSET( DeviceTableOffset );
117 OTV_SIZE_CHECK( DeviceTableOffset );
118 if ( DeviceTableOffset )
119 otv_Device_validate( table + DeviceTableOffset, otvalid );
120 }
121
122 OTV_EXIT;
123 }
#define FT_UNUSED(arg)
Definition: ftconfig.h:101
signed int FT_Int
Definition: fttypes.h:220

Referenced by otv_MathGlyphInfo_validate().

◆ otv_MathKern_validate()

static void otv_MathKern_validate ( FT_Bytes  table,
OTV_Validator  otvalid 
)
static

Definition at line 135 of file otvmath.c.

137 {
138 FT_Bytes p = table;
139 FT_UInt i, cnt, table_size;
140
141 OTV_OPTIONAL_TABLE( DeviceTableOffset );
142
143
144 /* OTV_NAME_ENTER( "MathKern" );*/
145
146 OTV_LIMIT_CHECK( 2 );
147
148 cnt = FT_NEXT_USHORT( p );
149
150 OTV_LIMIT_CHECK( 4 * cnt + 2 );
151 table_size = 4 + 4 * cnt;
152
153 /* Heights */
154 for ( i = 0; i < cnt; i++ )
155 {
156 p += 2; /* Skip the value */
157 OTV_OPTIONAL_OFFSET( DeviceTableOffset );
158 OTV_SIZE_CHECK( DeviceTableOffset );
159 if ( DeviceTableOffset )
160 otv_Device_validate( table + DeviceTableOffset, otvalid );
161 }
162
163 /* One more Kerning value */
164 for ( i = 0; i < cnt + 1; i++ )
165 {
166 p += 2; /* Skip the value */
167 OTV_OPTIONAL_OFFSET( DeviceTableOffset );
168 OTV_SIZE_CHECK( DeviceTableOffset );
169 if ( DeviceTableOffset )
170 otv_Device_validate( table + DeviceTableOffset, otvalid );
171 }
172
173 OTV_EXIT;
174 }

Referenced by otv_MathKernInfo_validate().

◆ otv_MathKernInfo_validate()

static void otv_MathKernInfo_validate ( FT_Bytes  table,
OTV_Validator  otvalid 
)
static

Definition at line 178 of file otvmath.c.

180 {
181 FT_Bytes p = table;
182 FT_UInt i, j, cnt, table_size;
183
184 OTV_OPTIONAL_TABLE( Coverage );
185 OTV_OPTIONAL_TABLE( MKRecordOffset );
186
187
188 OTV_NAME_ENTER( "MathKernInfo" );
189
190 OTV_LIMIT_CHECK( 4 );
191
192 OTV_OPTIONAL_OFFSET( Coverage );
193 cnt = FT_NEXT_USHORT( p );
194
195 OTV_LIMIT_CHECK( 8 * cnt );
196 table_size = 4 + 8 * cnt;
197
198 OTV_SIZE_CHECK( Coverage );
199 otv_Coverage_validate( table + Coverage, otvalid, (FT_Int)cnt );
200
201 for ( i = 0; i < cnt; i++ )
202 {
203 for ( j = 0; j < 4; j++ )
204 {
205 OTV_OPTIONAL_OFFSET( MKRecordOffset );
206 OTV_SIZE_CHECK( MKRecordOffset );
207 if ( MKRecordOffset )
208 otv_MathKern_validate( table + MKRecordOffset, otvalid );
209 }
210 }
211
212 OTV_EXIT;
213 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
static void otv_MathKern_validate(FT_Bytes table, OTV_Validator otvalid)
Definition: otvmath.c:135

Referenced by otv_MathGlyphInfo_validate().

◆ otv_MathVariants_validate()

static void otv_MathVariants_validate ( FT_Bytes  table,
OTV_Validator  otvalid 
)
static

Definition at line 355 of file otvmath.c.

357 {
358 FT_Bytes p = table;
359 FT_UInt vcnt, hcnt, i, table_size;
360
361 OTV_OPTIONAL_TABLE( VCoverage );
362 OTV_OPTIONAL_TABLE( HCoverage );
364
365
366 OTV_NAME_ENTER( "MathVariants" );
367
368 OTV_LIMIT_CHECK( 10 );
369
370 p += 2; /* Skip the MinConnectorOverlap constant */
371 OTV_OPTIONAL_OFFSET( VCoverage );
372 OTV_OPTIONAL_OFFSET( HCoverage );
373 vcnt = FT_NEXT_USHORT( p );
374 hcnt = FT_NEXT_USHORT( p );
375
376 OTV_LIMIT_CHECK( 2 * vcnt + 2 * hcnt );
377 table_size = 10 + 2 * vcnt + 2 * hcnt;
378
379 OTV_SIZE_CHECK( VCoverage );
380 if ( VCoverage )
381 otv_Coverage_validate( table + VCoverage, otvalid, (FT_Int)vcnt );
382
383 OTV_SIZE_CHECK( HCoverage );
384 if ( HCoverage )
385 otv_Coverage_validate( table + HCoverage, otvalid, (FT_Int)hcnt );
386
387 for ( i = 0; i < vcnt; i++ )
388 {
392 }
393
394 for ( i = 0; i < hcnt; i++ )
395 {
399 }
400
401 OTV_EXIT;
402 }
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
static void otv_MathGlyphConstruction_validate(FT_Bytes table, OTV_Validator otvalid)
Definition: otvmath.c:315

Referenced by otv_MATH_validate().