From dc5d58a9d7c8dbe67b520b2d080f4bff0ad56421 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 4 Jun 2026 00:09:16 +0200 Subject: [PATCH] [gsub] Widen format 2 subtable arrays Use the layout Types array and offset forms for GSUB subtables that gain 24-bit coverage-indexed arrays in the beyond-64k formats. This widens SingleSubst substitute arrays, MultipleSubst sequence offsets, AlternateSubst alternate-set offsets, LigatureSubst ligature-set offsets, and the LigatureSet offsets to Ligature tables while preserving the nested 16-bit counts required by the spec. Testing: meson test -C build Assisted-by: OpenAI Codex --- src/OT/Layout/GSUB/AlternateSubstFormat1.hh | 2 +- src/OT/Layout/GSUB/LigatureSet.hh | 2 +- src/OT/Layout/GSUB/LigatureSubstFormat1.hh | 4 ++-- src/OT/Layout/GSUB/MultipleSubstFormat1.hh | 4 ++-- src/OT/Layout/GSUB/SingleSubstFormat2.hh | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/OT/Layout/GSUB/AlternateSubstFormat1.hh b/src/OT/Layout/GSUB/AlternateSubstFormat1.hh index 294855907..b1a0973c7 100644 --- a/src/OT/Layout/GSUB/AlternateSubstFormat1.hh +++ b/src/OT/Layout/GSUB/AlternateSubstFormat1.hh @@ -16,7 +16,7 @@ struct AlternateSubstFormat1_2 typename Types::template OffsetTo coverage; /* Offset to Coverage table--from * beginning of Substitution table */ - Array16Of>> + typename Types::template ArrayOf>> alternateSet; /* Array of AlternateSet tables * ordered by Coverage Index */ public: diff --git a/src/OT/Layout/GSUB/LigatureSet.hh b/src/OT/Layout/GSUB/LigatureSet.hh index e39879475..c678bf5f9 100644 --- a/src/OT/Layout/GSUB/LigatureSet.hh +++ b/src/OT/Layout/GSUB/LigatureSet.hh @@ -12,7 +12,7 @@ template struct LigatureSet { public: - Array16OfOffset16To> + Array16Of>> ligature; /* Array LigatureSet tables * ordered by preference */ diff --git a/src/OT/Layout/GSUB/LigatureSubstFormat1.hh b/src/OT/Layout/GSUB/LigatureSubstFormat1.hh index 909ddca22..e08405f99 100644 --- a/src/OT/Layout/GSUB/LigatureSubstFormat1.hh +++ b/src/OT/Layout/GSUB/LigatureSubstFormat1.hh @@ -16,11 +16,11 @@ struct LigatureSubstFormat1_2 typename Types::template OffsetTo coverage; /* Offset to Coverage table--from * beginning of Substitution table */ - Array16Of>> + typename Types::template ArrayOf>> ligatureSet; /* Array LigatureSet tables * ordered by Coverage Index */ public: - DEFINE_SIZE_ARRAY (4 + Types::size, ligatureSet); + DEFINE_SIZE_ARRAY (2 + 2 * Types::size, ligatureSet); bool sanitize (hb_sanitize_context_t *c) const { diff --git a/src/OT/Layout/GSUB/MultipleSubstFormat1.hh b/src/OT/Layout/GSUB/MultipleSubstFormat1.hh index 441d4dee0..bc6d9261e 100644 --- a/src/OT/Layout/GSUB/MultipleSubstFormat1.hh +++ b/src/OT/Layout/GSUB/MultipleSubstFormat1.hh @@ -16,11 +16,11 @@ struct MultipleSubstFormat1_2 typename Types::template OffsetTo coverage; /* Offset to Coverage table--from * beginning of Substitution table */ - Array16Of>> + typename Types::template ArrayOf>> sequence; /* Array of Sequence tables * ordered by Coverage Index */ public: - DEFINE_SIZE_ARRAY (4 + Types::size, sequence); + DEFINE_SIZE_ARRAY (2 + 2 * Types::size, sequence); bool sanitize (hb_sanitize_context_t *c) const { diff --git a/src/OT/Layout/GSUB/SingleSubstFormat2.hh b/src/OT/Layout/GSUB/SingleSubstFormat2.hh index 4c98f05ae..831e33d9c 100644 --- a/src/OT/Layout/GSUB/SingleSubstFormat2.hh +++ b/src/OT/Layout/GSUB/SingleSubstFormat2.hh @@ -15,12 +15,12 @@ struct SingleSubstFormat2_4 typename Types::template OffsetTo coverage; /* Offset to Coverage table--from * beginning of Substitution table */ - Array16Of + typename Types::template ArrayOf substitute; /* Array of substitute * GlyphIDs--ordered by Coverage Index */ public: - DEFINE_SIZE_ARRAY (4 + Types::size, substitute); + DEFINE_SIZE_ARRAY (2 + 2 * Types::size, substitute); bool sanitize (hb_sanitize_context_t *c) const {