ReactOS 0.4.16-dev-297-gc569aee
gxvprop.c File Reference
#include "gxvalid.h"
#include "gxvcommn.h"
Include dependency graph for gxvprop.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  GXV_prop_DataRec_
 

Macros

#define FT_COMPONENT   trace_gxvprop
 
#define GXV_PROP_HEADER_SIZE   ( 4 + 2 + 2 )
 
#define GXV_PROP_SIZE_MIN   GXV_PROP_HEADER_SIZE
 
#define GXV_PROP_DATA(field)   GXV_TABLE_DATA( prop, field )
 
#define GXV_PROP_FLOATER   0x8000U
 
#define GXV_PROP_USE_COMPLEMENTARY_BRACKET   0x1000U
 
#define GXV_PROP_COMPLEMENTARY_BRACKET_OFFSET   0x0F00U
 
#define GXV_PROP_ATTACHING_TO_RIGHT   0x0080U
 
#define GXV_PROP_RESERVED   0x0060U
 
#define GXV_PROP_DIRECTIONALITY_CLASS   0x001FU
 

Typedefs

typedef struct GXV_prop_DataRec_ GXV_prop_DataRec
 
typedef struct GXV_prop_DataRec_GXV_prop_Data
 

Functions

static void gxv_prop_zero_advance_validate (FT_UShort gid, GXV_Validator gxvalid)
 
static void gxv_prop_property_validate (FT_UShort property, FT_UShort glyph, GXV_Validator gxvalid)
 
static void gxv_prop_LookupValue_validate (FT_UShort glyph, GXV_LookupValueCPtr value_p, GXV_Validator gxvalid)
 
static GXV_LookupValueDesc gxv_prop_LookupFmt4_transit (FT_UShort relative_gindex, GXV_LookupValueCPtr base_value_p, FT_Bytes lookuptbl_limit, GXV_Validator gxvalid)
 
 gxv_prop_validate (FT_Bytes table, FT_Face face, FT_Validator ftvalid)
 

Macro Definition Documentation

◆ FT_COMPONENT

#define FT_COMPONENT   trace_gxvprop

Definition at line 39 of file gxvprop.c.

◆ GXV_PROP_ATTACHING_TO_RIGHT

#define GXV_PROP_ATTACHING_TO_RIGHT   0x0080U

Definition at line 64 of file gxvprop.c.

◆ GXV_PROP_COMPLEMENTARY_BRACKET_OFFSET

#define GXV_PROP_COMPLEMENTARY_BRACKET_OFFSET   0x0F00U

Definition at line 63 of file gxvprop.c.

◆ GXV_PROP_DATA

#define GXV_PROP_DATA (   field)    GXV_TABLE_DATA( prop, field )

Definition at line 59 of file gxvprop.c.

◆ GXV_PROP_DIRECTIONALITY_CLASS

#define GXV_PROP_DIRECTIONALITY_CLASS   0x001FU

Definition at line 66 of file gxvprop.c.

◆ GXV_PROP_FLOATER

#define GXV_PROP_FLOATER   0x8000U

Definition at line 61 of file gxvprop.c.

◆ GXV_PROP_HEADER_SIZE

#define GXV_PROP_HEADER_SIZE   ( 4 + 2 + 2 )

Definition at line 50 of file gxvprop.c.

◆ GXV_PROP_RESERVED

#define GXV_PROP_RESERVED   0x0060U

Definition at line 65 of file gxvprop.c.

◆ GXV_PROP_SIZE_MIN

#define GXV_PROP_SIZE_MIN   GXV_PROP_HEADER_SIZE

Definition at line 51 of file gxvprop.c.

◆ GXV_PROP_USE_COMPLEMENTARY_BRACKET

#define GXV_PROP_USE_COMPLEMENTARY_BRACKET   0x1000U

Definition at line 62 of file gxvprop.c.

Typedef Documentation

◆ GXV_prop_Data

◆ GXV_prop_DataRec

Function Documentation

◆ gxv_prop_LookupFmt4_transit()

static GXV_LookupValueDesc gxv_prop_LookupFmt4_transit ( FT_UShort  relative_gindex,
GXV_LookupValueCPtr  base_value_p,
FT_Bytes  lookuptbl_limit,
GXV_Validator  gxvalid 
)
static

Definition at line 225 of file gxvprop.c.

229 {
230 FT_Bytes p;
234
235 /* XXX: check range? */
236 offset = (FT_UShort)( base_value_p->u +
237 relative_gindex * sizeof ( FT_UShort ) );
238 p = gxvalid->lookuptbl_head + offset;
239 limit = lookuptbl_limit;
240
241 GXV_LIMIT_CHECK ( 2 );
242 value.u = FT_NEXT_USHORT( p );
243
244 return value;
245 }
#define FT_NEXT_USHORT(buffer)
Definition: ftstream.h:226
unsigned short FT_UShort
Definition: fttypes.h:209
const FT_Byte * FT_Bytes
Definition: fttypes.h:165
GLint limit
Definition: glext.h:10326
GLfloat GLfloat p
Definition: glext.h:8902
GLintptr offset
Definition: glext.h:5920
#define GXV_LIMIT_CHECK(_count)
Definition: gxvcommn.h:272
FT_Bytes lookuptbl_head
Definition: gxvcommn.h:249
Definition: pdh_main.c:94
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList

Referenced by gxv_prop_validate().

◆ gxv_prop_LookupValue_validate()

static void gxv_prop_LookupValue_validate ( FT_UShort  glyph,
GXV_LookupValueCPtr  value_p,
GXV_Validator  gxvalid 
)
static

Definition at line 189 of file gxvprop.c.

192 {
193 gxv_prop_property_validate( value_p->u, glyph, gxvalid );
194 }
static void gxv_prop_property_validate(FT_UShort property, FT_UShort glyph, GXV_Validator gxvalid)
Definition: gxvprop.c:111

Referenced by gxv_prop_validate().

◆ gxv_prop_property_validate()

static void gxv_prop_property_validate ( FT_UShort  property,
FT_UShort  glyph,
GXV_Validator  gxvalid 
)
static

Definition at line 111 of file gxvprop.c.

114 {
115 if ( glyph != 0 && ( property & GXV_PROP_FLOATER ) )
116 gxv_prop_zero_advance_validate( glyph, gxvalid );
117
119 {
121 char complement;
122
123
125 if ( offset == 0 )
126 {
127 GXV_TRACE(( " found zero offset to property\n" ));
129 }
130
131 complement = (char)( offset >> 8 );
132 if ( complement & 0x08 )
133 {
134 /* Top bit is set: negative */
135
136 /* Calculate the absolute offset */
137 complement = (char)( ( complement & 0x07 ) + 1 );
138
139 /* The gid for complement must be greater than 0 */
140 if ( glyph <= complement )
141 {
142 GXV_TRACE(( " found non-positive glyph complement\n" ));
144 }
145 }
146 else
147 {
148 /* The gid for complement must be the face. */
149 gxv_glyphid_validate( (FT_UShort)( glyph + complement ), gxvalid );
150 }
151 }
152 else
153 {
155 GXV_TRACE(( "glyph %d cannot have complementary bracketing\n",
156 glyph ));
157 }
158
159 /* this is introduced in version 2.0 */
161 {
162 if ( GXV_PROP_DATA( version ) == 0x00010000UL )
163 {
164 GXV_TRACE(( " found older version (1.0) in new version table\n" ));
166 }
167 }
168
170 {
171 GXV_TRACE(( " found non-zero bits in reserved bits\n" ));
173 }
174
176 {
177 /* TODO: Too restricted. Use the validation level. */
178 if ( GXV_PROP_DATA( version ) == 0x00010000UL ||
179 GXV_PROP_DATA( version ) == 0x00020000UL )
180 {
181 GXV_TRACE(( " found too old version in directionality class\n" ));
183 }
184 }
185 }
static const WCHAR version[]
Definition: asmname.c:66
unsigned char
Definition: typeof.h:29
#define FT_INVALID_OFFSET
Definition: ftvalid.h:138
#define FT_INVALID_DATA
Definition: ftvalid.h:150
gxv_glyphid_validate(FT_UShort gid, GXV_Validator gxvalid)
Definition: gxvcommn.c:813
#define GXV_TRACE(s)
Definition: gxvcommn.h:304
#define GXV_PROP_USE_COMPLEMENTARY_BRACKET
Definition: gxvprop.c:62
#define GXV_PROP_DATA(field)
Definition: gxvprop.c:59
#define GXV_PROP_DIRECTIONALITY_CLASS
Definition: gxvprop.c:66
#define GXV_PROP_RESERVED
Definition: gxvprop.c:65
static void gxv_prop_zero_advance_validate(FT_UShort gid, GXV_Validator gxvalid)
Definition: gxvprop.c:78
#define GXV_PROP_COMPLEMENTARY_BRACKET_OFFSET
Definition: gxvprop.c:63
#define GXV_PROP_FLOATER
Definition: gxvprop.c:61
#define GXV_PROP_ATTACHING_TO_RIGHT
Definition: gxvprop.c:64

Referenced by gxv_prop_LookupValue_validate(), and gxv_prop_validate().

◆ gxv_prop_validate()

gxv_prop_validate ( FT_Bytes  table,
FT_Face  face,
FT_Validator  ftvalid 
)

Definition at line 257 of file gxvprop.c.

260 {
261 FT_Bytes p = table;
262 FT_Bytes limit = 0;
263 GXV_ValidatorRec gxvalidrec;
264 GXV_Validator gxvalid = &gxvalidrec;
265
266 GXV_prop_DataRec proprec;
267 GXV_prop_Data prop = &proprec;
268
271 FT_UShort defaultProp;
272
273
274 gxvalid->root = ftvalid;
275 gxvalid->table_data = prop;
276 gxvalid->face = face;
277
278 FT_TRACE3(( "validating `prop' table\n" ));
279 GXV_INIT;
280
281 GXV_LIMIT_CHECK( 4 + 2 + 2 );
284 defaultProp = FT_NEXT_USHORT( p );
285
286 GXV_TRACE(( " version 0x%08x\n", version ));
287 GXV_TRACE(( " format 0x%04x\n", format ));
288 GXV_TRACE(( " defaultProp 0x%04x\n", defaultProp ));
289
290 /* only versions 1.0, 2.0, 3.0 are defined (1996) */
291 if ( version != 0x00010000UL &&
292 version != 0x00020000UL &&
293 version != 0x00030000UL )
294 {
295 GXV_TRACE(( " found unknown version\n" ));
297 }
298
299
300 /* only formats 0x0000, 0x0001 are defined (1996) */
301 if ( format > 1 )
302 {
303 GXV_TRACE(( " found unknown format\n" ));
305 }
306
307 gxv_prop_property_validate( defaultProp, 0, gxvalid );
308
309 if ( format == 0 )
310 {
311 FT_TRACE3(( "(format 0, no per-glyph properties, "
312 "remaining %d bytes are skipped)", limit - p ));
313 goto Exit;
314 }
315
316 /* format == 1 */
318
322
323 gxv_LookupTable_validate( p, limit, gxvalid );
324
325 Exit:
326 FT_TRACE4(( "\n" ));
327 }
WORD face[3]
Definition: mesh.c:4747
#define FT_TRACE3(varformat)
Definition: ftdebug.h:160
#define FT_TRACE4(varformat)
Definition: ftdebug.h:161
#define FT_NEXT_LONG(buffer)
Definition: ftstream.h:235
signed long FT_Fixed
Definition: fttypes.h:288
#define FT_INVALID_FORMAT
Definition: ftvalid.h:142
gxv_LookupTable_validate(FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
Definition: gxvcommn.c:755
@ GXV_LOOKUPVALUE_UNSIGNED
Definition: gxvcommn.h:100
#define GXV_INIT
Definition: gxvcommn.h:300
static void gxv_prop_LookupValue_validate(FT_UShort glyph, GXV_LookupValueCPtr value_p, GXV_Validator gxvalid)
Definition: gxvprop.c:189
static GXV_LookupValueDesc gxv_prop_LookupFmt4_transit(FT_UShort relative_gindex, GXV_LookupValueCPtr base_value_p, FT_Bytes lookuptbl_limit, GXV_Validator gxvalid)
Definition: gxvprop.c:225
static void Exit(void)
Definition: sock.c:1330
GXV_Lookup_Fmt4_Transit_Func lookupfmt4_trans
Definition: gxvcommn.h:248
FT_Validator root
Definition: gxvcommn.h:239
void * table_data
Definition: gxvcommn.h:242
GXV_Lookup_Value_Validate_Func lookupval_func
Definition: gxvcommn.h:247
GXV_LookupValue_SignSpec lookupval_sign
Definition: gxvcommn.h:246
Definition: format.c:58

◆ gxv_prop_zero_advance_validate()

static void gxv_prop_zero_advance_validate ( FT_UShort  gid,
GXV_Validator  gxvalid 
)
static

Definition at line 78 of file gxvprop.c.

80 {
83 FT_GlyphSlot glyph;
84
85
86 GXV_NAME_ENTER( "zero advance" );
87
88 face = gxvalid->face;
89
91 gid,
93 if ( error )
95
96 glyph = face->glyph;
97
98 if ( glyph->advance.x != (FT_Pos)0 ||
99 glyph->advance.y != (FT_Pos)0 )
100 {
101 GXV_TRACE(( " found non-zero advance in zero-advance glyph\n" ));
103 }
104
105 GXV_EXIT;
106 }
FT_Load_Glyph(FT_Face face, FT_UInt glyph_index, FT_Int32 load_flags)
Definition: ftobjs.c:760
#define FT_LOAD_IGNORE_TRANSFORM
Definition: freetype.h:3019
FT_BEGIN_HEADER typedef signed long FT_Pos
Definition: ftimage.h:58
int FT_Error
Definition: fttypes.h:300
#define FT_INVALID_GLYPH_ID
Definition: ftvalid.h:146
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
#define GXV_NAME_ENTER(name)
Definition: gxvcommn.h:301
#define GXV_EXIT
Definition: gxvcommn.h:302
#define error(str)
Definition: mkdosfs.c:1605
FT_Vector advance
Definition: freetype.h:1919
FT_Pos x
Definition: ftimage.h:76
FT_Pos y
Definition: ftimage.h:77

Referenced by gxv_prop_property_validate().