From cec5c57130a44a452c73e09f631d805e518848af Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 5 Feb 2025 12:37:50 +0000 Subject: [PATCH] [aat] Refactor a method --- src/hb-aat-layout-common.hh | 9 +++++++++ src/hb-aat-layout-morx-table.hh | 15 +++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/hb-aat-layout-common.hh b/src/hb-aat-layout-common.hh index 3c8bf2629..4659e8bd5 100644 --- a/src/hb-aat-layout-common.hh +++ b/src/hb-aat-layout-common.hh @@ -86,6 +86,15 @@ struct hb_aat_apply_context_t : HB_INTERNAL void set_ankr_table (const AAT::ankr *ankr_table_); void set_lookup_index (unsigned int i) { lookup_index = i; } + + void setup_buffer_glyph_set () + { + buffer_glyph_set = buffer->bit_set (); + } + bool buffer_intersects_machine () const + { + return buffer_glyph_set.intersects (*machine_glyph_set); + } }; diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh index 9518f7690..b232a40ae 100644 --- a/src/hb-aat-layout-morx-table.hh +++ b/src/hb-aat-layout-morx-table.hh @@ -177,7 +177,7 @@ struct RearrangementSubtable StateTableDriver driver (machine, c->face); - if (!c->buffer_glyph_set.intersects (*c->machine_glyph_set)) + if (!c->buffer_intersects_machine ()) { (void) c->buffer->message (c->font, "skipped chainsubtable because no glyph matches"); return_trace (false); @@ -347,7 +347,7 @@ struct ContextualSubtable StateTableDriver driver (machine, c->face); - if (!c->buffer_glyph_set.intersects (*c->machine_glyph_set)) + if (!c->buffer_intersects_machine ()) { (void) c->buffer->message (c->font, "skipped chainsubtable because no glyph matches"); return_trace (false); @@ -623,7 +623,7 @@ struct LigatureSubtable StateTableDriver driver (machine, c->face); - if (!c->buffer_glyph_set.intersects (*c->machine_glyph_set)) + if (!c->buffer_intersects_machine ()) { (void) c->buffer->message (c->font, "skipped chainsubtable because no glyph matches"); return_trace (false); @@ -664,8 +664,11 @@ struct NoncontextualSubtable { TRACE_APPLY (this); - if (!c->buffer_glyph_set.intersects (*c->machine_glyph_set)) + if (!c->buffer_intersects_machine ()) + { + (void) c->buffer->message (c->font, "skipped chainsubtable because no glyph matches"); return_trace (false); + } const OT::GDEF &gdef (*c->gdef_table); bool has_glyph_classes = gdef.has_glyph_classes (); @@ -917,7 +920,7 @@ struct InsertionSubtable StateTableDriver driver (machine, c->face); - if (!c->buffer_glyph_set.intersects (*c->machine_glyph_set)) + if (!c->buffer_intersects_machine ()) { (void) c->buffer->message (c->font, "skipped chainsubtable because no glyph matches"); return_trace (false); @@ -1452,7 +1455,7 @@ struct mortmorx c->buffer->unsafe_to_concat (); - c->buffer_glyph_set = c->buffer->bit_set (); + c->setup_buffer_glyph_set (); c->set_lookup_index (0); const Chain *chain = &firstChain;