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

Go to the source code of this file.

Classes

struct  GXV_mort_subtable_type2_StateOptRec_
 

Macros

#define FT_COMPONENT   trace_gxvmort
 
#define GXV_MORT_SUBTABLE_TYPE2_HEADER_SIZE    ( GXV_STATETABLE_HEADER_SIZE + 2 + 2 + 2 )
 

Typedefs

typedef struct GXV_mort_subtable_type2_StateOptRec_ GXV_mort_subtable_type2_StateOptRec
 
typedef struct GXV_mort_subtable_type2_StateOptRec_GXV_mort_subtable_type2_StateOptRecData
 

Functions

static void gxv_mort_subtable_type2_opttable_load (FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
 
static void gxv_mort_subtable_type2_subtable_setup (FT_UShort table_size, FT_UShort classTable, FT_UShort stateArray, FT_UShort entryTable, FT_UShort *classTable_length_p, FT_UShort *stateArray_length_p, FT_UShort *entryTable_length_p, GXV_Validator gxvalid)
 
static void gxv_mort_subtable_type2_ligActionOffset_validate (FT_Bytes table, FT_UShort ligActionOffset, GXV_Validator gxvalid)
 
static void gxv_mort_subtable_type2_entry_validate (FT_Byte state, FT_UShort flags, GXV_StateTable_GlyphOffsetCPtr glyphOffset_p, FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
 
static void gxv_mort_subtable_type2_ligatureTable_validate (FT_Bytes table, GXV_Validator gxvalid)
 
 gxv_mort_subtable_type2_validate (FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
 

Macro Definition Documentation

◆ FT_COMPONENT

#define FT_COMPONENT   trace_gxvmort

Definition at line 39 of file gxvmort2.c.

◆ GXV_MORT_SUBTABLE_TYPE2_HEADER_SIZE

#define GXV_MORT_SUBTABLE_TYPE2_HEADER_SIZE    ( GXV_STATETABLE_HEADER_SIZE + 2 + 2 + 2 )

Definition at line 54 of file gxvmort2.c.

Typedef Documentation

◆ GXV_mort_subtable_type2_StateOptRec

◆ GXV_mort_subtable_type2_StateOptRecData

Function Documentation

◆ gxv_mort_subtable_type2_entry_validate()

static void gxv_mort_subtable_type2_entry_validate ( FT_Byte  state,
FT_UShort  flags,
GXV_StateTable_GlyphOffsetCPtr  glyphOffset_p,
FT_Bytes  table,
FT_Bytes  limit,
GXV_Validator  gxvalid 
)
static

Definition at line 212 of file gxvmort2.c.

219 {
220#ifdef GXV_LOAD_UNUSED_VARS
221 FT_UShort setComponent;
222 FT_UShort dontAdvance;
223#endif
225
226 FT_UNUSED( state );
227 FT_UNUSED( glyphOffset_p );
228 FT_UNUSED( limit );
229
230
231#ifdef GXV_LOAD_UNUSED_VARS
232 setComponent = (FT_UShort)( ( flags >> 15 ) & 1 );
233 dontAdvance = (FT_UShort)( ( flags >> 14 ) & 1 );
234#endif
235
236 offset = (FT_UShort)( flags & 0x3FFFU );
237
238 if ( 0 < offset )
240 gxvalid );
241 }
static int state
Definition: maze.c:121
#define FT_UNUSED(arg)
Definition: ftconfig.h:101
unsigned short FT_UShort
Definition: fttypes.h:209
GLint limit
Definition: glext.h:10326
GLbitfield flags
Definition: glext.h:7161
GLintptr offset
Definition: glext.h:5920
static void gxv_mort_subtable_type2_ligActionOffset_validate(FT_Bytes table, FT_UShort ligActionOffset, GXV_Validator gxvalid)
Definition: gxvmort2.c:138

Referenced by gxv_mort_subtable_type2_validate().

◆ gxv_mort_subtable_type2_ligActionOffset_validate()

static void gxv_mort_subtable_type2_ligActionOffset_validate ( FT_Bytes  table,
FT_UShort  ligActionOffset,
GXV_Validator  gxvalid 
)
static

Definition at line 138 of file gxvmort2.c.

142 {
143 /* access ligActionTable */
146
147 FT_Bytes lat_base = table + optdata->ligActionTable;
148 FT_Bytes p = table + ligActionOffset;
149 FT_Bytes lat_limit = lat_base + optdata->ligActionTable;
150
151
152 GXV_32BIT_ALIGNMENT_VALIDATE( ligActionOffset );
153 if ( p < lat_base )
154 {
155 GXV_TRACE(( "too short offset 0x%04x: p < lat_base (%d byte rewind)\n",
156 ligActionOffset, lat_base - p ));
157
158 /* FontValidator, ftxvalidator, ftxdumperfuser warn but continue */
160 }
161 else if ( lat_limit < p )
162 {
163 GXV_TRACE(( "too large offset 0x%04x: lat_limit < p (%d byte overrun)\n",
164 ligActionOffset, p - lat_limit ));
165
166 /* FontValidator, ftxvalidator, ftxdumperfuser warn but continue */
168 }
169 else
170 {
171 /* validate entry in ligActionTable */
172 FT_ULong lig_action;
173#ifdef GXV_LOAD_UNUSED_VARS
175 FT_UShort store;
176#endif
178
179
180 lig_action = FT_NEXT_ULONG( p );
181#ifdef GXV_LOAD_UNUSED_VARS
182 last = (FT_UShort)( ( lig_action >> 31 ) & 1 );
183 store = (FT_UShort)( ( lig_action >> 30 ) & 1 );
184#endif
185
186 /* Apple spec defines this offset as a word offset */
187 offset = lig_action & 0x3FFFFFFFUL;
188 if ( offset * 2 < optdata->ligatureTable )
189 {
190 GXV_TRACE(( "too short offset 0x%08x:"
191 " 2 x offset < ligatureTable (%d byte rewind)\n",
192 offset, optdata->ligatureTable - offset * 2 ));
193
195 } else if ( offset * 2 >
196 optdata->ligatureTable + optdata->ligatureTable_length )
197 {
198 GXV_TRACE(( "too long offset 0x%08x:"
199 " 2 x offset > ligatureTable + ligatureTable_length"
200 " (%d byte overrun)\n",
201 offset,
202 optdata->ligatureTable + optdata->ligatureTable_length
203 - offset * 2 ));
204
206 }
207 }
208 }
#define FT_NEXT_ULONG(buffer)
Definition: ftstream.h:238
unsigned long FT_ULong
Definition: fttypes.h:253
const FT_Byte * FT_Bytes
Definition: fttypes.h:165
#define FT_INVALID_OFFSET
Definition: ftvalid.h:138
GLfloat GLfloat p
Definition: glext.h:8902
#define GXV_32BIT_ALIGNMENT_VALIDATE(a)
Definition: gxvcommn.h:317
#define GXV_SET_ERR_IF_PARANOID(err)
Definition: gxvcommn.h:66
#define GXV_TRACE(s)
Definition: gxvcommn.h:304
struct GXV_mort_subtable_type2_StateOptRec_ * GXV_mort_subtable_type2_StateOptRecData
static UINT UINT last
Definition: font.c:45
GXV_StateTable_ValidatorRec statetable
Definition: gxvcommn.h:254

Referenced by gxv_mort_subtable_type2_entry_validate().

◆ gxv_mort_subtable_type2_ligatureTable_validate()

static void gxv_mort_subtable_type2_ligatureTable_validate ( FT_Bytes  table,
GXV_Validator  gxvalid 
)
static

Definition at line 245 of file gxvmort2.c.

247 {
250
251 FT_Bytes p = table + optdata->ligatureTable;
252 FT_Bytes limit = table + optdata->ligatureTable
253 + optdata->ligatureTable_length;
254
255
256 GXV_NAME_ENTER( "mort chain subtable type2 - substitutionTable" );
257 if ( 0 != optdata->ligatureTable )
258 {
259 /* Apple does not give specification of ligatureTable format */
260 while ( p < limit )
261 {
262 FT_UShort lig_gid;
263
264
265 GXV_LIMIT_CHECK( 2 );
266 lig_gid = FT_NEXT_USHORT( p );
267
268 if ( gxvalid->face->num_glyphs < lig_gid )
270 }
271 }
272 GXV_EXIT;
273 }
#define FT_NEXT_USHORT(buffer)
Definition: ftstream.h:226
#define FT_INVALID_GLYPH_ID
Definition: ftvalid.h:146
#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
FT_Long num_glyphs
Definition: freetype.h:1076

Referenced by gxv_mort_subtable_type2_validate().

◆ gxv_mort_subtable_type2_opttable_load()

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

Definition at line 59 of file gxvmort2.c.

62 {
66
67
68 GXV_LIMIT_CHECK( 2 + 2 + 2 );
69 optdata->ligActionTable = FT_NEXT_USHORT( p );
70 optdata->componentTable = FT_NEXT_USHORT( p );
71 optdata->ligatureTable = FT_NEXT_USHORT( p );
72
73 GXV_TRACE(( "offset to ligActionTable=0x%04x\n",
74 optdata->ligActionTable ));
75 GXV_TRACE(( "offset to componentTable=0x%04x\n",
76 optdata->componentTable ));
77 GXV_TRACE(( "offset to ligatureTable=0x%04x\n",
78 optdata->ligatureTable ));
79 }

Referenced by gxv_mort_subtable_type2_validate().

◆ gxv_mort_subtable_type2_subtable_setup()

static void gxv_mort_subtable_type2_subtable_setup ( FT_UShort  table_size,
FT_UShort  classTable,
FT_UShort  stateArray,
FT_UShort  entryTable,
FT_UShort classTable_length_p,
FT_UShort stateArray_length_p,
FT_UShort entryTable_length_p,
GXV_Validator  gxvalid 
)
static

Definition at line 83 of file gxvmort2.c.

91 {
92 FT_UShort o[6];
93 FT_UShort *l[6];
94 FT_UShort buff[7];
95
98
99
100 GXV_NAME_ENTER( "subtable boundaries setup" );
101
102 o[0] = classTable;
103 o[1] = stateArray;
104 o[2] = entryTable;
105 o[3] = optdata->ligActionTable;
106 o[4] = optdata->componentTable;
107 o[5] = optdata->ligatureTable;
108 l[0] = classTable_length_p;
109 l[1] = stateArray_length_p;
110 l[2] = entryTable_length_p;
111 l[3] = &(optdata->ligActionTable_length);
112 l[4] = &(optdata->componentTable_length);
113 l[5] = &(optdata->ligatureTable_length);
114
116
117 GXV_TRACE(( "classTable: offset=0x%04x length=0x%04x\n",
118 classTable, *classTable_length_p ));
119 GXV_TRACE(( "stateArray: offset=0x%04x length=0x%04x\n",
120 stateArray, *stateArray_length_p ));
121 GXV_TRACE(( "entryTable: offset=0x%04x length=0x%04x\n",
122 entryTable, *entryTable_length_p ));
123 GXV_TRACE(( "ligActionTable: offset=0x%04x length=0x%04x\n",
124 optdata->ligActionTable,
125 optdata->ligActionTable_length ));
126 GXV_TRACE(( "componentTable: offset=0x%04x length=0x%04x\n",
127 optdata->componentTable,
128 optdata->componentTable_length ));
129 GXV_TRACE(( "ligatureTable: offset=0x%04x length=0x%04x\n",
130 optdata->ligatureTable,
131 optdata->ligatureTable_length ));
132
133 GXV_EXIT;
134 }
r l[0]
Definition: byte_order.h:168
static unsigned char buff[32768]
Definition: fatten.c:17
gxv_set_length_by_ushort_offset(FT_UShort *offset, FT_UShort **length, FT_UShort *buff, FT_UInt nmemb, FT_UShort limit, GXV_Validator gxvalid)
Definition: gxvcommn.c:63
LOCAL int table_size
Definition: write.c:65

Referenced by gxv_mort_subtable_type2_validate().

◆ gxv_mort_subtable_type2_validate()

gxv_mort_subtable_type2_validate ( FT_Bytes  table,
FT_Bytes  limit,
GXV_Validator  gxvalid 
)

Definition at line 277 of file gxvmort2.c.

280 {
281 FT_Bytes p = table;
282
284
285
286 GXV_NAME_ENTER( "mort chain subtable type2 (Ligature Substitution)" );
287
289
290 gxvalid->statetable.optdata =
291 &lig_rec;
300
301 gxv_StateTable_validate( p, limit, gxvalid );
302
303 p += gxvalid->subtable_length;
305
306 gxvalid->subtable_length = (FT_ULong)( p - table );
307
308 GXV_EXIT;
309 }
gxv_StateTable_validate(FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
Definition: gxvcommn.c:1208
@ GXV_GLYPHOFFSET_NONE
Definition: gxvcommn.h:122
static void gxv_mort_subtable_type2_opttable_load(FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
Definition: gxvmort2.c:59
#define GXV_MORT_SUBTABLE_TYPE2_HEADER_SIZE
Definition: gxvmort2.c:54
static void gxv_mort_subtable_type2_subtable_setup(FT_UShort table_size, FT_UShort classTable, FT_UShort stateArray, FT_UShort entryTable, FT_UShort *classTable_length_p, FT_UShort *stateArray_length_p, FT_UShort *entryTable_length_p, GXV_Validator gxvalid)
Definition: gxvmort2.c:83
static void gxv_mort_subtable_type2_entry_validate(FT_Byte state, FT_UShort flags, GXV_StateTable_GlyphOffsetCPtr glyphOffset_p, FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
Definition: gxvmort2.c:212
static void gxv_mort_subtable_type2_ligatureTable_validate(FT_Bytes table, GXV_Validator gxvalid)
Definition: gxvmort2.c:245
GXV_StateTable_Entry_Validate_Func entry_validate_func
Definition: gxvcommn.h:185
GXV_StateTable_Subtable_Setup_Func subtable_setup_func
Definition: gxvcommn.h:184
GXV_GlyphOffset_Format entry_glyphoffset_fmt
Definition: gxvcommn.h:181
GXV_StateTable_OptData_Load_Func optdata_load_func
Definition: gxvcommn.h:186
FT_ULong subtable_length
Definition: gxvcommn.h:244

Referenced by gxv_mort_subtables_validate().