* 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>
* 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_EMPTY 0xFFFF
#define GXV_BSLN_VALUE_EMPTY 0xFFFFU
typedef struct GXV_bsln_DataRec_
@ -57,6 +57,7 @@
} GXV_bsln_DataRec, *GXV_bsln_Data;
#define GXV_BSLN_DATA( field ) GXV_TABLE_DATA( bsln, field )

View File

@ -52,7 +52,8 @@
} 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_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

View File

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

View File

@ -16,14 +16,17 @@
/***************************************************************************/
/***************************************************************************/
/* */
/* gxvalid is derived from both gxlayout module and otvalid module. */
/* Development of gxlayout was support of Information-technology Promotion */
/* Agency(IPA), Japan. */
/* Development of gxlayout is supported by the Information-technology */
/* Promotion Agency(IPA), Japan. */
/* */
/***************************************************************************/
#include "gxvmorx.h"
/*************************************************************************/
/* */
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
@ -41,7 +44,8 @@
GXV_Validator valid )
{
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_type1_validate, /* 1 */
@ -51,11 +55,14 @@
gxv_morx_subtable_type5_validate, /* 5 */
};
GXV_Validate_Func func;
FT_UShort i;
GXV_NAME_ENTER(( "subtables in a chain" ));
GXV_NAME_ENTER( "subtables in a chain" );
for ( i = 0; i < nSubtables; i++ )
{
FT_ULong length;
@ -92,7 +99,8 @@
p += rest;
}
valid->subtable_length = ( p - table );
valid->subtable_length = p - table;
GXV_EXIT;
}
@ -126,6 +134,7 @@
GXV_EXIT;
}
FT_LOCAL_DEF( void )
gxv_morx_validate( FT_Bytes table,
FT_Face face,
@ -150,7 +159,7 @@
version = FT_NEXT_ULONG( p );
nChains = FT_NEXT_ULONG( p );
if (version != 0x00020000)
if ( version != 0x00020000UL )
FT_INVALID_FORMAT;
for ( i = 0; i < nChains; i++ )

View File

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

View File

@ -17,13 +17,17 @@
/***************************************************************************/
/***************************************************************************/
/* */
/* gxvalid is derived from both gxlayout module and otvalid module. */
/* Development of gxlayout was support of Information-technology Promotion */
/* Agency(IPA), Japan. */
/* Development of gxlayout is supported by the Information-technology */
/* Promotion Agency(IPA), Japan. */
/* */
/***************************************************************************/
#include "gxvmorx.h"
/*************************************************************************/
/* */
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
@ -35,10 +39,10 @@
static void
gxv_morx_subtable_type0_entry_validate( FT_UShort state,
gxv_morx_subtable_type0_entry_validate(
FT_UShort state,
FT_UShort flags,
GXV_XStateTable_GlyphOffsetDesc
glyphOffset,
GXV_XStateTable_GlyphOffsetDesc glyphOffset,
FT_Bytes table,
FT_Bytes limit,
GXV_Validator valid )
@ -49,8 +53,13 @@
FT_UShort reserved;
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;
markLast = ( flags & 0x2000 ) / 0x2000;
reserved = flags & 0x1FF0;
@ -63,6 +72,7 @@
}
}
static void
gxv_morx_subtable_type0_validate( FT_Bytes table,
FT_Bytes limit,
@ -70,7 +80,9 @@
{
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 );
@ -78,8 +90,11 @@
valid->xstatetable.optdata_load_func = NULL;
valid->xstatetable.subtable_setup_func = NULL;
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_EXIT;
}

View File

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

View File

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

View File

@ -17,13 +17,17 @@
/***************************************************************************/
/***************************************************************************/
/* */
/* gxvalid is derived from both gxlayout module and otvalid module. */
/* Development of gxlayout was support of Information-technology Promotion */
/* Agency(IPA), Japan. */
/* Development of gxlayout is supported by the Information-technology */
/* Promotion Agency(IPA), Japan. */
/* */
/***************************************************************************/
#include "gxvmorx.h"
/*************************************************************************/
/* */
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
@ -39,7 +43,8 @@
FT_Bytes limit,
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 );

View File

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