ReactOS 0.4.16-dev-1067-ge98bba2
gxvmort.c File Reference
#include "gxvmort.h"
#include "gxvfeat.h"
Include dependency graph for gxvmort.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define FT_COMPONENT   gxvmort
 

Functions

static void gxv_mort_feature_validate (GXV_mort_feature f, GXV_Validator gxvalid)
 
 gxv_mort_featurearray_validate (FT_Bytes table, FT_Bytes limit, FT_ULong nFeatureFlags, GXV_Validator gxvalid)
 
 gxv_mort_coverage_validate (FT_UShort coverage, GXV_Validator gxvalid)
 
static void gxv_mort_subtables_validate (FT_Bytes table, FT_Bytes limit, FT_UShort nSubtables, GXV_Validator gxvalid)
 
static void gxv_mort_chain_validate (FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
 
 gxv_mort_validate (FT_Bytes table, FT_Face face, FT_Validator ftvalid)
 

Macro Definition Documentation

◆ FT_COMPONENT

#define FT_COMPONENT   gxvmort

Definition at line 39 of file gxvmort.c.

Function Documentation

◆ gxv_mort_chain_validate()

static void gxv_mort_chain_validate ( FT_Bytes  table,
FT_Bytes  limit,
GXV_Validator  gxvalid 
)
static

Definition at line 225 of file gxvmort.c.

228 {
229 FT_Bytes p = table;
230#ifdef GXV_LOAD_UNUSED_VARS
231 FT_ULong defaultFlags;
232#endif
233 FT_ULong chainLength;
234 FT_UShort nFeatureFlags;
235 FT_UShort nSubtables;
236
237
238 GXV_NAME_ENTER( "mort chain header" );
239
240 GXV_LIMIT_CHECK( 4 + 4 + 2 + 2 );
241#ifdef GXV_LOAD_UNUSED_VARS
242 defaultFlags = FT_NEXT_ULONG( p );
243#else
244 p += 4;
245#endif
246 chainLength = FT_NEXT_ULONG( p );
247 nFeatureFlags = FT_NEXT_USHORT( p );
248 nSubtables = FT_NEXT_USHORT( p );
249
250 gxv_mort_featurearray_validate( p, table + chainLength,
251 nFeatureFlags, gxvalid );
252 p += gxvalid->subtable_length;
253 gxv_mort_subtables_validate( p, table + chainLength, nSubtables, gxvalid );
254 gxvalid->subtable_length = chainLength;
255
256 /* TODO: validate defaultFlags */
257 GXV_EXIT;
258 }
#define FT_NEXT_USHORT(buffer)
Definition: ftstream.h:233
#define FT_NEXT_ULONG(buffer)
Definition: ftstream.h:245
unsigned long FT_ULong
Definition: fttypes.h:253
unsigned short FT_UShort
Definition: fttypes.h:209
const FT_Byte * FT_Bytes
Definition: fttypes.h:165
GLfloat GLfloat p
Definition: glext.h:8902
#define GXV_NAME_ENTER(name)
Definition: gxvcommn.h:301
#define GXV_EXIT
Definition: gxvcommn.h:302
#define GXV_LIMIT_CHECK(_count)
Definition: gxvcommn.h:272
static void gxv_mort_subtables_validate(FT_Bytes table, FT_Bytes limit, FT_UShort nSubtables, GXV_Validator gxvalid)
Definition: gxvmort.c:152
gxv_mort_featurearray_validate(FT_Bytes table, FT_Bytes limit, FT_ULong nFeatureFlags, GXV_Validator gxvalid)
Definition: gxvmort.c:90
FT_ULong subtable_length
Definition: gxvcommn.h:244

Referenced by gxv_mort_validate().

◆ gxv_mort_coverage_validate()

gxv_mort_coverage_validate ( FT_UShort  coverage,
GXV_Validator  gxvalid 
)

Definition at line 122 of file gxvmort.c.

124 {
125 FT_UNUSED( gxvalid );
126 FT_UNUSED( coverage );
127
128#ifdef FT_DEBUG_LEVEL_TRACE
129 if ( coverage & 0x8000U )
130 GXV_TRACE(( " this subtable is for vertical text only\n" ));
131 else
132 GXV_TRACE(( " this subtable is for horizontal text only\n" ));
133
134 if ( coverage & 0x4000 )
135 GXV_TRACE(( " this subtable is applied to glyph array "
136 "in descending order\n" ));
137 else
138 GXV_TRACE(( " this subtable is applied to glyph array "
139 "in ascending order\n" ));
140
141 if ( coverage & 0x2000 )
142 GXV_TRACE(( " this subtable is forcibly applied to "
143 "vertical/horizontal text\n" ));
144
145 if ( coverage & 0x1FF8 )
146 GXV_TRACE(( " coverage has non-zero bits in reserved area\n" ));
147#endif
148 }
#define FT_UNUSED(arg)
Definition: ftconfig.h:100
#define GXV_TRACE(s)
Definition: gxvcommn.h:304

Referenced by gxv_mort_subtables_validate(), and gxv_morx_subtables_validate().

◆ gxv_mort_feature_validate()

static void gxv_mort_feature_validate ( GXV_mort_feature  f,
GXV_Validator  gxvalid 
)
static

Definition at line 43 of file gxvmort.c.

45 {
46 if ( f->featureType >= gxv_feat_registry_length )
47 {
48 GXV_TRACE(( "featureType %d is out of registered range, "
49 "setting %d is unchecked\n",
50 f->featureType, f->featureSetting ));
52 }
53 else if ( !gxv_feat_registry[f->featureType].existence )
54 {
55 GXV_TRACE(( "featureType %d is within registered area "
56 "but undefined, setting %d is unchecked\n",
57 f->featureType, f->featureSetting ));
59 }
60 else
61 {
62 FT_Byte nSettings_max;
63
64
65 /* nSettings in gxvfeat.c is halved for exclusive on/off settings */
66 nSettings_max = gxv_feat_registry[f->featureType].nSettings;
67 if ( gxv_feat_registry[f->featureType].exclusive )
68 nSettings_max = (FT_Byte)( 2 * nSettings_max );
69
70 GXV_TRACE(( "featureType %d is registered", f->featureType ));
71 GXV_TRACE(( "setting %d", f->featureSetting ));
72
73 if ( f->featureSetting > nSettings_max )
74 {
75 GXV_TRACE(( "out of defined range %d", nSettings_max ));
77 }
78 GXV_TRACE(( "\n" ));
79 }
80
81 /* TODO: enableFlags must be unique value in specified chain? */
82 }
unsigned char FT_Byte
Definition: fttypes.h:154
#define FT_INVALID_DATA
Definition: ftvalid.h:150
GLfloat f
Definition: glext.h:7540
#define GXV_SET_ERR_IF_PARANOID(err)
Definition: gxvcommn.h:66
static GX_Feature_RegistryRec gxv_feat_registry[]
Definition: gxvfeat.h:60
#define gxv_feat_registry_length
Definition: gxvfeat.h:55

Referenced by gxv_mort_featurearray_validate().

◆ gxv_mort_featurearray_validate()

gxv_mort_featurearray_validate ( FT_Bytes  table,
FT_Bytes  limit,
FT_ULong  nFeatureFlags,
GXV_Validator  gxvalid 
)

Definition at line 90 of file gxvmort.c.

94 {
96 FT_ULong i;
97
99
100
101 GXV_NAME_ENTER( "mort feature list" );
102 for ( i = 0; i < nFeatureFlags; i++ )
103 {
104 GXV_LIMIT_CHECK( 2 + 2 + 4 + 4 );
105 f.featureType = FT_NEXT_USHORT( p );
106 f.featureSetting = FT_NEXT_USHORT( p );
107 f.enableFlags = FT_NEXT_ULONG( p );
108 f.disableFlags = FT_NEXT_ULONG( p );
109
110 gxv_mort_feature_validate( &f, gxvalid );
111 }
112
113 if ( !IS_GXV_MORT_FEATURE_OFF( f ) )
115
116 gxvalid->subtable_length = (FT_ULong)( p - table );
117 GXV_EXIT;
118 }
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
static void gxv_mort_feature_validate(GXV_mort_feature f, GXV_Validator gxvalid)
Definition: gxvmort.c:43
#define GXV_MORT_FEATURE_OFF
Definition: gxvmort.h:46
#define IS_GXV_MORT_FEATURE_OFF(f)
Definition: gxvmort.h:48

Referenced by gxv_mort_chain_validate(), and gxv_morx_chain_validate().

◆ gxv_mort_subtables_validate()

static void gxv_mort_subtables_validate ( FT_Bytes  table,
FT_Bytes  limit,
FT_UShort  nSubtables,
GXV_Validator  gxvalid 
)
static

Definition at line 152 of file gxvmort.c.

156 {
157 FT_Bytes p = table;
158
159 GXV_Validate_Func fmt_funcs_table[] =
160 {
164 NULL, /* 3 */
167
168 };
169
170 FT_UShort i;
171
172
173 GXV_NAME_ENTER( "subtables in a chain" );
174
175 for ( i = 0; i < nSubtables; i++ )
176 {
178
180 FT_UShort coverage;
181#ifdef GXV_LOAD_UNUSED_VARS
182 FT_ULong subFeatureFlags;
183#endif
185 FT_UInt rest;
186
187
188 GXV_LIMIT_CHECK( 2 + 2 + 4 );
190 coverage = FT_NEXT_USHORT( p );
191#ifdef GXV_LOAD_UNUSED_VARS
192 subFeatureFlags = FT_NEXT_ULONG( p );
193#else
194 p += 4;
195#endif
196
197 GXV_TRACE(( "validating chain subtable %d/%d (%d bytes)\n",
198 i + 1, nSubtables, length ));
199 type = coverage & 0x0007;
200 rest = length - ( 2 + 2 + 4 );
201
202 GXV_LIMIT_CHECK( rest );
203 gxv_mort_coverage_validate( coverage, gxvalid );
204
205 if ( type > 5 )
207
208 func = fmt_funcs_table[type];
209 if ( !func )
210 GXV_TRACE(( "morx type %d is reserved\n", type ));
211
212 func( p, p + rest, gxvalid );
213
214 p += rest;
215 /* TODO: validate subFeatureFlags */
216 }
217
218 gxvalid->subtable_length = (FT_ULong)( p - table );
219
220 GXV_EXIT;
221 }
#define NULL
Definition: types.h:112
unsigned int FT_UInt
Definition: fttypes.h:231
#define FT_INVALID_FORMAT
Definition: ftvalid.h:142
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLenum func
Definition: glext.h:6028
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
void(* GXV_Validate_Func)(FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
Definition: gxvcommn.h:82
gxv_mort_coverage_validate(FT_UShort coverage, GXV_Validator gxvalid)
Definition: gxvmort.c:122
gxv_mort_subtable_type1_validate(FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
Definition: gxvmort1.c:225
gxv_mort_subtable_type0_validate(FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
Definition: gxvmort0.c:127
gxv_mort_subtable_type4_validate(FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
Definition: gxvmort4.c:106
gxv_mort_subtable_type2_validate(FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
Definition: gxvmort2.c:277
gxv_mort_subtable_type5_validate(FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
Definition: gxvmort5.c:203

Referenced by gxv_mort_chain_validate().

◆ gxv_mort_validate()

gxv_mort_validate ( FT_Bytes  table,
FT_Face  face,
FT_Validator  ftvalid 
)

Definition at line 262 of file gxvmort.c.

265 {
266 GXV_ValidatorRec gxvalidrec;
267 GXV_Validator gxvalid = &gxvalidrec;
268 FT_Bytes p = table;
269 FT_Bytes limit = 0;
271 FT_ULong nChains;
272 FT_ULong i;
273
274
275 gxvalid->root = ftvalid;
276 gxvalid->face = face;
277 limit = gxvalid->root->limit;
278
279 FT_TRACE3(( "validating `mort' table\n" ));
280 GXV_INIT;
281
282 GXV_LIMIT_CHECK( 4 + 4 );
284 nChains = FT_NEXT_ULONG( p );
285
286 if (version != 0x00010000UL)
288
289 for ( i = 0; i < nChains; i++ )
290 {
291 GXV_TRACE(( "validating chain %d/%d\n", i + 1, nChains ));
293 gxv_mort_chain_validate( p, limit, gxvalid );
294 p += gxvalid->subtable_length;
295 }
296
297 FT_TRACE4(( "\n" ));
298 }
WORD face[3]
Definition: mesh.c:4747
static const WCHAR version[]
Definition: asmname.c:66
#define FT_TRACE3(varformat)
Definition: ftdebug.h:188
#define FT_TRACE4(varformat)
Definition: ftdebug.h:189
GLint limit
Definition: glext.h:10326
#define GXV_32BIT_ALIGNMENT_VALIDATE(a)
Definition: gxvcommn.h:317
#define GXV_INIT
Definition: gxvcommn.h:300
static void gxv_mort_chain_validate(FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
Definition: gxvmort.c:225
FT_Validator root
Definition: gxvcommn.h:239