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

Diff of /freetype2/src/gxvalid/gxvmorx5.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 34  Line 38 
38  #define FT_COMPONENT  trace_gxvmorx  #define FT_COMPONENT  trace_gxvmorx
39    
40    
41  /*    /*
42   * morx subtable type5 (Contextual Glyph Insertion)     * `morx' subtable type5 (Contextual Glyph Insertion)
43   * has format of StateTable with insertion-glyph-list     * has format of a StateTable with insertion-glyph-list
44   * without name. however, 32bit offset from the head     * without name.  However, the 32bit offset from the head
45   * of subtable to the i-g-l is given after "entryTable",     * of subtable to the i-g-l is given after `entryTable',
46   * without variable name specification (the exist of     * without variable name specification (the existence of
47   * offset to the table is different from mort type5).     * this offset to the table is different from mort type5).
48   */     */
49    
50    
51    typedef struct  GXV_morx_subtable_type5_StateOptRec_    typedef struct  GXV_morx_subtable_type5_StateOptRec_
# Line 52  Line 56 
56    }  GXV_morx_subtable_type5_StateOptRec,    }  GXV_morx_subtable_type5_StateOptRec,
57      *GXV_morx_subtable_type5_StateOptRecData;      *GXV_morx_subtable_type5_StateOptRecData;
58    
59  #define  GXV_MORX_SUBTABLE_TYPE5_HEADER_SIZE ( GXV_STATETABLE_HEADER_SIZE + 4 )  
60    #define GXV_MORX_SUBTABLE_TYPE5_HEADER_SIZE \
61              ( GXV_STATETABLE_HEADER_SIZE + 4 )
62    
63    
64    static void    static void
65    gxv_morx_subtable_type5_insertionGlyphList_load( FT_Bytes       table,    gxv_morx_subtable_type5_insertionGlyphList_load( FT_Bytes       table,
# Line 60  Line 67 
67                                                     GXV_Validator  valid )                                                     GXV_Validator  valid )
68    {    {
69      FT_Bytes  p = table;      FT_Bytes  p = table;
70      GXV_morx_subtable_type5_StateOptRecData  optdata = valid->xstatetable.optdata;  
71        GXV_morx_subtable_type5_StateOptRecData  optdata =
72                                                   valid->xstatetable.optdata;
73    
74    
75      GXV_LIMIT_CHECK( 4 );      GXV_LIMIT_CHECK( 4 );
# Line 81  Line 90 
90      FT_ULong   o[4];      FT_ULong   o[4];
91      FT_ULong*  l[4];      FT_ULong*  l[4];
92      FT_ULong   buff[5];      FT_ULong   buff[5];
93      GXV_morx_subtable_type5_StateOptRecData  optdata = valid->xstatetable.optdata;  
94        GXV_morx_subtable_type5_StateOptRecData  optdata =
95                                                   valid->xstatetable.optdata;
96    
97    
98      o[0] = classTable;      o[0] = classTable;
# Line 104  Line 115 
115                                                 FT_Bytes       limit,                                                 FT_Bytes       limit,
116                                                 GXV_Validator  valid )                                                 GXV_Validator  valid )
117    {    {
118      FT_Bytes p = table + ( index * 2 );      FT_Bytes p = table + index * 2;
119    
120      while ( p < table + ( count * 2 ) + ( index * 2 ) )  
121        while ( p < table + count * 2 + index * 2 )
122      {      {
123        FT_UShort insert_glyphID;        FT_UShort  insert_glyphID;
124    
125    
126        GXV_LIMIT_CHECK( 2 );        GXV_LIMIT_CHECK( 2 );
# Line 121  Line 133 
133    
134    
135    static void    static void
136    gxv_morx_subtable_type5_entry_validate( FT_UShort      state,    gxv_morx_subtable_type5_entry_validate(
137                                            FT_UShort      flags,      FT_UShort                       state,
138                                            GXV_StateTable_GlyphOffsetDesc      FT_UShort                       flags,
139                                                           glyphOffset,      GXV_StateTable_GlyphOffsetDesc  glyphOffset,
140                                            FT_Bytes       table,      FT_Bytes                        table,
141                                            FT_Bytes       limit,      FT_Bytes                        limit,
142                                            GXV_Validator  valid )      GXV_Validator                   valid )
143    {    {
144      FT_Bool    setMark;      FT_Bool    setMark;
145      FT_Bool    dontAdvance;      FT_Bool    dontAdvance;
# Line 140  Line 152 
152      FT_Byte    currentInsertList;      FT_Byte    currentInsertList;
153      FT_UShort  markedInsertList;      FT_UShort  markedInsertList;
154    
155        FT_UNUSED( state );
156    
157    
158      setMark              = ( flags >> 15 ) & 1;      setMark              = ( flags >> 15 ) & 1;
159      dontAdvance          = ( flags >> 14 ) & 1;      dontAdvance          = ( flags >> 14 ) & 1;
# Line 149  Line 163 
163      markedInsertBefore   = ( flags >> 10 ) & 1;      markedInsertBefore   = ( flags >> 10 ) & 1;
164      currentInsertCount   = ( flags & 0x03E0 ) / 0x20;      currentInsertCount   = ( flags & 0x03E0 ) / 0x20;
165      markedInsertCount    = ( flags & 0x001F );      markedInsertCount    = ( flags & 0x001F );
166      currentInsertList    = glyphOffset.ul / 0x00010000;      currentInsertList    = glyphOffset.ul / 0x00010000UL;
167      markedInsertList     = glyphOffset.ul & 0x0000FFFF;      markedInsertList     = glyphOffset.ul & 0x0000FFFFUL;
168    
169      if ( currentInsertList && 0 != currentInsertCount )      if ( currentInsertList && 0 != currentInsertCount )
     {  
170        gxv_morx_subtable_type5_InsertList_validate( currentInsertList,        gxv_morx_subtable_type5_InsertList_validate( currentInsertList,
171                                                     currentInsertCount,                                                     currentInsertCount,
172                                                     table, limit,                                                     table, limit,
173                                                     valid );                                                     valid );
     }  
174    
175      if ( markedInsertList && 0 != markedInsertCount )      if ( markedInsertList && 0 != markedInsertCount )
     {  
176        gxv_morx_subtable_type5_InsertList_validate( markedInsertList,        gxv_morx_subtable_type5_InsertList_validate( markedInsertList,
177                                                     markedInsertCount,                                                     markedInsertCount,
178                                                     table, limit,                                                     table, limit,
179                                                     valid );                                                     valid );
     }  
180    }    }
181    
182    
# Line 176  Line 186 
186                                      GXV_Validator  valid )                                      GXV_Validator  valid )
187    {    {
188      FT_Bytes  p = table;      FT_Bytes  p = table;
189    
190      GXV_morx_subtable_type5_StateOptRec      et_rec;      GXV_morx_subtable_type5_StateOptRec      et_rec;
191      GXV_morx_subtable_type5_StateOptRecData  et = &et_rec;      GXV_morx_subtable_type5_StateOptRecData  et = &et_rec;
192    
# Line 184  Line 195 
195    
196      GXV_LIMIT_CHECK( GXV_MORX_SUBTABLE_TYPE5_HEADER_SIZE );      GXV_LIMIT_CHECK( GXV_MORX_SUBTABLE_TYPE5_HEADER_SIZE );
197    
198      valid->xstatetable.optdata               = et;      valid->xstatetable.optdata =
199      valid->xstatetable.optdata_load_func     = gxv_morx_subtable_type5_insertionGlyphList_load;        et;
200      valid->xstatetable.subtable_setup_func   = gxv_morx_subtable_type5_subtable_setup;      valid->xstatetable.optdata_load_func =
201      valid->xstatetable.entry_glyphoffset_fmt = GXV_GLYPHOFFSET_ULONG;        gxv_morx_subtable_type5_insertionGlyphList_load;
202      valid->xstatetable.entry_validate_func   = gxv_morx_subtable_type5_entry_validate;      valid->xstatetable.subtable_setup_func =
203          gxv_morx_subtable_type5_subtable_setup;
204        valid->xstatetable.entry_glyphoffset_fmt =
205          GXV_GLYPHOFFSET_ULONG;
206        valid->xstatetable.entry_validate_func =
207          gxv_morx_subtable_type5_entry_validate;
208    
209      gxv_XStateTable_validate( p, limit, valid );      gxv_XStateTable_validate( p, limit, valid );
210    
211      GXV_EXIT;      GXV_EXIT;
212    }    }
213    

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