Revert "[aat] Remove set-digest"

This reverts commit 832f199607.
This commit is contained in:
Behdad Esfahbod 2025-02-04 17:28:29 +00:00
parent 359d163d25
commit e1cb3b155a
2 changed files with 33 additions and 1 deletions

View file

@ -68,6 +68,7 @@ struct hb_aat_apply_context_t :
hb_set_digest_t buffer_digest = hb_set_digest_t::full ();
const hb_set_t *left_set = nullptr;
const hb_set_t *right_set = nullptr;
hb_set_digest_t machine_glyph_set = hb_set_digest_t::full ();
hb_aat_class_cache_t *machine_class_cache = nullptr;
hb_mask_t subtable_flags = 0;
@ -941,7 +942,7 @@ struct StateTableDriver
{
const auto entry = machine.get_entry (StateTableT::STATE_START_OF_TEXT, CLASS_OUT_OF_BOUNDS);
return !c->is_actionable (ac->buffer, this, entry) &&
machine.new_state (entry.newState) == StateTableT::STATE_START_OF_TEXT;
machine.new_state (entry.newState) == StateTableT::STATE_START_OF_TEXT;
}
template <typename context_t>

View file

@ -171,6 +171,10 @@ struct RearrangementSubtable
StateTableDriver<Types, EntryData> driver (machine, c->face);
if (driver.is_idempotent_on_all_out_of_bounds (&dc, c) &&
!c->buffer_digest.may_have (c->machine_glyph_set))
return_trace (false);
driver.drive (&dc, c);
return_trace (dc.ret);
@ -332,6 +336,10 @@ struct ContextualSubtable
StateTableDriver<Types, EntryData> driver (machine, c->face);
if (driver.is_idempotent_on_all_out_of_bounds (&dc, c) &&
!c->buffer_digest.may_have (c->machine_glyph_set))
return_trace (false);
driver.drive (&dc, c);
return_trace (dc.ret);
@ -591,6 +599,10 @@ struct LigatureSubtable
StateTableDriver<Types, EntryData> driver (machine, c->face);
if (driver.is_idempotent_on_all_out_of_bounds (&dc, c) &&
!c->buffer_digest.may_have (c->machine_glyph_set))
return_trace (false);
driver.drive (&dc, c);
return_trace (dc.ret);
@ -863,6 +875,10 @@ struct InsertionSubtable
StateTableDriver<Types, EntryData> driver (machine, c->face);
if (driver.is_idempotent_on_all_out_of_bounds (&dc, c) &&
!c->buffer_digest.may_have (c->machine_glyph_set))
return_trace (false);
driver.drive (&dc, c);
return_trace (dc.ret);
@ -919,11 +935,25 @@ struct hb_accelerate_subtables_context_t :
friend struct hb_aat_layout_lookup_accelerator_t;
public:
hb_set_digest_t digest;
mutable hb_aat_class_cache_t class_cache;
template <typename T>
auto init_ (const T &obj_, unsigned num_glyphs, hb_priority<1>) HB_AUTO_RETURN
(
obj_.machine.collect_glyphs (this->digest, num_glyphs)
)
template <typename T>
void init_ (const T &obj_, unsigned num_glyphs, hb_priority<0>)
{
digest = digest.full ();
}
template <typename T>
void init (const T &obj_, unsigned num_glyphs)
{
init_ (obj_, num_glyphs, hb_prioritize);
class_cache.clear ();
}
@ -1143,6 +1173,7 @@ struct Chain
hb_map ([subtable_flags] (const hb_aat_map_t::range_flags_t _) -> bool { return subtable_flags & (_.flags); })))
goto skip;
c->subtable_flags = subtable_flags;
c->machine_glyph_set = accel ? accel->subtables[i].digest : hb_set_digest_t::full ();
c->machine_class_cache = accel ? &accel->subtables[i].class_cache : nullptr;
if (!(subtable->get_coverage() & ChainSubtable<Types>::AllDirections) &&