/[freetype]/freetype2/src/gxvalid/gxvmorx1.c
ViewVC logotype

Diff of /freetype2/src/gxvalid/gxvmorx1.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by mpsuzuki, Wed Aug 24 04:31:31 2005 UTC revision 1.2 by wl, Thu Sep 1 07:33:03 2005 UTC
# Line 17  Line 17 
17  /***************************************************************************/  /***************************************************************************/
18    
19  /***************************************************************************/  /***************************************************************************/
20    /*                                                                         */
21  /* gxvalid is derived from both gxlayout module and otvalid module.        */  /* gxvalid is derived from both gxlayout module and otvalid module.        */
22  /* Development of gxlayout was support of Information-technology Promotion */  /* Development of gxlayout is supported by the Information-technology      */
23  /* Agency(IPA), Japan.                                                     */  /* Promotion Agency(IPA), Japan.                                           */
24    /*                                                                         */
25  /***************************************************************************/  /***************************************************************************/
26    
27    
28  #include "gxvmorx.h"  #include "gxvmorx.h"
29    
30    
31    /*************************************************************************/    /*************************************************************************/
32    /*                                                                       */    /*                                                                       */
33    /* 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      */
# Line 43  Line 47 
47    }  GXV_morx_subtable_type1_StateOptRec,    }  GXV_morx_subtable_type1_StateOptRec,
48      *GXV_morx_subtable_type1_StateOptRecData;      *GXV_morx_subtable_type1_StateOptRecData;
49    
50  #define  GXV_MORX_SUBTABLE_TYPE1_HEADER_SIZE ( GXV_STATETABLE_HEADER_SIZE + 2 )  
51    #define GXV_MORX_SUBTABLE_TYPE1_HEADER_SIZE \
52              ( GXV_STATETABLE_HEADER_SIZE + 2 )
53    
54    
55    static void    static void
56    gxv_morx_subtable_type1_substitutionTable_load( FT_Bytes       table,    gxv_morx_subtable_type1_substitutionTable_load( FT_Bytes       table,
57                                                    FT_Bytes       limit,                                                    FT_Bytes       limit,
58                                                    GXV_Validator  valid )                                                    GXV_Validator  valid )
59    {    {
60      FT_Bytes                       p = table;      FT_Bytes  p = table;
61      GXV_morx_subtable_type1_StateOptRecData  optdata = valid->xstatetable.optdata;  
62        GXV_morx_subtable_type1_StateOptRecData  optdata =
63                                                   valid->xstatetable.optdata;
64    
65    
66      GXV_LIMIT_CHECK( 2 );      GXV_LIMIT_CHECK( 2 );
67      optdata->substitutionTable = FT_NEXT_USHORT( p );      optdata->substitutionTable = FT_NEXT_USHORT( p );
# Line 71  Line 81 
81      FT_ULong  o[4];      FT_ULong  o[4];
82      FT_ULong  *l[4];      FT_ULong  *l[4];
83      FT_ULong  buff[5];      FT_ULong  buff[5];
84      GXV_morx_subtable_type1_StateOptRecData  optdata = valid->xstatetable.optdata;  
85        GXV_morx_subtable_type1_StateOptRecData  optdata =
86                                                   valid->xstatetable.optdata;
87    
88    
89      o[0] = classTable;      o[0] = classTable;
# Line 88  Line 100 
100    
101    
102    static void    static void
103    gxv_morx_subtable_type1_entry_validate( FT_UShort      state,    gxv_morx_subtable_type1_entry_validate(
104                                            FT_UShort      flags,      FT_UShort                       state,
105                                            GXV_StateTable_GlyphOffsetDesc      FT_UShort                       flags,
106                                                           glyphOffset,      GXV_StateTable_GlyphOffsetDesc  glyphOffset,
107                                            FT_Bytes       table,      FT_Bytes                        table,
108                                            FT_Bytes       limit,      FT_Bytes                        limit,
109                                            GXV_Validator  valid )      GXV_Validator                   valid )
110    {    {
111      FT_UShort setMark;      FT_UShort  setMark;
112      FT_UShort dontAdvance;      FT_UShort  dontAdvance;
113      FT_UShort reserved;      FT_UShort  reserved;
114      FT_Short  markIndex;      FT_Short   markIndex;
115      FT_Short  currentIndex;      FT_Short   currentIndex;
116      GXV_morx_subtable_type1_StateOptRecData  optdata = valid->xstatetable.optdata;  
117        GXV_morx_subtable_type1_StateOptRecData  optdata =
118                                                   valid->xstatetable.optdata;
119    
120        FT_UNUSED( state );
121        FT_UNUSED( table );
122        FT_UNUSED( limit );
123    
124    
125      setMark      =   flags / 0x8000;      setMark      =   flags / 0x8000U;
126      dontAdvance  = ( flags & 0x4000 ) / 0x4000;      dontAdvance  = ( flags & 0x4000 ) / 0x4000;
127      reserved     =   flags & 0x3FFF;      reserved     =   flags & 0x3FFF;
128      markIndex    = GXV_USHORT_TO_SHORT( glyphOffset.ul / 0x00010000 );      markIndex    = GXV_USHORT_TO_SHORT( glyphOffset.ul / 0x00010000UL );
129      currentIndex = GXV_USHORT_TO_SHORT( glyphOffset.ul & 0x0000FFFF );      currentIndex = GXV_USHORT_TO_SHORT( glyphOffset.ul & 0x0000FFFFUL );
130    
131      GXV_TRACE(( " setMark=%01d dontAdvance=%01d\n",      GXV_TRACE(( " setMark=%01d dontAdvance=%01d\n",
132                    setMark, dontAdvance ));                  setMark, dontAdvance ));
133    
134      if ( 0 < reserved )      if ( 0 < reserved )
135      {      {
136        GXV_TRACE(( " non-zero bits found in reserved range\n" ));        GXV_TRACE(( " non-zero bits found in reserved range\n" ));
# Line 119  Line 138 
138          FT_INVALID_DATA;          FT_INVALID_DATA;
139      }      }
140    
141      GXV_TRACE(( "markIndex = %d, currentIndex = %d\n", markIndex, currentIndex ));      GXV_TRACE(( "markIndex = %d, currentIndex = %d\n",
142                    markIndex, currentIndex ));
143    
144      if ( optdata->substitutionTable_num_lookupTables < markIndex + 1 )      if ( optdata->substitutionTable_num_lookupTables < markIndex + 1 )
145        optdata->substitutionTable_num_lookupTables = markIndex + 1;        optdata->substitutionTable_num_lookupTables = markIndex + 1;
146    
147      if ( optdata->substitutionTable_num_lookupTables < currentIndex + 1 )      if ( optdata->substitutionTable_num_lookupTables < currentIndex + 1 )
148        optdata->substitutionTable_num_lookupTables = currentIndex + 1;        optdata->substitutionTable_num_lookupTables = currentIndex + 1;
   
149    }    }
150    
151    
# Line 142  Line 161 
161    
162    
163    static GXV_LookupValueDesc    static GXV_LookupValueDesc
164    gxv_morx_subtable_type1_LookupFmt4_transit( FT_UShort            relative_gindex,    gxv_morx_subtable_type1_LookupFmt4_transit(
165                                                GXV_LookupValueDesc  base_value,      FT_UShort            relative_gindex,
166                                                FT_Bytes             lookuptbl_limit,      GXV_LookupValueDesc  base_value,
167                                                GXV_Validator        valid )      FT_Bytes             lookuptbl_limit,
168        GXV_Validator        valid )
169    {    {
170      FT_Bytes             p;      FT_Bytes             p;
171      FT_Bytes             limit;      FT_Bytes             limit;
# Line 153  Line 173 
173      GXV_LookupValueDesc  value;      GXV_LookupValueDesc  value;
174    
175    
176      offset = base_value.u + ( relative_gindex * sizeof( FT_UShort ) );      offset = base_value.u + relative_gindex * sizeof ( FT_UShort );
177    
178      p     = valid->lookuptbl_head + offset;      p     = valid->lookuptbl_head + offset;
179      limit = lookuptbl_limit;      limit = lookuptbl_limit;
# Line 173  Line 193 
193                                                        FT_Bytes       limit,                                                        FT_Bytes       limit,
194                                                        GXV_Validator  valid )                                                        GXV_Validator  valid )
195    {    {
196      FT_Bytes   p          = table;      FT_Bytes   p = table;
     GXV_morx_subtable_type1_StateOptRecData  optdata = valid->xstatetable.optdata;  
197      FT_UShort  i;      FT_UShort  i;
198    
199        GXV_morx_subtable_type1_StateOptRecData  optdata =
200                                                   valid->xstatetable.optdata;
201    
202    
203      /* TODO: calculate offset/length for each lookupTables */      /* TODO: calculate offset/length for each lookupTables */
204      valid->lookupval_sign   = GXV_LOOKUPVALUE_UNSIGNED;      valid->lookupval_sign   = GXV_LOOKUPVALUE_UNSIGNED;
# Line 199  Line 221 
221    
222    
223    /*    /*
224     * subtable for Contextual glyph substition is modified StateTable.     * subtable for Contextual glyph substition is a modified StateTable.
225     * In addition classTable, stateArray, entryTable, "substitutionTable"     * In addition to classTable, stateArray, entryTable, the field
226     * is added.     * `substitutionTable' is added.
227     */     */
228    static void    static void
229    gxv_morx_subtable_type1_validate( FT_Bytes       table,    gxv_morx_subtable_type1_validate( FT_Bytes       table,
# Line 209  Line 231 
231                                      GXV_Validator  valid )                                      GXV_Validator  valid )
232    {    {
233      FT_Bytes  p = table;      FT_Bytes  p = table;
234    
235      GXV_morx_subtable_type1_StateOptRec  st_rec;      GXV_morx_subtable_type1_StateOptRec  st_rec;
236    
237    
# Line 218  Line 241 
241    
242      st_rec.substitutionTable_num_lookupTables = 0;      st_rec.substitutionTable_num_lookupTables = 0;
243    
244      valid->xstatetable.optdata               = &st_rec;      valid->xstatetable.optdata =
245      valid->xstatetable.optdata_load_func     = gxv_morx_subtable_type1_substitutionTable_load;        &st_rec;
246      valid->xstatetable.subtable_setup_func   = gxv_morx_subtable_type1_subtable_setup;      valid->xstatetable.optdata_load_func =
247      valid->xstatetable.entry_glyphoffset_fmt = GXV_GLYPHOFFSET_ULONG;        gxv_morx_subtable_type1_substitutionTable_load;
248      valid->xstatetable.entry_validate_func   = gxv_morx_subtable_type1_entry_validate;      valid->xstatetable.subtable_setup_func =
249          gxv_morx_subtable_type1_subtable_setup;
250        valid->xstatetable.entry_glyphoffset_fmt =
251          GXV_GLYPHOFFSET_ULONG;
252        valid->xstatetable.entry_validate_func =
253          gxv_morx_subtable_type1_entry_validate;
254    
255      gxv_XStateTable_validate( p, limit, valid );      gxv_XStateTable_validate( p, limit, valid );
256    
257      gxv_morx_subtable_type1_substitutionTable_validate( table      gxv_morx_subtable_type1_substitutionTable_validate(
258                                                            + st_rec.substitutionTable,        table + st_rec.substitutionTable,
259                                                          table        table + st_rec.substitutionTable + st_rec.substitutionTable_length,
260                                                            + st_rec.substitutionTable        valid );
261                                                            + st_rec.substitutionTable_length,  
                                                         valid );  
262      GXV_EXIT;      GXV_EXIT;
263    }    }
264    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26