From 684c8fcea7a1ac91dcef256d6242a68445664dd4 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 6 Jul 2022 13:37:52 -0600 Subject: [PATCH] [>64k:layout] Templatize MultipleSubst --- src/OT/Layout/GSUB/MultipleSubst.hh | 4 ++-- src/OT/Layout/GSUB/MultipleSubstFormat1.hh | 13 +++++++------ src/OT/Layout/GSUB/Sequence.hh | 3 ++- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/OT/Layout/GSUB/MultipleSubst.hh b/src/OT/Layout/GSUB/MultipleSubst.hh index b7a966603..fd1540fce 100644 --- a/src/OT/Layout/GSUB/MultipleSubst.hh +++ b/src/OT/Layout/GSUB/MultipleSubst.hh @@ -12,8 +12,8 @@ struct MultipleSubst { protected: union { - HBUINT16 format; /* Format identifier */ - MultipleSubstFormat1 format1; + HBUINT16 format; /* Format identifier */ + MultipleSubstFormat1_2 format1; } u; public: diff --git a/src/OT/Layout/GSUB/MultipleSubstFormat1.hh b/src/OT/Layout/GSUB/MultipleSubstFormat1.hh index 989901833..89a04ec3b 100644 --- a/src/OT/Layout/GSUB/MultipleSubstFormat1.hh +++ b/src/OT/Layout/GSUB/MultipleSubstFormat1.hh @@ -8,18 +8,19 @@ namespace OT { namespace Layout { namespace GSUB_impl { -struct MultipleSubstFormat1 +template +struct MultipleSubstFormat1_2 { protected: HBUINT16 format; /* Format identifier--format = 1 */ - Offset16To + typename Types::template OffsetTo coverage; /* Offset to Coverage table--from * beginning of Substitution table */ - Array16OfOffset16To + Array16Of>> sequence; /* Array of Sequence tables * ordered by Coverage Index */ public: - DEFINE_SIZE_ARRAY (6, sequence); + DEFINE_SIZE_ARRAY (4 + Types::size, sequence); bool sanitize (hb_sanitize_context_t *c) const { @@ -39,7 +40,7 @@ struct MultipleSubstFormat1 | hb_filter (c->parent_active_glyphs (), hb_first) | hb_map (hb_second) | hb_map (hb_add (this)) - | hb_apply ([c] (const Sequence &_) { _.closure (c); }) + | hb_apply ([c] (const Sequence &_) { _.closure (c); }) ; } @@ -51,7 +52,7 @@ struct MultipleSubstFormat1 + hb_zip (this+coverage, sequence) | hb_map (hb_second) | hb_map (hb_add (this)) - | hb_apply ([c] (const Sequence &_) { _.collect_glyphs (c); }) + | hb_apply ([c] (const Sequence &_) { _.collect_glyphs (c); }) ; } diff --git a/src/OT/Layout/GSUB/Sequence.hh b/src/OT/Layout/GSUB/Sequence.hh index ffdc15b6e..c5cd15bb2 100644 --- a/src/OT/Layout/GSUB/Sequence.hh +++ b/src/OT/Layout/GSUB/Sequence.hh @@ -7,10 +7,11 @@ namespace OT { namespace Layout { namespace GSUB_impl { +template struct Sequence { protected: - Array16Of + Array16Of substitute; /* String of GlyphIDs to substitute */ public: DEFINE_SIZE_ARRAY (2, substitute);