[sbix] Move code around. Add get_extents()

This commit is contained in:
Behdad Esfahbod 2018-10-28 14:20:50 -07:00
parent 48bc3039cb
commit f9f26bff4c
2 changed files with 14 additions and 3 deletions

View File

@ -157,6 +157,8 @@ struct sbix
hb_blob_destroy (sbix_blob); hb_blob_destroy (sbix_blob);
} }
inline bool has_data () const { return sbix_len; }
/* only to support dump-emoji, don't use it anywhere else */ /* only to support dump-emoji, don't use it anywhere else */
inline unsigned int *get_available_ppems (unsigned int *length) inline unsigned int *get_available_ppems (unsigned int *length)
{ {
@ -170,6 +172,15 @@ struct sbix
return result; return result;
} }
inline bool get_extents (hb_codepoint_t glyph,
unsigned int x_ppem,
unsigned int y_ppem,
hb_glyph_extents_t *extents) const
{
/* We only support PNG right now, and following function checks type. */
return get_png_extents (glyph, x_ppem, y_ppem, extents);
}
inline hb_blob_t *reference_blob_for_glyph (hb_codepoint_t glyph_id, inline hb_blob_t *reference_blob_for_glyph (hb_codepoint_t glyph_id,
unsigned int x_ppem, unsigned int x_ppem,
unsigned int y_ppem, unsigned int y_ppem,
@ -196,6 +207,8 @@ struct sbix
file_type, num_glyphs); file_type, num_glyphs);
} }
private:
struct PNGHeader struct PNGHeader
{ {
HBUINT8 signature[8]; HBUINT8 signature[8];
@ -245,8 +258,6 @@ struct sbix
return true; return true;
} }
inline bool has_data () const { return sbix_len; }
private: private:
hb_blob_t *sbix_blob; hb_blob_t *sbix_blob;
const sbix *sbix_table; const sbix *sbix_table;

View File

@ -183,7 +183,7 @@ hb_ot_get_glyph_extents (hb_font_t *font,
void *user_data HB_UNUSED) void *user_data HB_UNUSED)
{ {
const hb_ot_face_data_t *ot_face = (const hb_ot_face_data_t *) font_data; const hb_ot_face_data_t *ot_face = (const hb_ot_face_data_t *) font_data;
bool ret = ot_face->sbix->get_png_extents (glyph, font->x_ppem, font->y_ppem, extents); bool ret = ot_face->sbix->get_extents (glyph, font->x_ppem, font->y_ppem, extents);
if (!ret) if (!ret)
ret = ot_face->glyf->get_extents (glyph, extents); ret = ot_face->glyf->get_extents (glyph, extents);
if (!ret) if (!ret)