diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index 2013ae987c77b9450263ddb54bd4db20dbae614d..399c46bfc98b4fdc5b34b8de205bb1b0dfd4c6c8 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 (first_unicode, unicode_stride); + first_glyph = &StructAtOffset (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 41bea140523e32ab001c61db4c07e214411141ac..3e2f1f656d83b396038bf86502016f70938896b6 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 (first_unicode, unicode_stride); - first_glyph = &StructAtOffset (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