[gsubgpos] Add fast-path for end-of-string in (Chain)RuleSet::apply()

pull/4330/head
Behdad Esfahbod 1 year ago
parent e7ce633946
commit 4ea3737d04
  1. 26
      src/hb-ot-layout-gsubgpos.hh

@ -2204,7 +2204,18 @@ struct RuleSet
}
}
else
goto slow;
{
/* Failed to match a next glyph. Only try applying rules that have
* no further input. */
return_trace (
+ hb_iter (rule)
| hb_map (hb_add (this))
| hb_filter ([&] (const Rule &_) { return _.inputCount <= 1; })
| hb_map ([&] (const Rule &_) { return _.apply (c, lookup_context); })
| hb_any
)
;
}
bool unsafe_to_concat = false;
@ -3346,7 +3357,18 @@ struct ChainRuleSet
}
}
else
goto slow;
{
/* Failed to match a next glyph. Only try applying rules that have
* no further input and lookahead. */
return_trace (
+ hb_iter (rule)
| hb_map (hb_add (this))
| hb_filter ([&] (const ChainRule &_) { return _.inputX.lenP1 <= 1 && _.lookaheadX.len == 0; })
| hb_map ([&] (const ChainRule &_) { return _.apply (c, lookup_context); })
| hb_any
)
;
}
bool unsafe_to_concat = false;

Loading…
Cancel
Save