From e14529f9777210d0514166cd2c8e9afe4d2ac1ab Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 4 Jun 2026 22:01:54 +0200 Subject: [PATCH] [layout] Keep reverse-chain coverage counts 16-bit ReverseChainSingleSubst format 2 widens the coverage offsets and substitute glyph IDs, but the backtrack and lookahead coverage-array counts remain uint16. Keep both arrays with 16-bit counts while using the selected Types offset width for their entries. 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/OT/Layout/GSUB/ReverseChainSingleSubstFormat1.hh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/OT/Layout/GSUB/ReverseChainSingleSubstFormat1.hh b/src/OT/Layout/GSUB/ReverseChainSingleSubstFormat1.hh index 05e3b7438..c12a15c37 100644 --- a/src/OT/Layout/GSUB/ReverseChainSingleSubstFormat1.hh +++ b/src/OT/Layout/GSUB/ReverseChainSingleSubstFormat1.hh @@ -15,12 +15,12 @@ struct ReverseChainSingleSubstFormat1_2 typename Types::template OffsetTo coverage; /* Offset to Coverage table--from * beginning of table */ - typename Types::template ArrayOf> + Array16Of> backtrack; /* Array of coverage tables * in backtracking sequence, in glyph * sequence order */ - /* Format 2 widens the lookahead coverage offsets but, unlike the - * backtrack and substitute arrays, keeps the lookahead count 16-bit. */ + /* Format 2 widens the backtrack and lookahead coverage offsets but + * keeps their counts 16-bit. */ Array16Of> lookaheadX; /* Array of coverage tables * in lookahead sequence, in glyph @@ -29,7 +29,7 @@ struct ReverseChainSingleSubstFormat1_2 substituteX; /* Array of substitute * GlyphIDs--ordered by Coverage Index */ public: - DEFINE_SIZE_MIN (4 + 3 * Types::size); + DEFINE_SIZE_MIN (6 + 2 * Types::size); bool sanitize (hb_sanitize_context_t *c) const { @@ -170,7 +170,7 @@ struct ReverseChainSingleSubstFormat1_2 bool serialize_coverage_offset_array (hb_subset_context_t *c, Iterator it) 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) {