diff options
author | Behdad Esfahbod <behdad@behdad.org> | 2018-11-05 19:49:54 -0500 |
---|---|---|
committer | Behdad Esfahbod <behdad@behdad.org> | 2018-11-05 19:49:54 -0500 |
commit | 56ba998cddbb2ba5d24fb0b02d2bf77a46c0f23f (patch) | |
tree | 300de8910f9b802bc403ddf0da429969996674ce | |
parent | 36d85dce25abd079252d973f804220bf7b97e987 (diff) |
[cmap] Push get_nominal_glyphs down into cmap accelerator
-rw-r--r-- | src/hb-ot-cmap-table.hh | 21 | ||||
-rw-r--r-- | src/hb-ot-font.cc | 13 |
2 files changed, 24 insertions, 10 deletions
diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index 2013ae98..399c46bf 100644 --- a/src/hb-ot-cmap-table.hh +++ b/src/hb-ot-cmap-table.hh @@ -1060,6 +1060,27 @@ struct cmap if (unlikely (!this->get_glyph_funcZ)) return false; return this->get_glyph_funcZ (this->get_glyph_data, unicode, glyph); } + inline unsigned int get_nominal_glyphs (unsigned int count, + const hb_codepoint_t *first_unicode, + unsigned int unicode_stride, + hb_codepoint_t *first_glyph, + unsigned int glyph_stride) const + { + if (unlikely (!this->get_glyph_funcZ)) return 0; + + hb_cmap_get_glyph_func_t get_glyph_funcZ = this->get_glyph_funcZ; + const void *get_glyph_data = this->get_glyph_data; + + unsigned int done; + for (done = 0; + done < count && get_glyph_funcZ (get_glyph_data, *first_unicode, first_glyph); + done++) + { + first_unicode = &StructAtOffset<hb_codepoint_t> (first_unicode, unicode_stride); + first_glyph = &StructAtOffset<hb_codepoint_t> (first_glyph, glyph_stride); + } + return done; + } inline bool get_variation_glyph (hb_codepoint_t unicode, hb_codepoint_t variation_selector, diff --git a/src/hb-ot-font.cc b/src/hb-ot-font.cc index 41bea140..3e2f1f65 100644 --- a/src/hb-ot-font.cc +++ b/src/hb-ot-font.cc @@ -76,16 +76,9 @@ hb_ot_get_nominal_glyphs (hb_font_t *font HB_UNUSED, void *user_data HB_UNUSED) { const hb_ot_face_data_t *ot_face = (const hb_ot_face_data_t *) font_data; - const OT::cmap_accelerator_t &cmap = *ot_face->cmap; - unsigned int done; - for (done = 0; - done < count && cmap.get_nominal_glyph (*first_unicode, first_glyph); - done++) - { - first_unicode = &StructAtOffset<hb_codepoint_t> (first_unicode, unicode_stride); - first_glyph = &StructAtOffset<hb_codepoint_t> (first_glyph, glyph_stride); - } - return done; + return ot_face->cmap->get_nominal_glyphs (count, + first_unicode, unicode_stride, + first_glyph, glyph_stride); } static hb_bool_t |