{
FT_ULong pos1, pos2;
FT_Byte* p;
FT_Byte* p_limit;
pos1 = pos2 = 0;
if ( gindex < face->num_locations )
{
if ( face->header.Index_To_Loc_Format != 0 )
{
p = face->glyph_locations + gindex * 4;
p_limit = face->glyph_locations + face->num_locations * 4;
pos1 = FT_NEXT_ULONG( p );
pos2 = pos1;
if ( p + 4 <= p_limit )
pos2 = FT_NEXT_ULONG( p );
}
else
{
p = face->glyph_locations + gindex * 2;
p_limit = face->glyph_locations + face->num_locations * 2;
pos1 = FT_NEXT_USHORT( p );
pos2 = pos1;
if ( p + 2 <= p_limit )
pos2 = FT_NEXT_USHORT( p );
pos1 <<= 1;
pos2 <<= 1;
}
}
/* Check broken location data */if ( pos1 >= face->glyf_len )
{
FT_TRACE1(( "tt_face_get_location:"" too large offset=0x%08lx found for gid=0x%04lx,"" exceeding the end of glyf table (0x%08lx)\n",
pos1, gindex, face->glyf_len ));
*asize = 0;
return 0;
}
if ( pos2 >= face->glyf_len )
{
FT_TRACE1(( "tt_face_get_location:"" too large offset=0x%08lx found for gid=0x%04lx,"" truncate at the end of glyf table (0x%08lx)\n",
pos2, gindex + 1, face->glyf_len ));
pos2 = face->glyf_len;
}
/* The `loca' table must be ordered; it refers to the length of *//* an entry as the difference between the current and the next *//* position. However, there do exist (malformed) fonts which *//* don't obey this rule, so we are only able to provide an *//* upper bound for the size. *//* *//* We get (intentionally) a wrong, non-zero result in case the *//* `glyf' table is missing. */if ( pos2 >= pos1 )
*asize = (FT_UInt)( pos2 - pos1 );
else
*asize = (FT_UInt)( face->glyf_len - pos1 );
return pos1;
}
Generated on Sat May 26 2012 05:59:57 for ReactOS by
1.7.6.1
ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.