From c47f89d42b911542faac7ca8b38edec36ef6c22e Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 4 Jun 2026 22:09:23 +0200 Subject: [PATCH] [layout] Keep chained-context coverage counts 16-bit Chained context format 5 widens the rule-set offsets, but its rule-set count remains uint16. Likewise, the coverage-array counts in the shared chained coverage-context body remain uint16 while the coverage offsets can widen. Use Array16Of with Types-sized offset entries for those fields. Tested with: ninja -Cbuild Tested with: meson test -C build --suite subset Tested with: meson test -C build --suite shape Tested with: meson test -C build Assisted-by: OpenAI Codex --- src/hb-ot-layout-gsubgpos.hh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh index 35c7a852e..5053d965e 100644 --- a/src/hb-ot-layout-gsubgpos.hh +++ b/src/hb-ot-layout-gsubgpos.hh @@ -4167,11 +4167,11 @@ struct ChainContextFormat2_5 lookaheadClassDef; /* Offset to glyph ClassDef table * containing lookahead sequence * data--from beginning of table */ - typename Types::template ArrayOf> + Array16Of> ruleSet; /* Array of ChainRuleSet tables * ordered by class */ public: - DEFINE_SIZE_ARRAY (2 + 5 * Types::size, ruleSet); + DEFINE_SIZE_ARRAY (4 + 4 * Types::size, ruleSet); }; template @@ -4314,7 +4314,7 @@ struct ChainContextFormat3 bool serialize_coverage_offsets (hb_subset_context_t *c, Iterator it, const void* base) const { TRACE_SERIALIZE (this); - auto *out = c->serializer->start_embed>> (); + auto *out = c->serializer->start_embed>> (); if (unlikely (!out->serialize (c->serializer, 0u))) return_trace (false); for (auto& offset : it) { @@ -4371,15 +4371,15 @@ struct ChainContextFormat3 protected: HBUINT16 format; /* Format identifier--format = 3 */ - typename Types::template ArrayOf> + Array16Of> backtrack; /* Array of coverage tables * in backtracking sequence, in glyph * sequence order */ - typename Types::template ArrayOf> + Array16Of> inputX ; /* Array of coverage * tables in input sequence, in glyph * sequence order */ - typename Types::template ArrayOf> + Array16Of> lookaheadX; /* Array of coverage tables * in lookahead sequence, in glyph * sequence order */ @@ -4387,7 +4387,7 @@ struct ChainContextFormat3 lookupX; /* Array of LookupRecords--in * design order) */ public: - DEFINE_SIZE_MIN (4 + 3 * Types::size); + DEFINE_SIZE_MIN (10); }; struct ChainContext