[ot-font] Don't pre-load cmap table
Now that we have get_h_advances() and get_nominal_glyphs() implemented, the overhead of doing a proper atomic load would be once per run, NOT once per glyph. So, no need to pre-load the tables to avoid that overhead. As such, hb_ot_font_set_funcs() has become really cheap. Can *finally* make it be default font functions on all newly created fonts!
This commit is contained in:
parent
ec84460e46
commit
5515355367
|
@ -48,7 +48,7 @@ hb_ot_get_nominal_glyph (hb_font_t *font HB_UNUSED,
|
||||||
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;
|
||||||
return ot_face->cmap.get_relaxed()->get_nominal_glyph (unicode, glyph);
|
return ot_face->cmap.get ()->get_nominal_glyph (unicode, glyph);
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int
|
static unsigned int
|
||||||
|
@ -62,7 +62,7 @@ hb_ot_get_nominal_glyphs (hb_font_t *font HB_UNUSED,
|
||||||
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;
|
||||||
const OT::cmap_accelerator_t &cmap = *ot_face->cmap.get_relaxed ();
|
const OT::cmap_accelerator_t &cmap = *ot_face->cmap.get ();
|
||||||
unsigned int done;
|
unsigned int done;
|
||||||
for (done = 0;
|
for (done = 0;
|
||||||
done < count && cmap.get_nominal_glyph (*first_unicode, first_glyph);
|
done < count && cmap.get_nominal_glyph (*first_unicode, first_glyph);
|
||||||
|
@ -83,7 +83,7 @@ hb_ot_get_variation_glyph (hb_font_t *font HB_UNUSED,
|
||||||
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;
|
||||||
return ot_face->cmap.get_relaxed ()->get_variation_glyph (unicode, variation_selector, glyph);
|
return ot_face->cmap.get ()->get_variation_glyph (unicode, variation_selector, glyph);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -257,9 +257,6 @@ hb_ot_font_set_funcs (hb_font_t *font)
|
||||||
if (unlikely (!hb_ot_shaper_face_data_ensure (font->face))) return;
|
if (unlikely (!hb_ot_shaper_face_data_ensure (font->face))) return;
|
||||||
hb_ot_face_data_t *ot_face = hb_ot_face_data (font->face);
|
hb_ot_face_data_t *ot_face = hb_ot_face_data (font->face);
|
||||||
|
|
||||||
/* Load them lazy. We access it with get_relaxed() for performance. */
|
|
||||||
ot_face->cmap.get ();
|
|
||||||
|
|
||||||
hb_font_set_funcs (font,
|
hb_font_set_funcs (font,
|
||||||
_hb_ot_get_font_funcs (),
|
_hb_ot_get_font_funcs (),
|
||||||
ot_face,
|
ot_face,
|
||||||
|
|
Loading…
Reference in New Issue