diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh index 8fe987fc5..f99f86a2a 100644 --- a/src/hb-ot-layout-gpos-table.hh +++ b/src/hb-ot-layout-gpos-table.hh @@ -56,12 +56,20 @@ PosLookup::dispatch_recurse_func (hb_closure_looku template <> inline bool PosLookup::dispatch_recurse_func (hb_ot_apply_context_t *c, unsigned int lookup_index) { - const PosLookup &l = c->face->table.GPOS.get_relaxed ()->table->get_lookup (lookup_index); + auto *gpos = c->face->table.GPOS.get_relaxed (); + const PosLookup &l = gpos->table->get_lookup (lookup_index); unsigned int saved_lookup_props = c->lookup_props; unsigned int saved_lookup_index = c->lookup_index; c->set_lookup_index (lookup_index); c->set_lookup_props (l.get_props ()); - bool ret = l.dispatch (c); + + bool ret = false; + if (lookup_index < gpos->lookup_count) + { + auto &accel = gpos->accels[lookup_index]; + ret = accel.apply (c, false); + } + c->set_lookup_index (saved_lookup_index); c->set_lookup_props (saved_lookup_props); return ret; diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index 50301ff1d..418116126 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh @@ -69,12 +69,20 @@ SubstLookup::dispatch_recurse_func (hb_closure_loo template <> inline bool SubstLookup::dispatch_recurse_func (hb_ot_apply_context_t *c, unsigned int lookup_index) { - const SubstLookup &l = c->face->table.GSUB.get_relaxed ()->table->get_lookup (lookup_index); + auto *gsub = c->face->table.GSUB.get_relaxed (); + const SubstLookup &l = gsub->table->get_lookup (lookup_index); unsigned int saved_lookup_props = c->lookup_props; unsigned int saved_lookup_index = c->lookup_index; c->set_lookup_index (lookup_index); c->set_lookup_props (l.get_props ()); - bool ret = l.dispatch (c); + + bool ret = false; + if (lookup_index < gsub->lookup_count) + { + auto &accel = gsub->accels[lookup_index]; + ret = accel.apply (c, false); + } + c->set_lookup_index (saved_lookup_index); c->set_lookup_props (saved_lookup_props); return ret;