[sbix] Simplify 'dupe' handling logic
This commit is contained in:
parent
d7eb534e59
commit
a8cb9c73da
@ -87,8 +87,11 @@ struct SBIXStrike
|
|||||||
int *y_offset,
|
int *y_offset,
|
||||||
unsigned int num_glyphs) const
|
unsigned int num_glyphs) const
|
||||||
{
|
{
|
||||||
|
unsigned int retry_count = 8;
|
||||||
unsigned int sbix_len = sbix_blob->length;
|
unsigned int sbix_len = sbix_blob->length;
|
||||||
unsigned int strike_offset = (const char *) this - (const char *) sbix_blob->data;
|
unsigned int strike_offset = (const char *) this - (const char *) sbix_blob->data;
|
||||||
|
|
||||||
|
retry:
|
||||||
if (imageOffsetsZ[glyph_id + 1] < imageOffsetsZ[glyph_id] ||
|
if (imageOffsetsZ[glyph_id + 1] < imageOffsetsZ[glyph_id] ||
|
||||||
imageOffsetsZ[glyph_id + 1] - imageOffsetsZ[glyph_id] <= SBIXGlyph::min_size)
|
imageOffsetsZ[glyph_id + 1] - imageOffsetsZ[glyph_id] <= SBIXGlyph::min_size)
|
||||||
return hb_blob_get_empty ();
|
return hb_blob_get_empty ();
|
||||||
@ -97,20 +100,18 @@ struct SBIXStrike
|
|||||||
return hb_blob_get_empty ();
|
return hb_blob_get_empty ();
|
||||||
|
|
||||||
const SBIXGlyph *glyph = &(this+imageOffsetsZ[glyph_id]);
|
const SBIXGlyph *glyph = &(this+imageOffsetsZ[glyph_id]);
|
||||||
if (unlikely (glyph->graphicType == HB_TAG ('d','u','p','e') &&
|
|
||||||
calculate_blob_size (glyph_id) >= 2))
|
if (glyph->graphicType == HB_TAG ('d','u','p','e'))
|
||||||
{
|
{
|
||||||
unsigned int new_glyph_id = *((HBUINT16 *) &glyph->data);
|
if (calculate_blob_size (glyph_id) >= 2)
|
||||||
if (new_glyph_id < num_glyphs)
|
|
||||||
{
|
{
|
||||||
glyph = &(this+imageOffsetsZ[new_glyph_id]);
|
glyph_id = *((HBUINT16 *) &glyph->data);
|
||||||
glyph_id = new_glyph_id;
|
if (glyph_id < num_glyphs && retry_count--)
|
||||||
if (strike_offset + (unsigned int) imageOffsetsZ[glyph_id] + SBIXGlyph::min_size > sbix_len)
|
goto retry;
|
||||||
return hb_blob_get_empty ();
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
return hb_blob_get_empty ();
|
return hb_blob_get_empty ();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unlikely (file_type != glyph->graphicType))
|
if (unlikely (file_type != glyph->graphicType))
|
||||||
return hb_blob_get_empty ();
|
return hb_blob_get_empty ();
|
||||||
unsigned int blob_size = calculate_blob_size (glyph_id);
|
unsigned int blob_size = calculate_blob_size (glyph_id);
|
||||||
|
Loading…
Reference in New Issue
Block a user