[aat] For short words, use buffer digest to skip kerx machine subtables

Shows 3 / 4% speedup in fa-words test case with GeezaPro.
This commit is contained in:
Behdad Esfahbod 2024-05-13 15:43:50 -06:00
parent 3ff9ebc868
commit f536a416fd

View file

@ -367,6 +367,12 @@ struct KerxSubTableFormat1
driver_context_t dc (this, c);
StateTableDriver<Types, EntryData> driver (machine, c->font->face);
if (driver.is_idempotent_on_all_out_of_bounds (&dc, c) &&
!(c->buffer_digest.may_have (c->left_set) &&
c->buffer_digest.may_have (c->right_set)))
return_trace (false);
driver.drive (&dc, c);
return_trace (true);
@ -635,6 +641,12 @@ struct KerxSubTableFormat4
driver_context_t dc (this, c);
StateTableDriver<Types, EntryData> driver (machine, c->font->face);
if (driver.is_idempotent_on_all_out_of_bounds (&dc, c) &&
!(c->buffer_digest.may_have (c->left_set) &&
c->buffer_digest.may_have (c->right_set)))
return_trace (false);
driver.drive (&dc, c);
return_trace (true);
@ -919,6 +931,9 @@ struct KerxTable
{
if (st->get_type () == 1)
return true;
// TODO: What about format 4? What's this API used for anyway?
st = &StructAfter<SubTable> (*st);
}
return false;
@ -962,6 +977,11 @@ struct KerxTable
{
c->buffer->unsafe_to_concat ();
if (c->buffer->len < 16)
c->buffer_digest = c->buffer->digest ();
else
c->buffer_digest = hb_set_digest_t::full ();
typedef typename T::SubTable SubTable;
bool ret = false;