ReactOS 0.4.15-dev-7934-g1dc8d80
gxvmorx2.c File Reference
#include "gxvmorx.h"
Include dependency graph for gxvmorx2.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  GXV_morx_subtable_type2_StateOptRec_
 

Macros

#define FT_COMPONENT   trace_gxvmorx
 
#define GXV_MORX_SUBTABLE_TYPE2_HEADER_SIZE    ( GXV_XSTATETABLE_HEADER_SIZE + 4 + 4 + 4 )
 
#define GXV_MORX_LIGACTION_ENTRY_SIZE   4
 

Typedefs

typedef struct GXV_morx_subtable_type2_StateOptRec_ GXV_morx_subtable_type2_StateOptRec
 
typedef struct GXV_morx_subtable_type2_StateOptRec_GXV_morx_subtable_type2_StateOptRecData
 

Functions

static void gxv_morx_subtable_type2_opttable_load (FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
 
static void gxv_morx_subtable_type2_subtable_setup (FT_ULong table_size, FT_ULong classTable, FT_ULong stateArray, FT_ULong entryTable, FT_ULong *classTable_length_p, FT_ULong *stateArray_length_p, FT_ULong *entryTable_length_p, GXV_Validator gxvalid)
 
static void gxv_morx_subtable_type2_ligActionIndex_validate (FT_Bytes table, FT_UShort ligActionIndex, GXV_Validator gxvalid)
 
static void gxv_morx_subtable_type2_entry_validate (FT_UShort state, FT_UShort flags, GXV_StateTable_GlyphOffsetCPtr glyphOffset_p, FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
 
static void gxv_morx_subtable_type2_ligatureTable_validate (FT_Bytes table, GXV_Validator gxvalid)
 
 gxv_morx_subtable_type2_validate (FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
 

Macro Definition Documentation

◆ FT_COMPONENT

#define FT_COMPONENT   trace_gxvmorx

Definition at line 39 of file gxvmorx2.c.

◆ GXV_MORX_LIGACTION_ENTRY_SIZE

#define GXV_MORX_LIGACTION_ENTRY_SIZE   4

Definition at line 139 of file gxvmorx2.c.

◆ GXV_MORX_SUBTABLE_TYPE2_HEADER_SIZE

#define GXV_MORX_SUBTABLE_TYPE2_HEADER_SIZE    ( GXV_XSTATETABLE_HEADER_SIZE + 4 + 4 + 4 )

Definition at line 55 of file gxvmorx2.c.

Typedef Documentation

◆ GXV_morx_subtable_type2_StateOptRec

◆ GXV_morx_subtable_type2_StateOptRecData

Function Documentation

◆ gxv_morx_subtable_type2_entry_validate()

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

Definition at line 224 of file gxvmorx2.c.

231 {
232#ifdef GXV_LOAD_UNUSED_VARS
233 FT_UShort setComponent;
234 FT_UShort dontAdvance;
235 FT_UShort performAction;
236#endif
238 FT_UShort ligActionIndex;
239
240 FT_UNUSED( state );
241 FT_UNUSED( limit );
242
243
244#ifdef GXV_LOAD_UNUSED_VARS
245 setComponent = (FT_UShort)( ( flags >> 15 ) & 1 );
246 dontAdvance = (FT_UShort)( ( flags >> 14 ) & 1 );
247 performAction = (FT_UShort)( ( flags >> 13 ) & 1 );
248#endif
249
250 reserved = (FT_UShort)( flags & 0x1FFF );
251 ligActionIndex = glyphOffset_p->u;
252
253 if ( reserved > 0 )
254 GXV_TRACE(( " reserved 14bit is non-zero\n" ));
255
256 if ( 0 < ligActionIndex )
258 table, ligActionIndex, gxvalid );
259 }
static int state
Definition: maze.c:121
r reserved
Definition: btrfs.c:3006
#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
#define GXV_TRACE(s)
Definition: gxvcommn.h:304
static void gxv_morx_subtable_type2_ligActionIndex_validate(FT_Bytes table, FT_UShort ligActionIndex, GXV_Validator gxvalid)
Definition: gxvmorx2.c:143

Referenced by gxv_morx_subtable_type2_validate().

◆ gxv_morx_subtable_type2_ligActionIndex_validate()

static void gxv_morx_subtable_type2_ligActionIndex_validate ( FT_Bytes  table,
FT_UShort  ligActionIndex,
GXV_Validator  gxvalid 
)
static

Definition at line 143 of file gxvmorx2.c.

147 {
148 /* access ligActionTable */
151
152 FT_Bytes lat_base = table + optdata->ligActionTable;
153 FT_Bytes p = lat_base +
154 ligActionIndex * GXV_MORX_LIGACTION_ENTRY_SIZE;
155 FT_Bytes lat_limit = lat_base + optdata->ligActionTable;
156
157
158 if ( p < lat_base )
159 {
160 GXV_TRACE(( "p < lat_base (%d byte rewind)\n", lat_base - p ));
162 }
163 else if ( lat_limit < p )
164 {
165 GXV_TRACE(( "lat_limit < p (%d byte overrun)\n", p - lat_limit ));
167 }
168
169 {
170 /* validate entry in ligActionTable */
171 FT_ULong lig_action;
172#ifdef GXV_LOAD_UNUSED_VARS
174 FT_UShort store;
175#endif
177 FT_Long gid_limit;
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 offset = lig_action & 0x3FFFFFFFUL;
187
188 /* this offset is 30-bit signed value to add to GID */
189 /* it is different from the location offset in mort */
190 if ( ( offset & 0x3FFF0000UL ) == 0x3FFF0000UL )
191 { /* negative offset */
192 gid_limit = gxvalid->face->num_glyphs -
193 (FT_Long)( offset & 0x0000FFFFUL );
194 if ( gid_limit > 0 )
195 return;
196
197 GXV_TRACE(( "ligature action table includes"
198 " too negative offset moving all GID"
199 " below defined range: 0x%04x\n",
200 offset & 0xFFFFU ));
202 }
203 else if ( ( offset & 0x3FFF0000UL ) == 0x00000000UL )
204 { /* positive offset */
205 if ( (FT_Long)offset < gxvalid->face->num_glyphs )
206 return;
207
208 GXV_TRACE(( "ligature action table includes"
209 " too large offset moving all GID"
210 " over defined range: 0x%04x\n",
211 offset & 0xFFFFU ));
213 }
214
215 GXV_TRACE(( "ligature action table includes"
216 " invalid offset to add to 16-bit GID:"
217 " 0x%08x\n", offset ));
219 }
220 }
#define FT_NEXT_ULONG(buffer)
Definition: ftstream.h:238
unsigned long FT_ULong
Definition: fttypes.h:253
signed long FT_Long
Definition: fttypes.h:242
const FT_Byte * FT_Bytes
Definition: fttypes.h:165
#define FT_INVALID_OFFSET
Definition: ftvalid.h:138
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
GLfloat GLfloat p
Definition: glext.h:8902
GLintptr offset
Definition: glext.h:5920
#define GXV_SET_ERR_IF_PARANOID(err)
Definition: gxvcommn.h:66
struct GXV_morx_subtable_type2_StateOptRec_ * GXV_morx_subtable_type2_StateOptRecData
#define GXV_MORX_LIGACTION_ENTRY_SIZE
Definition: gxvmorx2.c:139
if(dx< 0)
Definition: linetemp.h:194
static UINT UINT last
Definition: font.c:45
FT_Long num_glyphs
Definition: freetype.h:1076
GXV_XStateTable_ValidatorRec xstatetable
Definition: gxvcommn.h:255

Referenced by gxv_morx_subtable_type2_entry_validate().

◆ gxv_morx_subtable_type2_ligatureTable_validate()

static void gxv_morx_subtable_type2_ligatureTable_validate ( FT_Bytes  table,
GXV_Validator  gxvalid 
)
static

Definition at line 263 of file gxvmorx2.c.

265 {
268
269 FT_Bytes p = table + optdata->ligatureTable;
270 FT_Bytes limit = table + optdata->ligatureTable
271 + optdata->ligatureTable_length;
272
273
274 GXV_NAME_ENTER( "morx chain subtable type2 - substitutionTable" );
275
276 if ( 0 != optdata->ligatureTable )
277 {
278 /* Apple does not give specification of ligatureTable format */
279 while ( p < limit )
280 {
281 FT_UShort lig_gid;
282
283
284 GXV_LIMIT_CHECK( 2 );
285 lig_gid = FT_NEXT_USHORT( p );
286 if ( lig_gid < gxvalid->face->num_glyphs )
288 }
289 }
290
291 GXV_EXIT;
292 }
#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

Referenced by gxv_morx_subtable_type2_validate().

◆ gxv_morx_subtable_type2_opttable_load()

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

Definition at line 60 of file gxvmorx2.c.

63 {
65
68
69
70 GXV_LIMIT_CHECK( 4 + 4 + 4 );
71 optdata->ligActionTable = FT_NEXT_ULONG( p );
72 optdata->componentTable = FT_NEXT_ULONG( p );
73 optdata->ligatureTable = FT_NEXT_ULONG( p );
74
75 GXV_TRACE(( "offset to ligActionTable=0x%08x\n",
76 optdata->ligActionTable ));
77 GXV_TRACE(( "offset to componentTable=0x%08x\n",
78 optdata->componentTable ));
79 GXV_TRACE(( "offset to ligatureTable=0x%08x\n",
80 optdata->ligatureTable ));
81 }

Referenced by gxv_morx_subtable_type2_validate().

◆ gxv_morx_subtable_type2_subtable_setup()

static void gxv_morx_subtable_type2_subtable_setup ( FT_ULong  table_size,
FT_ULong  classTable,
FT_ULong  stateArray,
FT_ULong  entryTable,
FT_ULong classTable_length_p,
FT_ULong stateArray_length_p,
FT_ULong entryTable_length_p,
GXV_Validator  gxvalid 
)
static

Definition at line 85 of file gxvmorx2.c.

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

Referenced by gxv_morx_subtable_type2_validate().

◆ gxv_morx_subtable_type2_validate()

gxv_morx_subtable_type2_validate ( FT_Bytes  table,
FT_Bytes  limit,
GXV_Validator  gxvalid 
)

Definition at line 296 of file gxvmorx2.c.

299 {
300 FT_Bytes p = table;
301
303
304
305 GXV_NAME_ENTER( "morx chain subtable type2 (Ligature Substitution)" );
306
308
309 gxvalid->xstatetable.optdata =
310 &lig_rec;
319
320 gxv_XStateTable_validate( p, limit, gxvalid );
321
322#if 0
323 p += gxvalid->subtable_length;
324#endif
326
327 GXV_EXIT;
328 }
gxv_XStateTable_validate(FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
Definition: gxvcommn.c:1554
@ GXV_GLYPHOFFSET_USHORT
Definition: gxvcommn.h:125
static void gxv_morx_subtable_type2_opttable_load(FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
Definition: gxvmorx2.c:60
static void gxv_morx_subtable_type2_ligatureTable_validate(FT_Bytes table, GXV_Validator gxvalid)
Definition: gxvmorx2.c:263
#define GXV_MORX_SUBTABLE_TYPE2_HEADER_SIZE
Definition: gxvmorx2.c:55
static void gxv_morx_subtable_type2_subtable_setup(FT_ULong table_size, FT_ULong classTable, FT_ULong stateArray, FT_ULong entryTable, FT_ULong *classTable_length_p, FT_ULong *stateArray_length_p, FT_ULong *entryTable_length_p, GXV_Validator gxvalid)
Definition: gxvmorx2.c:85
static void gxv_morx_subtable_type2_entry_validate(FT_UShort state, FT_UShort flags, GXV_StateTable_GlyphOffsetCPtr glyphOffset_p, FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid)
Definition: gxvmorx2.c:224
FT_ULong subtable_length
Definition: gxvcommn.h:244
GXV_XStateTable_OptData_Load_Func optdata_load_func
Definition: gxvcommn.h:227
GXV_XStateTable_Entry_Validate_Func entry_validate_func
Definition: gxvcommn.h:226
GXV_XStateTable_Subtable_Setup_Func subtable_setup_func
Definition: gxvcommn.h:225

Referenced by gxv_morx_subtables_validate().