[cmap] Push get_nominal_glyphs down into cmap accelerator

This commit is contained in:
Behdad Esfahbod 2018-11-05 19:49:54 -05:00
parent 36d85dce25
commit 56ba998cdd
2 changed files with 24 additions and 10 deletions

View File

@ -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,

View File

@ -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