From f9f26bff4c79d65a92affd6b73e2b3de017f2d6d Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 28 Oct 2018 14:20:50 -0700 Subject: [PATCH] [sbix] Move code around. Add get_extents() --- src/hb-ot-color-sbix-table.hh | 15 +++++++++++++-- src/hb-ot-font.cc | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/hb-ot-color-sbix-table.hh b/src/hb-ot-color-sbix-table.hh index ad962e6ad..8dc2aedb1 100644 --- a/src/hb-ot-color-sbix-table.hh +++ b/src/hb-ot-color-sbix-table.hh @@ -157,6 +157,8 @@ struct sbix hb_blob_destroy (sbix_blob); } + inline bool has_data () const { return sbix_len; } + /* only to support dump-emoji, don't use it anywhere else */ inline unsigned int *get_available_ppems (unsigned int *length) { @@ -170,6 +172,15 @@ struct sbix 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, unsigned int x_ppem, unsigned int y_ppem, @@ -196,6 +207,8 @@ struct sbix file_type, num_glyphs); } + private: + struct PNGHeader { HBUINT8 signature[8]; @@ -245,8 +258,6 @@ struct sbix return true; } - inline bool has_data () const { return sbix_len; } - private: hb_blob_t *sbix_blob; const sbix *sbix_table; diff --git a/src/hb-ot-font.cc b/src/hb-ot-font.cc index fa6fda27a..7b31e025d 100644 --- a/src/hb-ot-font.cc +++ b/src/hb-ot-font.cc @@ -183,7 +183,7 @@ hb_ot_get_glyph_extents (hb_font_t *font, void *user_data HB_UNUSED) { 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) ret = ot_face->glyf->get_extents (glyph, extents); if (!ret)