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

Diff of /freetype2/src/gxvalid/gxvbsln.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, Wed Aug 31 16:29:51 2005 UTC
# Line 16  Line 16 
16  /***************************************************************************/  /***************************************************************************/
17    
18  /***************************************************************************/  /***************************************************************************/
19    /*                                                                         */
20  /* gxvalid is derived from both gxlayout module and otvalid module.        */  /* gxvalid is derived from both gxlayout module and otvalid module.        */
21  /* Development of gxlayout was support of Information-technology Promotion */  /* Development of gxlayout is supported by the Information-technology      */
22  /* Agency(IPA), Japan.                                                     */  /* Promotion Agency(IPA), Japan.                                           */
23    /*                                                                         */
24  /***************************************************************************/  /***************************************************************************/
25    
26    
# Line 26  Line 28 
28  #include "gxvcommn.h"  #include "gxvcommn.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 45  Line 46 
46    /*************************************************************************/    /*************************************************************************/
47    /*************************************************************************/    /*************************************************************************/
48    
49  #define GXV_BSLN_VALUE_COUNT 32  #define GXV_BSLN_VALUE_COUNT  32
50  #define GXV_BSLN_VALUE_EMPTY 0xFFFF  #define GXV_BSLN_VALUE_EMPTY  0xFFFF
51    
52    
53    typedef struct  GXV_bsln_DataRec_    typedef struct  GXV_bsln_DataRec_
54    {    {
# Line 54  Line 56 
56      FT_UShort  defaultBaseline;      FT_UShort  defaultBaseline;
57    
58    } GXV_bsln_DataRec, *GXV_bsln_Data;    } GXV_bsln_DataRec, *GXV_bsln_Data;
59  #define GXV_BSLN_DATA(field)  GXV_TABLE_DATA( bsln, field )  
60    #define GXV_BSLN_DATA( field )  GXV_TABLE_DATA( bsln, field )
61    
62    
63    /*************************************************************************/    /*************************************************************************/
# Line 70  Line 73 
73                                   GXV_LookupValueDesc  value,                                   GXV_LookupValueDesc  value,
74                                   GXV_Validator        valid )                                   GXV_Validator        valid )
75    {    {
76      FT_UShort   v  = value.u;      FT_UShort   v = value.u;
77      FT_UShort*  ctlPoints;      FT_UShort*  ctlPoints;
78    
79        FT_UNUSED( glyph );
80    
81    
82      GXV_NAME_ENTER( " lookup value" );      GXV_NAME_ENTER( " lookup value" );
83    
84      if ( v >= GXV_BSLN_VALUE_COUNT )      if ( v >= GXV_BSLN_VALUE_COUNT )
85        FT_INVALID_DATA;        FT_INVALID_DATA;
86    
   
87      ctlPoints = (FT_UShort*)GXV_BSLN_DATA( ctlPoints_p );      ctlPoints = (FT_UShort*)GXV_BSLN_DATA( ctlPoints_p );
88      if ( ctlPoints && ctlPoints[v] == GXV_BSLN_VALUE_EMPTY )      if ( ctlPoints && ctlPoints[v] == GXV_BSLN_VALUE_EMPTY )
89        FT_INVALID_DATA;        FT_INVALID_DATA;
# Line 126  Line 130 
130      FT_UShort            offset;      FT_UShort            offset;
131      GXV_LookupValueDesc  value;      GXV_LookupValueDesc  value;
132    
133    
134      offset = base_value.u + ( relative_gindex * sizeof ( FT_UShort ) );      offset = base_value.u + ( relative_gindex * sizeof ( FT_UShort ) );
135    
136      p     = valid->lookuptbl_head + offset;      p     = valid->lookuptbl_head + offset;
# Line 137  Line 142 
142      return value;      return value;
143    }    }
144    
145    
146    static void    static void
147    gxv_bsln_parts_fmt0_validate( FT_Bytes       tables,    gxv_bsln_parts_fmt0_validate( FT_Bytes       tables,
148                                  FT_Bytes       limit,                                  FT_Bytes       limit,
# Line 163  Line 169 
169    {    {
170      FT_Bytes  p = tables;      FT_Bytes  p = tables;
171    
172    
173      GXV_NAME_ENTER( " parts format 1" );      GXV_NAME_ENTER( " parts format 1" );
174    
175      /* deltas */      /* deltas */
# Line 185  Line 192 
192                                  FT_Bytes       limit,                                  FT_Bytes       limit,
193                                  GXV_Validator  valid )                                  GXV_Validator  valid )
194    {    {
195      FT_Bytes      p = tables;      FT_Bytes   p = tables;
196    
197      FT_UShort     stdGlyph;      FT_UShort  stdGlyph;
198      FT_UShort     ctlPoint;      FT_UShort  ctlPoint;
199      FT_Int        i;      FT_Int     i;
200    
201      FT_UShort     defaultBaseline = GXV_BSLN_DATA( defaultBaseline );      FT_UShort  defaultBaseline = GXV_BSLN_DATA( defaultBaseline );
202    
203    
204      GXV_NAME_ENTER( "parts format 2" );      GXV_NAME_ENTER( "parts format 2" );
# Line 205  Line 212 
212      gxv_glyphid_validate( stdGlyph, valid );      gxv_glyphid_validate( stdGlyph, valid );
213    
214      /* Record the position of ctlPoints */      /* Record the position of ctlPoints */
215      GXV_BSLN_DATA( ctlPoints_p) = p;      GXV_BSLN_DATA( ctlPoints_p ) = p;
216    
217      /* ctlPoints */      /* ctlPoints */
218      for ( i = 0; i < GXV_BSLN_VALUE_COUNT; i++ )      for ( i = 0; i < GXV_BSLN_VALUE_COUNT; i++ )
# Line 217  Line 224 
224            FT_INVALID_DATA;            FT_INVALID_DATA;
225        }        }
226        else        else
       {  
227          gxv_ctlPoint_validate( stdGlyph, (FT_Short)ctlPoint, valid );          gxv_ctlPoint_validate( stdGlyph, (FT_Short)ctlPoint, valid );
       }  
228      }      }
229    
230      GXV_EXIT;      GXV_EXIT;
# Line 264  Line 269 
269                       FT_Face       face,                       FT_Face       face,
270                       FT_Validator  ftvalid )                       FT_Validator  ftvalid )
271    {    {
272      GXV_ValidatorRec   validrec;      GXV_ValidatorRec  validrec;
273      GXV_Validator      valid = &validrec;      GXV_Validator     valid = &validrec;
274    
275      GXV_bsln_DataRec   bslnrec;      GXV_bsln_DataRec  bslnrec;
276      GXV_bsln_Data      bsln = &bslnrec;      GXV_bsln_Data     bsln = &bslnrec;
277    
278      FT_Bytes  p = table;      FT_Bytes  p     = table;
279      FT_Bytes  limit = 0;      FT_Bytes  limit = 0;
280    
281      FT_ULong   version;      FT_ULong   version;
# Line 299  Line 304 
304      format          = FT_NEXT_USHORT( p );      format          = FT_NEXT_USHORT( p );
305      defaultBaseline = FT_NEXT_USHORT( p );      defaultBaseline = FT_NEXT_USHORT( p );
306    
307      /* version 1.0 is only defined (1996) */      /* only version 1.0 is defined (1996) */
308      if ( version != 0x00010000UL )      if ( version != 0x00010000UL )
309        FT_INVALID_FORMAT;        FT_INVALID_FORMAT;
310    
311      /* format 1, 2, 3 are only defined (1996) */      /* only format 1, 2, 3 are defined (1996) */
312      GXV_TRACE(( " (format = %d)\n", format ));      GXV_TRACE(( " (format = %d)\n", format ));
313      if ( format > 3 )      if ( format > 3 )
314        FT_INVALID_FORMAT;        FT_INVALID_FORMAT;
# Line 311  Line 316 
316      if ( defaultBaseline > 31 )      if ( defaultBaseline > 31 )
317        FT_INVALID_FORMAT;        FT_INVALID_FORMAT;
318    
   
319      bsln->defaultBaseline = defaultBaseline;      bsln->defaultBaseline = defaultBaseline;
320    
321      fmt_funcs_table[format]( p, limit, valid );      fmt_funcs_table[format]( p, limit, valid );
# Line 319  Line 323 
323      FT_TRACE4(( "\n" ));      FT_TRACE4(( "\n" ));
324    }    }
325    
326    
327  /* arch-tag: ebe81143-fdaa-4c68-a4d1-b57227daa3bc  /* arch-tag: ebe81143-fdaa-4c68-a4d1-b57227daa3bc
328     (do not change this comment) */     (do not change this comment) */
329    

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