[gsubgpos] Use accelerator when recursing

This commit is contained in:
Behdad Esfahbod 2023-01-26 15:26:05 -07:00
parent e377888990
commit 950c7ab3f0
2 changed files with 20 additions and 4 deletions

View File

@ -56,12 +56,20 @@ PosLookup::dispatch_recurse_func<hb_closure_lookups_context_t> (hb_closure_looku
template <>
inline bool PosLookup::dispatch_recurse_func<hb_ot_apply_context_t> (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;

View File

@ -69,12 +69,20 @@ SubstLookup::dispatch_recurse_func<hb_closure_lookups_context_t> (hb_closure_loo
template <>
inline bool SubstLookup::dispatch_recurse_func<hb_ot_apply_context_t> (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;