From 950c7ab3f0486b5baa0f602c7b12fc85cadd5428 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 26 Jan 2023 15:26:05 -0700 Subject: [PATCH] [gsubgpos] Use accelerator when recursing --- src/hb-ot-layout-gpos-table.hh | 12 ++++++++++-- src/hb-ot-layout-gsub-table.hh | 12 ++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) 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;