15 |
/* */ |
/* */ |
16 |
/***************************************************************************/ |
/***************************************************************************/ |
17 |
|
|
18 |
|
/***************************************************************************/ |
19 |
|
/* */ |
20 |
|
/* gxvalid is derived from both gxlayout module and otvalid module. */ |
21 |
|
/* Development of gxlayout is supported by the Information-technology */ |
22 |
|
/* Promotion Agency(IPA), Japan. */ |
23 |
|
/* */ |
24 |
|
/***************************************************************************/ |
25 |
|
|
26 |
|
|
27 |
#include "gxvalid.h" |
#include "gxvalid.h" |
28 |
#include "gxvcommn.h" |
#include "gxvcommn.h" |
29 |
|
|
38 |
#define FT_COMPONENT trace_gxvopbd |
#define FT_COMPONENT trace_gxvopbd |
39 |
|
|
40 |
|
|
|
|
|
41 |
/*************************************************************************/ |
/*************************************************************************/ |
42 |
/*************************************************************************/ |
/*************************************************************************/ |
43 |
/***** *****/ |
/***** *****/ |
53 |
|
|
54 |
} GXV_opbd_DataRec, *GXV_opbd_Data; |
} GXV_opbd_DataRec, *GXV_opbd_Data; |
55 |
|
|
56 |
#define GXV_OPBD_DATA(FIELD) GXV_TABLE_DATA( opbd, FIELD ) |
|
57 |
|
#define GXV_OPBD_DATA( FIELD ) GXV_TABLE_DATA( opbd, FIELD ) |
58 |
|
|
59 |
|
|
60 |
/*************************************************************************/ |
/*************************************************************************/ |
80 |
if ( value.u < GXV_OPBD_DATA( valueOffset_min ) ) |
if ( value.u < GXV_OPBD_DATA( valueOffset_min ) ) |
81 |
GXV_OPBD_DATA( valueOffset_min ) = value.u; |
GXV_OPBD_DATA( valueOffset_min ) = value.u; |
82 |
|
|
|
|
|
83 |
for ( i = 0; i < 4; i++ ) |
for ( i = 0; i < 4; i++ ) |
84 |
{ |
{ |
85 |
GXV_LIMIT_CHECK( 2 ); |
GXV_LIMIT_CHECK( 2 ); |
86 |
delta_value = FT_NEXT_SHORT( p ); |
delta_value = FT_NEXT_SHORT( p ); |
87 |
|
|
88 |
if ( GXV_OPBD_DATA( format ) ) /* format 1, value is ctrl pt. */ |
if ( GXV_OPBD_DATA( format ) ) /* format 1, value is ctrl pt. */ |
89 |
{ |
{ |
90 |
if ( delta_value == -1 ) |
if ( delta_value == -1 ) |
91 |
continue; |
continue; |
92 |
|
|
93 |
gxv_ctlPoint_validate( glyph, delta_value, valid ); |
gxv_ctlPoint_validate( glyph, delta_value, valid ); |
94 |
} |
} |
95 |
else /* format 0, value is distance */ |
else /* format 0, value is distance */ |
96 |
continue; |
continue; |
97 |
} |
} |
98 |
} |
} |
138 |
{ |
{ |
139 |
GXV_LookupValueDesc value; |
GXV_LookupValueDesc value; |
140 |
|
|
141 |
|
FT_UNUSED( lookuptbl_limit ); |
142 |
|
FT_UNUSED( valid ); |
143 |
|
|
144 |
|
|
145 |
value.u = base_value.u + ( relative_gindex * 4 * sizeof ( FT_Short ) ); |
value.u = base_value.u + relative_gindex * 4 * sizeof ( FT_Short ); |
146 |
|
|
147 |
return value; |
return value; |
148 |
} |
} |
149 |
|
|
150 |
|
|
151 |
/*************************************************************************/ |
/*************************************************************************/ |
152 |
/*************************************************************************/ |
/*************************************************************************/ |
153 |
/***** *****/ |
/***** *****/ |
175 |
valid->table_data = opbd; |
valid->table_data = opbd; |
176 |
valid->face = face; |
valid->face = face; |
177 |
|
|
178 |
FT_TRACE3(( "validation opbd table\n" )); |
FT_TRACE3(( "validating `opbd' table\n" )); |
179 |
GXV_INIT; |
GXV_INIT; |
180 |
GXV_OPBD_DATA( valueOffset_min ) = 0xFFFF; |
GXV_OPBD_DATA( valueOffset_min ) = 0xFFFFU; |
181 |
|
|
182 |
|
|
183 |
GXV_LIMIT_CHECK( 4 + 2 ); |
GXV_LIMIT_CHECK( 4 + 2 ); |
185 |
GXV_OPBD_DATA( format ) = FT_NEXT_USHORT( p ); |
GXV_OPBD_DATA( format ) = FT_NEXT_USHORT( p ); |
186 |
|
|
187 |
|
|
188 |
/* 0x00010000 is only defined (1996) */ |
/* only 0x00010000 is defined (1996) */ |
189 |
GXV_TRACE(( "(version=0x%08x)\n", version )); |
GXV_TRACE(( "(version=0x%08x)\n", version )); |
190 |
if ( 0x00010000UL != version ) |
if ( 0x00010000UL != version ) |
191 |
FT_INVALID_FORMAT; |
FT_INVALID_FORMAT; |
192 |
|
|
193 |
/* 0, 1 are only defined (1996) */ |
/* only values 0 and 1 are defined (1996) */ |
194 |
GXV_TRACE(( "(format=0x%04x)\n", GXV_OPBD_DATA( format ) )); |
GXV_TRACE(( "(format=0x%04x)\n", GXV_OPBD_DATA( format ) )); |
195 |
if ( 0x0001 < GXV_OPBD_DATA( format ) ) |
if ( 0x0001 < GXV_OPBD_DATA( format ) ) |
196 |
FT_INVALID_FORMAT; |
FT_INVALID_FORMAT; |
197 |
|
|
|
|
|
198 |
valid->lookupval_sign = GXV_LOOKUPVALUE_UNSIGNED; |
valid->lookupval_sign = GXV_LOOKUPVALUE_UNSIGNED; |
199 |
valid->lookupval_func = gxv_opbd_LookupValue_validate; |
valid->lookupval_func = gxv_opbd_LookupValue_validate; |
200 |
valid->lookupfmt4_trans = gxv_opbd_LookupFmt4_transit; |
valid->lookupfmt4_trans = gxv_opbd_LookupFmt4_transit; |
201 |
|
|
202 |
gxv_LookupTable_validate( p, limit, valid ); |
gxv_LookupTable_validate( p, limit, valid ); |
203 |
p += valid->subtable_length; |
p += valid->subtable_length; |
204 |
|
|
|
|
|
205 |
if ( p > table + GXV_OPBD_DATA( valueOffset_min ) ) |
if ( p > table + GXV_OPBD_DATA( valueOffset_min ) ) |
206 |
{ |
{ |
207 |
GXV_TRACE(( "found overlap between LookupTable and opbd_value array\n" )); |
GXV_TRACE(( |
208 |
|
"found overlap between LookupTable and opbd_value array\n" )); |
209 |
FT_INVALID_OFFSET; |
FT_INVALID_OFFSET; |
210 |
} |
} |
211 |
|
|
|
|
|
212 |
FT_TRACE4(( "\n" )); |
FT_TRACE4(( "\n" )); |
213 |
} |
} |
214 |
|
|