* src/gxvalid/gxvbsln.c (GXV_BSLN_VALUE_EMPTY): Add `U'.

* src/gxvalid/gxmort1.c (GXV_MORT_SUBTABLE_TYPE1_HEADER_SIZE),
src/gxvalid/gxmort2.c (GXV_MORT_SUBTABLE_TYPE2_HEADER_SIZE): Fix
typo.

* src/gxvalid/gxvmorx0.c, src/gxvalid/gxvmorx1.c,
src/gxvalid/gxvmorx2.c, src/gxvalid/gxvmorx4.c,
src/gxvalid/gxvmorx5.c, src/gxvalid/gxvmort.c: Improve tracing
messages.
Decorate constants with `U' and `L' where appropriate.
Fix compiler warnings.

Formatting.
This commit is contained in:
Werner Lemberg 2005-09-01 07:33:03 +00:00
parent a4aa1c5bee
commit 4a7f0b1c7a
12 changed files with 318 additions and 180 deletions

View File

@ -1,3 +1,18 @@
2005-09-01 Werner Lemberg <wl@gnu.org>
* src/gxvalid/gxvbsln.c (GXV_BSLN_VALUE_EMPTY): Add `U'.
* src/gxvalid/gxmort1.c (GXV_MORT_SUBTABLE_TYPE1_HEADER_SIZE),
src/gxvalid/gxmort2.c (GXV_MORT_SUBTABLE_TYPE2_HEADER_SIZE): Fix
typo.
* src/gxvalid/gxvmorx0.c, src/gxvalid/gxvmorx1.c,
src/gxvalid/gxvmorx2.c, src/gxvalid/gxvmorx4.c,
src/gxvalid/gxvmorx5.c, src/gxvalid/gxvmort.c: Improve tracing
messages.
Decorate constants with `U' and `L' where appropriate.
Fix compiler warnings.
2005-08-31 Werner Lemberg <wl@gnu.org> 2005-08-31 Werner Lemberg <wl@gnu.org>
* src/truetype/ttgload.c (load_truetype_glyph): Fix typo. * src/truetype/ttgload.c (load_truetype_glyph): Fix typo.

View File

@ -47,7 +47,7 @@
/*************************************************************************/ /*************************************************************************/
#define GXV_BSLN_VALUE_COUNT 32 #define GXV_BSLN_VALUE_COUNT 32
#define GXV_BSLN_VALUE_EMPTY 0xFFFF #define GXV_BSLN_VALUE_EMPTY 0xFFFFU
typedef struct GXV_bsln_DataRec_ typedef struct GXV_bsln_DataRec_
@ -57,6 +57,7 @@
} GXV_bsln_DataRec, *GXV_bsln_Data; } GXV_bsln_DataRec, *GXV_bsln_Data;
#define GXV_BSLN_DATA( field ) GXV_TABLE_DATA( bsln, field ) #define GXV_BSLN_DATA( field ) GXV_TABLE_DATA( bsln, field )

View File

@ -52,7 +52,8 @@
} GXV_lcar_DataRec, *GXV_lcar_Data; } GXV_lcar_DataRec, *GXV_lcar_Data;
#define GXV_LCAR_DATA(FIELD) GXV_TABLE_DATA( lcar, FIELD )
#define GXV_LCAR_DATA( FIELD ) GXV_TABLE_DATA( lcar, FIELD )
/*************************************************************************/ /*************************************************************************/

View File

@ -46,7 +46,8 @@
} GXV_mort_subtable_type1_StateOptRec, } GXV_mort_subtable_type1_StateOptRec,
*GXV_mort_subtable_type1_StateOptRecData; *GXV_mort_subtable_type1_StateOptRecData;
#define GXV_MORT_SUBTABLE_TYPE1_HEADER_SIZE GXV_STATETABLE_HEADER_SIZE + 2 #define GXV_MORT_SUBTABLE_TYPE1_HEADER_SIZE \
( GXV_STATETABLE_HEADER_SIZE + 2 )
static void static void

View File

@ -51,7 +51,7 @@
*GXV_mort_subtable_type2_StateOptRecData; *GXV_mort_subtable_type2_StateOptRecData;
#define GXV_MORT_SUBTABLE_TYPE2_HEADER_SIZE \ #define GXV_MORT_SUBTABLE_TYPE2_HEADER_SIZE \
GXV_STATETABLE_HEADER_SIZE + 2 + 2 + 2 ( GXV_STATETABLE_HEADER_SIZE + 2 + 2 + 2 )
static void static void

View File

@ -16,14 +16,17 @@
/***************************************************************************/ /***************************************************************************/
/***************************************************************************/ /***************************************************************************/
/* */
/* gxvalid is derived from both gxlayout module and otvalid module. */ /* gxvalid is derived from both gxlayout module and otvalid module. */
/* Development of gxlayout was support of Information-technology Promotion */ /* Development of gxlayout is supported by the Information-technology */
/* Agency(IPA), Japan. */ /* Promotion Agency(IPA), Japan. */
/* */
/***************************************************************************/ /***************************************************************************/
#include "gxvmorx.h" #include "gxvmorx.h"
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
@ -40,8 +43,9 @@
FT_UShort nSubtables, FT_UShort nSubtables,
GXV_Validator valid ) GXV_Validator valid )
{ {
FT_Bytes p = table; FT_Bytes p = table;
GXV_Validate_Func fmt_funcs_table [] =
GXV_Validate_Func fmt_funcs_table[] =
{ {
gxv_morx_subtable_type0_validate, /* 0 */ gxv_morx_subtable_type0_validate, /* 0 */
gxv_morx_subtable_type1_validate, /* 1 */ gxv_morx_subtable_type1_validate, /* 1 */
@ -51,11 +55,14 @@
gxv_morx_subtable_type5_validate, /* 5 */ gxv_morx_subtable_type5_validate, /* 5 */
}; };
GXV_Validate_Func func;
GXV_Validate_Func func;
FT_UShort i; FT_UShort i;
GXV_NAME_ENTER(( "subtables in a chain" )); GXV_NAME_ENTER( "subtables in a chain" );
for ( i = 0; i < nSubtables; i++ ) for ( i = 0; i < nSubtables; i++ )
{ {
FT_ULong length; FT_ULong length;
@ -71,7 +78,7 @@
subFeatureFlags = FT_NEXT_ULONG( p ); subFeatureFlags = FT_NEXT_ULONG( p );
GXV_TRACE(( "validate chain subtable %d/%d (%d bytes)\n", GXV_TRACE(( "validate chain subtable %d/%d (%d bytes)\n",
i + 1, nSubtables, length )); i + 1, nSubtables, length ));
type = coverage & 0x0007; type = coverage & 0x0007;
rest = length - ( 4 + 4 + 4 ); rest = length - ( 4 + 4 + 4 );
@ -92,7 +99,8 @@
p += rest; p += rest;
} }
valid->subtable_length = ( p - table ); valid->subtable_length = p - table;
GXV_EXIT; GXV_EXIT;
} }
@ -102,11 +110,11 @@
FT_Bytes limit, FT_Bytes limit,
GXV_Validator valid ) GXV_Validator valid )
{ {
FT_Bytes p = table; FT_Bytes p = table;
FT_ULong defaultFlags; FT_ULong defaultFlags;
FT_ULong chainLength; FT_ULong chainLength;
FT_ULong nFeatureFlags; FT_ULong nFeatureFlags;
FT_ULong nSubtables; FT_ULong nSubtables;
GXV_NAME_ENTER( "morx chain header" ); GXV_NAME_ENTER( "morx chain header" );
@ -126,6 +134,7 @@
GXV_EXIT; GXV_EXIT;
} }
FT_LOCAL_DEF( void ) FT_LOCAL_DEF( void )
gxv_morx_validate( FT_Bytes table, gxv_morx_validate( FT_Bytes table,
FT_Face face, FT_Face face,
@ -150,7 +159,7 @@
version = FT_NEXT_ULONG( p ); version = FT_NEXT_ULONG( p );
nChains = FT_NEXT_ULONG( p ); nChains = FT_NEXT_ULONG( p );
if (version != 0x00020000) if ( version != 0x00020000UL )
FT_INVALID_FORMAT; FT_INVALID_FORMAT;
for ( i = 0; i < nChains; i++ ) for ( i = 0; i < nChains; i++ )

View File

@ -16,11 +16,14 @@
/***************************************************************************/ /***************************************************************************/
/***************************************************************************/ /***************************************************************************/
/* */
/* gxvalid is derived from both gxlayout module and otvalid module. */ /* gxvalid is derived from both gxlayout module and otvalid module. */
/* Development of gxlayout was support of Information-technology Promotion */ /* Development of gxlayout is supported by the Information-technology */
/* Agency(IPA), Japan. */ /* Promotion Agency(IPA), Japan. */
/* */
/***************************************************************************/ /***************************************************************************/
#ifndef __GXVMORX_H_ #ifndef __GXVMORX_H_
#define __GXVMORX_H_ #define __GXVMORX_H_
@ -58,7 +61,7 @@
GXV_Validator valid ); GXV_Validator valid );
#endif /* Not def: __GXVMORX_H__ */ #endif /* __GXVMORX_H__ */
/* END */ /* END */

View File

@ -17,13 +17,17 @@
/***************************************************************************/ /***************************************************************************/
/***************************************************************************/ /***************************************************************************/
/* */
/* gxvalid is derived from both gxlayout module and otvalid module. */ /* gxvalid is derived from both gxlayout module and otvalid module. */
/* Development of gxlayout was support of Information-technology Promotion */ /* Development of gxlayout is supported by the Information-technology */
/* Agency(IPA), Japan. */ /* Promotion Agency(IPA), Japan. */
/* */
/***************************************************************************/ /***************************************************************************/
#include "gxvmorx.h" #include "gxvmorx.h"
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
@ -35,22 +39,27 @@
static void static void
gxv_morx_subtable_type0_entry_validate( FT_UShort state, gxv_morx_subtable_type0_entry_validate(
FT_UShort flags, FT_UShort state,
GXV_XStateTable_GlyphOffsetDesc FT_UShort flags,
glyphOffset, GXV_XStateTable_GlyphOffsetDesc glyphOffset,
FT_Bytes table, FT_Bytes table,
FT_Bytes limit, FT_Bytes limit,
GXV_Validator valid ) GXV_Validator valid )
{ {
FT_UShort markFirst; FT_UShort markFirst;
FT_UShort dontAdvance; FT_UShort dontAdvance;
FT_UShort markLast; FT_UShort markLast;
FT_UShort reserved; FT_UShort reserved;
FT_UShort verb; FT_UShort verb;
FT_UNUSED( state );
FT_UNUSED( glyphOffset );
FT_UNUSED( table );
FT_UNUSED( limit );
markFirst = flags / 0x8000; markFirst = flags / 0x8000U;
dontAdvance = ( flags & 0x4000 ) / 0x4000; dontAdvance = ( flags & 0x4000 ) / 0x4000;
markLast = ( flags & 0x2000 ) / 0x2000; markLast = ( flags & 0x2000 ) / 0x2000;
reserved = flags & 0x1FF0; reserved = flags & 0x1FF0;
@ -63,6 +72,7 @@
} }
} }
static void static void
gxv_morx_subtable_type0_validate( FT_Bytes table, gxv_morx_subtable_type0_validate( FT_Bytes table,
FT_Bytes limit, FT_Bytes limit,
@ -70,7 +80,9 @@
{ {
FT_Bytes p = table; FT_Bytes p = table;
GXV_NAME_ENTER( "morx chain subtable type0 (Indic-Script Rearrangement)" );
GXV_NAME_ENTER(
"morx chain subtable type0 (Indic-Script Rearrangement)" );
GXV_LIMIT_CHECK( GXV_STATETABLE_HEADER_SIZE ); GXV_LIMIT_CHECK( GXV_STATETABLE_HEADER_SIZE );
@ -78,8 +90,11 @@
valid->xstatetable.optdata_load_func = NULL; valid->xstatetable.optdata_load_func = NULL;
valid->xstatetable.subtable_setup_func = NULL; valid->xstatetable.subtable_setup_func = NULL;
valid->xstatetable.entry_glyphoffset_fmt = GXV_GLYPHOFFSET_NONE; valid->xstatetable.entry_glyphoffset_fmt = GXV_GLYPHOFFSET_NONE;
valid->xstatetable.entry_validate_func = gxv_morx_subtable_type0_entry_validate; valid->xstatetable.entry_validate_func =
gxv_morx_subtable_type0_entry_validate;
gxv_XStateTable_validate( p, limit, valid ); gxv_XStateTable_validate( p, limit, valid );
GXV_EXIT; GXV_EXIT;
} }

View File

@ -17,13 +17,17 @@
/***************************************************************************/ /***************************************************************************/
/***************************************************************************/ /***************************************************************************/
/* */
/* gxvalid is derived from both gxlayout module and otvalid module. */ /* gxvalid is derived from both gxlayout module and otvalid module. */
/* Development of gxlayout was support of Information-technology Promotion */ /* Development of gxlayout is supported by the Information-technology */
/* Agency(IPA), Japan. */ /* Promotion Agency(IPA), Japan. */
/* */
/***************************************************************************/ /***************************************************************************/
#include "gxvmorx.h" #include "gxvmorx.h"
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
@ -43,15 +47,21 @@
} GXV_morx_subtable_type1_StateOptRec, } GXV_morx_subtable_type1_StateOptRec,
*GXV_morx_subtable_type1_StateOptRecData; *GXV_morx_subtable_type1_StateOptRecData;
#define GXV_MORX_SUBTABLE_TYPE1_HEADER_SIZE ( GXV_STATETABLE_HEADER_SIZE + 2 )
#define GXV_MORX_SUBTABLE_TYPE1_HEADER_SIZE \
( GXV_STATETABLE_HEADER_SIZE + 2 )
static void static void
gxv_morx_subtable_type1_substitutionTable_load( FT_Bytes table, gxv_morx_subtable_type1_substitutionTable_load( FT_Bytes table,
FT_Bytes limit, FT_Bytes limit,
GXV_Validator valid ) GXV_Validator valid )
{ {
FT_Bytes p = table; FT_Bytes p = table;
GXV_morx_subtable_type1_StateOptRecData optdata = valid->xstatetable.optdata;
GXV_morx_subtable_type1_StateOptRecData optdata =
valid->xstatetable.optdata;
GXV_LIMIT_CHECK( 2 ); GXV_LIMIT_CHECK( 2 );
optdata->substitutionTable = FT_NEXT_USHORT( p ); optdata->substitutionTable = FT_NEXT_USHORT( p );
@ -71,7 +81,9 @@
FT_ULong o[4]; FT_ULong o[4];
FT_ULong *l[4]; FT_ULong *l[4];
FT_ULong buff[5]; FT_ULong buff[5];
GXV_morx_subtable_type1_StateOptRecData optdata = valid->xstatetable.optdata;
GXV_morx_subtable_type1_StateOptRecData optdata =
valid->xstatetable.optdata;
o[0] = classTable; o[0] = classTable;
@ -88,30 +100,37 @@
static void static void
gxv_morx_subtable_type1_entry_validate( FT_UShort state, gxv_morx_subtable_type1_entry_validate(
FT_UShort flags, FT_UShort state,
GXV_StateTable_GlyphOffsetDesc FT_UShort flags,
glyphOffset, GXV_StateTable_GlyphOffsetDesc glyphOffset,
FT_Bytes table, FT_Bytes table,
FT_Bytes limit, FT_Bytes limit,
GXV_Validator valid ) GXV_Validator valid )
{ {
FT_UShort setMark; FT_UShort setMark;
FT_UShort dontAdvance; FT_UShort dontAdvance;
FT_UShort reserved; FT_UShort reserved;
FT_Short markIndex; FT_Short markIndex;
FT_Short currentIndex; FT_Short currentIndex;
GXV_morx_subtable_type1_StateOptRecData optdata = valid->xstatetable.optdata;
GXV_morx_subtable_type1_StateOptRecData optdata =
valid->xstatetable.optdata;
FT_UNUSED( state );
FT_UNUSED( table );
FT_UNUSED( limit );
setMark = flags / 0x8000; setMark = flags / 0x8000U;
dontAdvance = ( flags & 0x4000 ) / 0x4000; dontAdvance = ( flags & 0x4000 ) / 0x4000;
reserved = flags & 0x3FFF; reserved = flags & 0x3FFF;
markIndex = GXV_USHORT_TO_SHORT( glyphOffset.ul / 0x00010000 ); markIndex = GXV_USHORT_TO_SHORT( glyphOffset.ul / 0x00010000UL );
currentIndex = GXV_USHORT_TO_SHORT( glyphOffset.ul & 0x0000FFFF ); currentIndex = GXV_USHORT_TO_SHORT( glyphOffset.ul & 0x0000FFFFUL );
GXV_TRACE(( " setMark=%01d dontAdvance=%01d\n", GXV_TRACE(( " setMark=%01d dontAdvance=%01d\n",
setMark, dontAdvance )); setMark, dontAdvance ));
if ( 0 < reserved ) if ( 0 < reserved )
{ {
GXV_TRACE(( " non-zero bits found in reserved range\n" )); GXV_TRACE(( " non-zero bits found in reserved range\n" ));
@ -119,14 +138,14 @@
FT_INVALID_DATA; FT_INVALID_DATA;
} }
GXV_TRACE(( "markIndex = %d, currentIndex = %d\n", markIndex, currentIndex )); GXV_TRACE(( "markIndex = %d, currentIndex = %d\n",
markIndex, currentIndex ));
if ( optdata->substitutionTable_num_lookupTables < markIndex + 1 ) if ( optdata->substitutionTable_num_lookupTables < markIndex + 1 )
optdata->substitutionTable_num_lookupTables = markIndex + 1; optdata->substitutionTable_num_lookupTables = markIndex + 1;
if ( optdata->substitutionTable_num_lookupTables < currentIndex + 1 ) if ( optdata->substitutionTable_num_lookupTables < currentIndex + 1 )
optdata->substitutionTable_num_lookupTables = currentIndex + 1; optdata->substitutionTable_num_lookupTables = currentIndex + 1;
} }
@ -142,10 +161,11 @@
static GXV_LookupValueDesc static GXV_LookupValueDesc
gxv_morx_subtable_type1_LookupFmt4_transit( FT_UShort relative_gindex, gxv_morx_subtable_type1_LookupFmt4_transit(
GXV_LookupValueDesc base_value, FT_UShort relative_gindex,
FT_Bytes lookuptbl_limit, GXV_LookupValueDesc base_value,
GXV_Validator valid ) FT_Bytes lookuptbl_limit,
GXV_Validator valid )
{ {
FT_Bytes p; FT_Bytes p;
FT_Bytes limit; FT_Bytes limit;
@ -153,7 +173,7 @@
GXV_LookupValueDesc value; GXV_LookupValueDesc value;
offset = base_value.u + ( relative_gindex * sizeof( FT_UShort ) ); offset = base_value.u + relative_gindex * sizeof ( FT_UShort );
p = valid->lookuptbl_head + offset; p = valid->lookuptbl_head + offset;
limit = lookuptbl_limit; limit = lookuptbl_limit;
@ -173,10 +193,12 @@
FT_Bytes limit, FT_Bytes limit,
GXV_Validator valid ) GXV_Validator valid )
{ {
FT_Bytes p = table; FT_Bytes p = table;
GXV_morx_subtable_type1_StateOptRecData optdata = valid->xstatetable.optdata;
FT_UShort i; FT_UShort i;
GXV_morx_subtable_type1_StateOptRecData optdata =
valid->xstatetable.optdata;
/* TODO: calculate offset/length for each lookupTables */ /* TODO: calculate offset/length for each lookupTables */
valid->lookupval_sign = GXV_LOOKUPVALUE_UNSIGNED; valid->lookupval_sign = GXV_LOOKUPVALUE_UNSIGNED;
@ -199,9 +221,9 @@
/* /*
* subtable for Contextual glyph substition is modified StateTable. * subtable for Contextual glyph substition is a modified StateTable.
* In addition classTable, stateArray, entryTable, "substitutionTable" * In addition to classTable, stateArray, entryTable, the field
* is added. * `substitutionTable' is added.
*/ */
static void static void
gxv_morx_subtable_type1_validate( FT_Bytes table, gxv_morx_subtable_type1_validate( FT_Bytes table,
@ -209,6 +231,7 @@
GXV_Validator valid ) GXV_Validator valid )
{ {
FT_Bytes p = table; FT_Bytes p = table;
GXV_morx_subtable_type1_StateOptRec st_rec; GXV_morx_subtable_type1_StateOptRec st_rec;
@ -218,19 +241,24 @@
st_rec.substitutionTable_num_lookupTables = 0; st_rec.substitutionTable_num_lookupTables = 0;
valid->xstatetable.optdata = &st_rec; valid->xstatetable.optdata =
valid->xstatetable.optdata_load_func = gxv_morx_subtable_type1_substitutionTable_load; &st_rec;
valid->xstatetable.subtable_setup_func = gxv_morx_subtable_type1_subtable_setup; valid->xstatetable.optdata_load_func =
valid->xstatetable.entry_glyphoffset_fmt = GXV_GLYPHOFFSET_ULONG; gxv_morx_subtable_type1_substitutionTable_load;
valid->xstatetable.entry_validate_func = gxv_morx_subtable_type1_entry_validate; valid->xstatetable.subtable_setup_func =
gxv_morx_subtable_type1_subtable_setup;
valid->xstatetable.entry_glyphoffset_fmt =
GXV_GLYPHOFFSET_ULONG;
valid->xstatetable.entry_validate_func =
gxv_morx_subtable_type1_entry_validate;
gxv_XStateTable_validate( p, limit, valid ); gxv_XStateTable_validate( p, limit, valid );
gxv_morx_subtable_type1_substitutionTable_validate( table gxv_morx_subtable_type1_substitutionTable_validate(
+ st_rec.substitutionTable, table + st_rec.substitutionTable,
table table + st_rec.substitutionTable + st_rec.substitutionTable_length,
+ st_rec.substitutionTable valid );
+ st_rec.substitutionTable_length,
valid );
GXV_EXIT; GXV_EXIT;
} }

View File

@ -17,13 +17,17 @@
/***************************************************************************/ /***************************************************************************/
/***************************************************************************/ /***************************************************************************/
/* */
/* gxvalid is derived from both gxlayout module and otvalid module. */ /* gxvalid is derived from both gxlayout module and otvalid module. */
/* Development of gxlayout was support of Information-technology Promotion */ /* Development of gxlayout is supported by the Information-technology */
/* Agency(IPA), Japan. */ /* Promotion Agency(IPA), Japan. */
/* */
/***************************************************************************/ /***************************************************************************/
#include "gxvmorx.h" #include "gxvmorx.h"
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
@ -46,26 +50,36 @@
} GXV_morx_subtable_type2_StateOptRec, } GXV_morx_subtable_type2_StateOptRec,
*GXV_morx_subtable_type2_StateOptRecData; *GXV_morx_subtable_type2_StateOptRecData;
#define GXV_MORX_SUBTABLE_TYPE2_HEADER_SIZE ( GXV_XSTATETABLE_HEADER_SIZE + 4 + 4 + 4 )
#define GXV_MORX_SUBTABLE_TYPE2_HEADER_SIZE \
( GXV_XSTATETABLE_HEADER_SIZE + 4 + 4 + 4 )
static void static void
gxv_morx_subtable_type2_opttable_load( FT_Bytes table, gxv_morx_subtable_type2_opttable_load( FT_Bytes table,
FT_Bytes limit, FT_Bytes limit,
GXV_Validator valid ) GXV_Validator valid )
{ {
FT_Bytes p = table; FT_Bytes p = table;
GXV_morx_subtable_type2_StateOptRecData optdata = valid->xstatetable.optdata;
GXV_morx_subtable_type2_StateOptRecData optdata =
valid->xstatetable.optdata;
GXV_LIMIT_CHECK( 4 + 4 + 4 ); GXV_LIMIT_CHECK( 4 + 4 + 4 );
optdata->ligActionTable = FT_NEXT_ULONG( p ); optdata->ligActionTable = FT_NEXT_ULONG( p );
optdata->componentTable = FT_NEXT_ULONG( p ); optdata->componentTable = FT_NEXT_ULONG( p );
optdata->ligatureTable = FT_NEXT_ULONG( p ); optdata->ligatureTable = FT_NEXT_ULONG( p );
GXV_TRACE(( "offset to ligActionTable=0x%08x\n", optdata->ligActionTable )); GXV_TRACE(( "offset to ligActionTable=0x%08x\n",
GXV_TRACE(( "offset to componentTable=0x%08x\n", optdata->componentTable )); optdata->ligActionTable ));
GXV_TRACE(( "offset to ligatureTable=0x%08x\n", optdata->ligatureTable )); GXV_TRACE(( "offset to componentTable=0x%08x\n",
optdata->componentTable ));
GXV_TRACE(( "offset to ligatureTable=0x%08x\n",
optdata->ligatureTable ));
} }
static void static void
gxv_morx_subtable_type2_subtable_setup( FT_ULong table_size, gxv_morx_subtable_type2_subtable_setup( FT_ULong table_size,
FT_ULong classTable, FT_ULong classTable,
@ -79,7 +93,9 @@
FT_ULong o[6]; FT_ULong o[6];
FT_ULong* l[6]; FT_ULong* l[6];
FT_ULong buff[7]; FT_ULong buff[7];
GXV_morx_subtable_type2_StateOptRecData optdata = valid->xstatetable.optdata;
GXV_morx_subtable_type2_StateOptRecData optdata =
valid->xstatetable.optdata;
GXV_NAME_ENTER( "subtable boundaries setup" ); GXV_NAME_ENTER( "subtable boundaries setup" );
@ -100,35 +116,41 @@
gxv_set_length_by_ulong_offset( o, l, buff, 6, table_size, valid ); gxv_set_length_by_ulong_offset( o, l, buff, 6, table_size, valid );
GXV_TRACE(( "classTable: offset=0x%08x length=0x%08x\n", GXV_TRACE(( "classTable: offset=0x%08x length=0x%08x\n",
classTable, *classTable_length_p)); classTable, *classTable_length_p ));
GXV_TRACE(( "stateArray: offset=0x%08x length=0x%08x\n", GXV_TRACE(( "stateArray: offset=0x%08x length=0x%08x\n",
stateArray, *stateArray_length_p)); stateArray, *stateArray_length_p ));
GXV_TRACE(( "entryTable: offset=0x%08x length=0x%08x\n", GXV_TRACE(( "entryTable: offset=0x%08x length=0x%08x\n",
entryTable, *entryTable_length_p)); entryTable, *entryTable_length_p ));
GXV_TRACE(( "ligActionTable: offset=0x%08x length=0x%08x\n", GXV_TRACE(( "ligActionTable: offset=0x%08x length=0x%08x\n",
optdata->ligActionTable, optdata->ligActionTable,
optdata->ligActionTable_length)); optdata->ligActionTable_length ));
GXV_TRACE(( "componentTable: offset=0x%08x length=0x%08x\n", GXV_TRACE(( "componentTable: offset=0x%08x length=0x%08x\n",
optdata->componentTable, optdata->componentTable,
optdata->componentTable_length)); optdata->componentTable_length ));
GXV_TRACE(( "ligatureTable: offset=0x%08x length=0x%08x\n", GXV_TRACE(( "ligatureTable: offset=0x%08x length=0x%08x\n",
optdata->ligatureTable, optdata->ligatureTable,
optdata->ligatureTable_length)); optdata->ligatureTable_length ));
GXV_EXIT; GXV_EXIT;
} }
#define GXV_MORX_LIGACTION_ENTRY_SIZE 4
#define GXV_MORX_LIGACTION_ENTRY_SIZE 4
static void static void
gxv_morx_subtable_type2_ligActionIndex_validate( FT_Bytes table, gxv_morx_subtable_type2_ligActionIndex_validate(
FT_UShort ligActionIndex, FT_Bytes table,
GXV_Validator valid ) FT_UShort ligActionIndex,
GXV_Validator valid )
{ {
/* access ligActionTable */ /* access ligActionTable */
GXV_morx_subtable_type2_StateOptRecData optdata = valid->xstatetable.optdata; GXV_morx_subtable_type2_StateOptRecData optdata =
valid->xstatetable.optdata;
FT_Bytes lat_base = table + optdata->ligActionTable; FT_Bytes lat_base = table + optdata->ligActionTable;
FT_Bytes p = lat_base + ligActionIndex * GXV_MORX_LIGACTION_ENTRY_SIZE; FT_Bytes p = lat_base +
ligActionIndex * GXV_MORX_LIGACTION_ENTRY_SIZE;
FT_Bytes lat_limit = lat_base + optdata->ligActionTable; FT_Bytes lat_limit = lat_base + optdata->ligActionTable;
@ -152,32 +174,35 @@
lig_action = FT_NEXT_ULONG( p ); lig_action = FT_NEXT_ULONG( p );
last = (lig_action & 0x80000000) / 0x80000000; last = (lig_action & 0x80000000UL) / 0x80000000UL;
store = (lig_action & 0x40000000) / 0x40000000; store = (lig_action & 0x40000000UL) / 0x40000000UL;
offset = lig_action & 0x3FFFFFFF; offset = lig_action & 0x3FFFFFFFUL;
} }
} }
static void static void
gxv_morx_subtable_type2_entry_validate( FT_UShort state, gxv_morx_subtable_type2_entry_validate(
FT_UShort flags, FT_UShort state,
GXV_StateTable_GlyphOffsetDesc FT_UShort flags,
glyphOffset, GXV_StateTable_GlyphOffsetDesc glyphOffset,
FT_Bytes table, FT_Bytes table,
FT_Bytes limit, FT_Bytes limit,
GXV_Validator valid ) GXV_Validator valid )
{ {
FT_UShort setComponent; FT_UShort setComponent;
FT_UShort dontAdvance; FT_UShort dontAdvance;
FT_UShort performAction; FT_UShort performAction;
FT_UShort reserved; FT_UShort reserved;
FT_UShort ligActionIndex; FT_UShort ligActionIndex;
setComponent = ( flags & 0x8000 ) / 0x8000; FT_UNUSED( state );
dontAdvance = ( flags & 0x4000 ) / 0x4000; FT_UNUSED( limit );
performAction = ( flags & 0x2000 ) / 0x2000;
setComponent = ( flags & 0x8000U ) / 0x8000U;
dontAdvance = ( flags & 0x4000 ) / 0x4000;
performAction = ( flags & 0x2000 ) / 0x2000;
reserved = flags & 0x1FFF; reserved = flags & 0x1FFF;
ligActionIndex = glyphOffset.u; ligActionIndex = glyphOffset.u;
@ -185,7 +210,8 @@
GXV_TRACE(( " reserved 14bit is non-zero\n" )); GXV_TRACE(( " reserved 14bit is non-zero\n" ));
if ( 0 < ligActionIndex ) if ( 0 < ligActionIndex )
gxv_morx_subtable_type2_ligActionIndex_validate( table, ligActionIndex, valid ); gxv_morx_subtable_type2_ligActionIndex_validate(
table, ligActionIndex, valid );
} }
@ -193,23 +219,29 @@
gxv_morx_subtable_type2_ligatureTable_validate( FT_Bytes table, gxv_morx_subtable_type2_ligatureTable_validate( FT_Bytes table,
GXV_Validator valid ) GXV_Validator valid )
{ {
GXV_morx_subtable_type2_StateOptRecData optdata = valid->xstatetable.optdata; GXV_morx_subtable_type2_StateOptRecData optdata =
valid->xstatetable.optdata;
FT_Bytes p = table + optdata->ligatureTable; FT_Bytes p = table + optdata->ligatureTable;
FT_Bytes limit = table + optdata->ligatureTable FT_Bytes limit = table + optdata->ligatureTable
+ optdata->ligatureTable_length; + optdata->ligatureTable_length;
GXV_NAME_ENTER( "morx chain subtable type2 - substitutionTable" ); GXV_NAME_ENTER( "morx chain subtable type2 - substitutionTable" );
if ( 0 != optdata->ligatureTable ) if ( 0 != optdata->ligatureTable )
{ {
/* Apple does not give specification of ligatureTable format */ /* Apple does not give specification of ligatureTable format */
while ( p < limit ) while ( p < limit )
{ {
FT_UShort lig_gid; FT_UShort lig_gid;
GXV_LIMIT_CHECK( 2 ); GXV_LIMIT_CHECK( 2 );
lig_gid = FT_NEXT_USHORT( p ); lig_gid = FT_NEXT_USHORT( p );
} }
} }
GXV_EXIT; GXV_EXIT;
} }
@ -220,20 +252,30 @@
GXV_Validator valid ) GXV_Validator valid )
{ {
FT_Bytes p = table; FT_Bytes p = table;
GXV_morx_subtable_type2_StateOptRec lig_rec; GXV_morx_subtable_type2_StateOptRec lig_rec;
GXV_NAME_ENTER( "morx chain subtable type2 (Ligature Substitution)" ); GXV_NAME_ENTER( "morx chain subtable type2 (Ligature Substitution)" );
GXV_LIMIT_CHECK( GXV_MORT_SUBTABLE_TYPE2_HEADER_SIZE ); GXV_LIMIT_CHECK( GXV_MORT_SUBTABLE_TYPE2_HEADER_SIZE );
valid->xstatetable.optdata = &lig_rec; valid->xstatetable.optdata =
valid->xstatetable.optdata_load_func = gxv_morx_subtable_type2_opttable_load; &lig_rec;
valid->xstatetable.subtable_setup_func = gxv_morx_subtable_type2_subtable_setup; valid->xstatetable.optdata_load_func =
valid->xstatetable.entry_glyphoffset_fmt = GXV_GLYPHOFFSET_USHORT; gxv_morx_subtable_type2_opttable_load;
valid->xstatetable.entry_validate_func = gxv_morx_subtable_type2_entry_validate; valid->xstatetable.subtable_setup_func =
gxv_morx_subtable_type2_subtable_setup;
valid->xstatetable.entry_glyphoffset_fmt =
GXV_GLYPHOFFSET_USHORT;
valid->xstatetable.entry_validate_func =
gxv_morx_subtable_type2_entry_validate;
gxv_XStateTable_validate( p, limit, valid ); gxv_XStateTable_validate( p, limit, valid );
p += valid->subtable_length; p += valid->subtable_length;
gxv_morx_subtable_type2_ligatureTable_validate( table, valid ); gxv_morx_subtable_type2_ligatureTable_validate( table, valid );
GXV_EXIT; GXV_EXIT;
} }

View File

@ -17,13 +17,17 @@
/***************************************************************************/ /***************************************************************************/
/***************************************************************************/ /***************************************************************************/
/* */
/* gxvalid is derived from both gxlayout module and otvalid module. */ /* gxvalid is derived from both gxlayout module and otvalid module. */
/* Development of gxlayout was support of Information-technology Promotion */ /* Development of gxlayout is supported by the Information-technology */
/* Agency(IPA), Japan. */ /* Promotion Agency(IPA), Japan. */
/* */
/***************************************************************************/ /***************************************************************************/
#include "gxvmorx.h" #include "gxvmorx.h"
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
@ -34,17 +38,18 @@
#define FT_COMPONENT trace_gxvmorx #define FT_COMPONENT trace_gxvmorx
static void static void
gxv_morx_subtable_type4_validate( FT_Bytes table, gxv_morx_subtable_type4_validate( FT_Bytes table,
FT_Bytes limit, FT_Bytes limit,
GXV_Validator valid ) GXV_Validator valid )
{ {
GXV_NAME_ENTER( "morx chain subtable type4 (Non-Contextual Glyph Substitution)" ); GXV_NAME_ENTER( "morx chain subtable type4 "
"(Non-Contextual Glyph Substitution)" );
gxv_mort_subtable_type4_validate( table, limit, valid ); gxv_mort_subtable_type4_validate( table, limit, valid );
GXV_EXIT; GXV_EXIT;
} }
/* END */ /* END */

View File

@ -17,13 +17,17 @@
/***************************************************************************/ /***************************************************************************/
/***************************************************************************/ /***************************************************************************/
/* */
/* gxvalid is derived from both gxlayout module and otvalid module. */ /* gxvalid is derived from both gxlayout module and otvalid module. */
/* Development of gxlayout was support of Information-technology Promotion */ /* Development of gxlayout is supported by the Information-technology */
/* Agency(IPA), Japan. */ /* Promotion Agency(IPA), Japan. */
/* */
/***************************************************************************/ /***************************************************************************/
#include "gxvmorx.h" #include "gxvmorx.h"
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
@ -34,14 +38,14 @@
#define FT_COMPONENT trace_gxvmorx #define FT_COMPONENT trace_gxvmorx
/* /*
* morx subtable type5 (Contextual Glyph Insertion) * `morx' subtable type5 (Contextual Glyph Insertion)
* has format of StateTable with insertion-glyph-list * has format of a StateTable with insertion-glyph-list
* without name. however, 32bit offset from the head * without name. However, the 32bit offset from the head
* of subtable to the i-g-l is given after "entryTable", * of subtable to the i-g-l is given after `entryTable',
* without variable name specification (the exist of * without variable name specification (the existence of
* offset to the table is different from mort type5). * this offset to the table is different from mort type5).
*/ */
typedef struct GXV_morx_subtable_type5_StateOptRec_ typedef struct GXV_morx_subtable_type5_StateOptRec_
@ -52,7 +56,10 @@
} GXV_morx_subtable_type5_StateOptRec, } GXV_morx_subtable_type5_StateOptRec,
*GXV_morx_subtable_type5_StateOptRecData; *GXV_morx_subtable_type5_StateOptRecData;
#define GXV_MORX_SUBTABLE_TYPE5_HEADER_SIZE ( GXV_STATETABLE_HEADER_SIZE + 4 )
#define GXV_MORX_SUBTABLE_TYPE5_HEADER_SIZE \
( GXV_STATETABLE_HEADER_SIZE + 4 )
static void static void
gxv_morx_subtable_type5_insertionGlyphList_load( FT_Bytes table, gxv_morx_subtable_type5_insertionGlyphList_load( FT_Bytes table,
@ -60,7 +67,9 @@
GXV_Validator valid ) GXV_Validator valid )
{ {
FT_Bytes p = table; FT_Bytes p = table;
GXV_morx_subtable_type5_StateOptRecData optdata = valid->xstatetable.optdata;
GXV_morx_subtable_type5_StateOptRecData optdata =
valid->xstatetable.optdata;
GXV_LIMIT_CHECK( 4 ); GXV_LIMIT_CHECK( 4 );
@ -81,7 +90,9 @@
FT_ULong o[4]; FT_ULong o[4];
FT_ULong* l[4]; FT_ULong* l[4];
FT_ULong buff[5]; FT_ULong buff[5];
GXV_morx_subtable_type5_StateOptRecData optdata = valid->xstatetable.optdata;
GXV_morx_subtable_type5_StateOptRecData optdata =
valid->xstatetable.optdata;
o[0] = classTable; o[0] = classTable;
@ -104,11 +115,12 @@
FT_Bytes limit, FT_Bytes limit,
GXV_Validator valid ) GXV_Validator valid )
{ {
FT_Bytes p = table + ( index * 2 ); FT_Bytes p = table + index * 2;
while ( p < table + ( count * 2 ) + ( index * 2 ) )
while ( p < table + count * 2 + index * 2 )
{ {
FT_UShort insert_glyphID; FT_UShort insert_glyphID;
GXV_LIMIT_CHECK( 2 ); GXV_LIMIT_CHECK( 2 );
@ -121,13 +133,13 @@
static void static void
gxv_morx_subtable_type5_entry_validate( FT_UShort state, gxv_morx_subtable_type5_entry_validate(
FT_UShort flags, FT_UShort state,
GXV_StateTable_GlyphOffsetDesc FT_UShort flags,
glyphOffset, GXV_StateTable_GlyphOffsetDesc glyphOffset,
FT_Bytes table, FT_Bytes table,
FT_Bytes limit, FT_Bytes limit,
GXV_Validator valid ) GXV_Validator valid )
{ {
FT_Bool setMark; FT_Bool setMark;
FT_Bool dontAdvance; FT_Bool dontAdvance;
@ -140,6 +152,8 @@
FT_Byte currentInsertList; FT_Byte currentInsertList;
FT_UShort markedInsertList; FT_UShort markedInsertList;
FT_UNUSED( state );
setMark = ( flags >> 15 ) & 1; setMark = ( flags >> 15 ) & 1;
dontAdvance = ( flags >> 14 ) & 1; dontAdvance = ( flags >> 14 ) & 1;
@ -149,24 +163,20 @@
markedInsertBefore = ( flags >> 10 ) & 1; markedInsertBefore = ( flags >> 10 ) & 1;
currentInsertCount = ( flags & 0x03E0 ) / 0x20; currentInsertCount = ( flags & 0x03E0 ) / 0x20;
markedInsertCount = ( flags & 0x001F ); markedInsertCount = ( flags & 0x001F );
currentInsertList = glyphOffset.ul / 0x00010000; currentInsertList = glyphOffset.ul / 0x00010000UL;
markedInsertList = glyphOffset.ul & 0x0000FFFF; markedInsertList = glyphOffset.ul & 0x0000FFFFUL;
if ( currentInsertList && 0 != currentInsertCount ) if ( currentInsertList && 0 != currentInsertCount )
{
gxv_morx_subtable_type5_InsertList_validate( currentInsertList, gxv_morx_subtable_type5_InsertList_validate( currentInsertList,
currentInsertCount, currentInsertCount,
table, limit, table, limit,
valid ); valid );
}
if ( markedInsertList && 0 != markedInsertCount ) if ( markedInsertList && 0 != markedInsertCount )
{
gxv_morx_subtable_type5_InsertList_validate( markedInsertList, gxv_morx_subtable_type5_InsertList_validate( markedInsertList,
markedInsertCount, markedInsertCount,
table, limit, table, limit,
valid ); valid );
}
} }
@ -176,6 +186,7 @@
GXV_Validator valid ) GXV_Validator valid )
{ {
FT_Bytes p = table; FT_Bytes p = table;
GXV_morx_subtable_type5_StateOptRec et_rec; GXV_morx_subtable_type5_StateOptRec et_rec;
GXV_morx_subtable_type5_StateOptRecData et = &et_rec; GXV_morx_subtable_type5_StateOptRecData et = &et_rec;
@ -184,12 +195,19 @@
GXV_LIMIT_CHECK( GXV_MORX_SUBTABLE_TYPE5_HEADER_SIZE ); GXV_LIMIT_CHECK( GXV_MORX_SUBTABLE_TYPE5_HEADER_SIZE );
valid->xstatetable.optdata = et; valid->xstatetable.optdata =
valid->xstatetable.optdata_load_func = gxv_morx_subtable_type5_insertionGlyphList_load; et;
valid->xstatetable.subtable_setup_func = gxv_morx_subtable_type5_subtable_setup; valid->xstatetable.optdata_load_func =
valid->xstatetable.entry_glyphoffset_fmt = GXV_GLYPHOFFSET_ULONG; gxv_morx_subtable_type5_insertionGlyphList_load;
valid->xstatetable.entry_validate_func = gxv_morx_subtable_type5_entry_validate; valid->xstatetable.subtable_setup_func =
gxv_morx_subtable_type5_subtable_setup;
valid->xstatetable.entry_glyphoffset_fmt =
GXV_GLYPHOFFSET_ULONG;
valid->xstatetable.entry_validate_func =
gxv_morx_subtable_type5_entry_validate;
gxv_XStateTable_validate( p, limit, valid ); gxv_XStateTable_validate( p, limit, valid );
GXV_EXIT; GXV_EXIT;
} }