[sbix] Add get_strike()

This commit is contained in:
Behdad Esfahbod 2018-10-28 15:11:10 -07:00
parent 400bc3f030
commit c712005f55

View File

@ -83,12 +83,12 @@ struct SBIXStrike
inline hb_blob_t *get_glyph_blob (unsigned int glyph_id,
hb_blob_t *sbix_blob,
unsigned int sbix_len,
unsigned int strike_offset,
int *x_offset,
int *y_offset,
hb_tag_t file_type,
unsigned int num_glyphs) const
{
unsigned int strike_offset = (const char *) this - (const char *) sbix_blob->data;
if (imageOffsetsZ[glyph_id + 1] - imageOffsetsZ[glyph_id] == 0)
return hb_blob_get_empty ();
@ -184,9 +184,19 @@ struct sbix
hb_codepoint_t glyph_id,
int *x_offset,
int *y_offset) const
{
return get_strike (font).get_glyph_blob (glyph_id, sbix_blob, sbix_len,
x_offset, y_offset,
HB_TAG ('p','n','g',' '),
num_glyphs);
}
private:
inline const SBIXStrike &get_strike (hb_font_t *font) const
{
if (unlikely (!table->strikes.len))
return hb_blob_get_empty ();
return Null(SBIXStrike);
unsigned int requested_ppem = MAX (font->x_ppem, font->y_ppem);
if (!requested_ppem)
@ -206,16 +216,9 @@ struct sbix
}
}
const SBIXStrike &strike = table+table->strikes[best_i];
return strike.get_glyph_blob (glyph_id, sbix_blob, sbix_len,
table->strikes[best_i],
x_offset, y_offset,
HB_TAG ('p','n','g',' '),
num_glyphs);
return table+table->strikes[best_i];
}
private:
struct PNGHeader
{
HBUINT8 signature[8];