00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #include "gxvmorx.h"
00029
00030
00031
00032
00033
00034
00035
00036
00037 #undef FT_COMPONENT
00038 #define FT_COMPONENT trace_gxvmorx
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 typedef struct GXV_morx_subtable_type5_StateOptRec_
00052 {
00053 FT_ULong insertionGlyphList;
00054 FT_ULong insertionGlyphList_length;
00055
00056 } GXV_morx_subtable_type5_StateOptRec,
00057 *GXV_morx_subtable_type5_StateOptRecData;
00058
00059
00060 #define GXV_MORX_SUBTABLE_TYPE5_HEADER_SIZE \
00061 ( GXV_STATETABLE_HEADER_SIZE + 4 )
00062
00063
00064 static void
00065 gxv_morx_subtable_type5_insertionGlyphList_load( FT_Bytes table,
00066 FT_Bytes limit,
00067 GXV_Validator valid )
00068 {
00069 FT_Bytes p = table;
00070
00071 GXV_morx_subtable_type5_StateOptRecData optdata =
00072 (GXV_morx_subtable_type5_StateOptRecData)valid->xstatetable.optdata;
00073
00074
00075 GXV_LIMIT_CHECK( 4 );
00076 optdata->insertionGlyphList = FT_NEXT_ULONG( p );
00077 }
00078
00079
00080 static void
00081 gxv_morx_subtable_type5_subtable_setup( FT_ULong table_size,
00082 FT_ULong classTable,
00083 FT_ULong stateArray,
00084 FT_ULong entryTable,
00085 FT_ULong* classTable_length_p,
00086 FT_ULong* stateArray_length_p,
00087 FT_ULong* entryTable_length_p,
00088 GXV_Validator valid )
00089 {
00090 FT_ULong o[4];
00091 FT_ULong* l[4];
00092 FT_ULong buff[5];
00093
00094 GXV_morx_subtable_type5_StateOptRecData optdata =
00095 (GXV_morx_subtable_type5_StateOptRecData)valid->xstatetable.optdata;
00096
00097
00098 o[0] = classTable;
00099 o[1] = stateArray;
00100 o[2] = entryTable;
00101 o[3] = optdata->insertionGlyphList;
00102 l[0] = classTable_length_p;
00103 l[1] = stateArray_length_p;
00104 l[2] = entryTable_length_p;
00105 l[3] = &(optdata->insertionGlyphList_length);
00106
00107 gxv_set_length_by_ulong_offset( o, l, buff, 4, table_size, valid );
00108 }
00109
00110
00111 static void
00112 gxv_morx_subtable_type5_InsertList_validate( FT_UShort table_index,
00113 FT_UShort count,
00114 FT_Bytes table,
00115 FT_Bytes limit,
00116 GXV_Validator valid )
00117 {
00118 FT_Bytes p = table + table_index * 2;
00119
00120
00121 while ( p < table + count * 2 + table_index * 2 )
00122 {
00123 FT_UShort insert_glyphID;
00124
00125
00126 GXV_LIMIT_CHECK( 2 );
00127 insert_glyphID = FT_NEXT_USHORT( p );
00128 GXV_TRACE(( " 0x%04x", insert_glyphID ));
00129 }
00130
00131 GXV_TRACE(( "\n" ));
00132 }
00133
00134
00135 static void
00136 gxv_morx_subtable_type5_entry_validate(
00137 FT_UShort state,
00138 FT_UShort flags,
00139 GXV_StateTable_GlyphOffsetCPtr glyphOffset_p,
00140 FT_Bytes table,
00141 FT_Bytes limit,
00142 GXV_Validator valid )
00143 {
00144 FT_Bool setMark;
00145 FT_Bool dontAdvance;
00146 FT_Bool currentIsKashidaLike;
00147 FT_Bool markedIsKashidaLike;
00148 FT_Bool currentInsertBefore;
00149 FT_Bool markedInsertBefore;
00150 FT_Byte currentInsertCount;
00151 FT_Byte markedInsertCount;
00152 FT_Byte currentInsertList;
00153 FT_UShort markedInsertList;
00154
00155 FT_UNUSED( state );
00156
00157
00158 setMark = FT_BOOL( ( flags >> 15 ) & 1 );
00159 dontAdvance = FT_BOOL( ( flags >> 14 ) & 1 );
00160 currentIsKashidaLike = FT_BOOL( ( flags >> 13 ) & 1 );
00161 markedIsKashidaLike = FT_BOOL( ( flags >> 12 ) & 1 );
00162 currentInsertBefore = FT_BOOL( ( flags >> 11 ) & 1 );
00163 markedInsertBefore = FT_BOOL( ( flags >> 10 ) & 1 );
00164
00165 currentInsertCount = (FT_Byte)( ( flags >> 5 ) & 0x1F );
00166 markedInsertCount = (FT_Byte)( flags & 0x001F );
00167
00168 currentInsertList = (FT_Byte) ( glyphOffset_p->ul >> 16 );
00169 markedInsertList = (FT_UShort)( glyphOffset_p->ul );
00170
00171 if ( currentInsertList && 0 != currentInsertCount )
00172 gxv_morx_subtable_type5_InsertList_validate( currentInsertList,
00173 currentInsertCount,
00174 table, limit,
00175 valid );
00176
00177 if ( markedInsertList && 0 != markedInsertCount )
00178 gxv_morx_subtable_type5_InsertList_validate( markedInsertList,
00179 markedInsertCount,
00180 table, limit,
00181 valid );
00182 }
00183
00184
00185 FT_LOCAL_DEF( void )
00186 gxv_morx_subtable_type5_validate( FT_Bytes table,
00187 FT_Bytes limit,
00188 GXV_Validator valid )
00189 {
00190 FT_Bytes p = table;
00191
00192 GXV_morx_subtable_type5_StateOptRec et_rec;
00193 GXV_morx_subtable_type5_StateOptRecData et = &et_rec;
00194
00195
00196 GXV_NAME_ENTER( "morx chain subtable type5 (Glyph Insertion)" );
00197
00198 GXV_LIMIT_CHECK( GXV_MORX_SUBTABLE_TYPE5_HEADER_SIZE );
00199
00200 valid->xstatetable.optdata =
00201 et;
00202 valid->xstatetable.optdata_load_func =
00203 gxv_morx_subtable_type5_insertionGlyphList_load;
00204 valid->xstatetable.subtable_setup_func =
00205 gxv_morx_subtable_type5_subtable_setup;
00206 valid->xstatetable.entry_glyphoffset_fmt =
00207 GXV_GLYPHOFFSET_ULONG;
00208 valid->xstatetable.entry_validate_func =
00209 gxv_morx_subtable_type5_entry_validate;
00210
00211 gxv_XStateTable_validate( p, limit, valid );
00212
00213 GXV_EXIT;
00214 }
00215
00216
00217