diff --git a/src/OT/Layout/GPOS/PairPos.hh b/src/OT/Layout/GPOS/PairPos.hh index 7bf79e98b..2434650d3 100644 --- a/src/OT/Layout/GPOS/PairPos.hh +++ b/src/OT/Layout/GPOS/PairPos.hh @@ -13,7 +13,7 @@ struct PairPos protected: union { HBUINT16 format; /* Format identifier */ - PairPosFormat1 format1; + PairPosFormat1_3 format1; PairPosFormat2_4 format2; #ifndef HB_NO_BORING_EXPANSION PairPosFormat2_4 format4; diff --git a/src/OT/Layout/GPOS/PairPosFormat1.hh b/src/OT/Layout/GPOS/PairPosFormat1.hh index dd7e49d92..c291b540e 100644 --- a/src/OT/Layout/GPOS/PairPosFormat1.hh +++ b/src/OT/Layout/GPOS/PairPosFormat1.hh @@ -8,8 +8,12 @@ namespace Layout { namespace GPOS_impl { -struct PairPosFormat1 +template +struct PairPosFormat1_3 { + using PairSet = GPOS_impl::PairSet; + using PairValueRecord = GPOS_impl::PairValueRecord; + protected: HBUINT16 format; /* Format identifier--format = 1 */ Offset16To @@ -35,7 +39,7 @@ struct PairPosFormat1 unsigned int len1 = valueFormat[0].get_len (); unsigned int len2 = valueFormat[1].get_len (); - PairSet::sanitize_closure_t closure = + typename PairSet::sanitize_closure_t closure = { valueFormat, len1, diff --git a/src/OT/Layout/GPOS/PairSet.hh b/src/OT/Layout/GPOS/PairSet.hh index e9f5397c2..58ba4de6c 100644 --- a/src/OT/Layout/GPOS/PairSet.hh +++ b/src/OT/Layout/GPOS/PairSet.hh @@ -8,9 +8,13 @@ namespace Layout { namespace GPOS_impl { +template struct PairSet { - friend struct PairPosFormat1; + template + friend struct PairPosFormat1_3; + + using PairValueRecord = GPOS_impl::PairValueRecord; protected: HBUINT16 len; /* Number of PairValueRecords */ @@ -136,7 +140,7 @@ struct PairSet unsigned len2 = valueFormats[1].get_len (); unsigned record_size = HBUINT16::static_size + Value::static_size * (len1 + len2); - PairValueRecord::context_t context = + typename PairValueRecord::context_t context = { this, valueFormats, diff --git a/src/OT/Layout/GPOS/PairValueRecord.hh b/src/OT/Layout/GPOS/PairValueRecord.hh index 364af109c..55de5abeb 100644 --- a/src/OT/Layout/GPOS/PairValueRecord.hh +++ b/src/OT/Layout/GPOS/PairValueRecord.hh @@ -6,18 +6,21 @@ namespace Layout { namespace GPOS_impl { +template struct PairValueRecord { + template friend struct PairSet; protected: - HBGlyphID16 secondGlyph; /* GlyphID of second glyph in the + typename Types::HBGlyphID + secondGlyph; /* GlyphID of second glyph in the * pair--first glyph is listed in the * Coverage table */ ValueRecord values; /* Positioning data for the first glyph * followed by for second glyph */ public: - DEFINE_SIZE_ARRAY (2, values); + DEFINE_SIZE_ARRAY (Types::size, values); int cmp (hb_codepoint_t k) const { return secondGlyph.cmp (k); }