From 2376867649f97d25e4319f45845525ec207887f7 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 15 May 2019 21:57:26 -0700 Subject: [PATCH] Use hb_map(hb_add(this)) to dereference OffsetTo<>'s --- src/hb-ot-layout-gsub-table.hh | 30 +++++++++++------ src/hb-ot-layout-gsubgpos.hh | 60 ++++++++++++++++++++++------------ src/hb-ot-stat-table.hh | 2 +- 3 files changed, 61 insertions(+), 31 deletions(-) diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index 15cd44904..a8ac0b803 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh @@ -367,7 +367,8 @@ struct MultipleSubstFormat1 + hb_zip (this+coverage, sequence) | hb_filter (*c->glyphs, hb_first) | hb_map (hb_second) - | hb_apply ([c, this] (const OffsetTo &_) { (this+_).closure (c); }) + | hb_map (hb_add (this)) + | hb_apply ([c] (const Sequence &_) { _.closure (c); }) ; } @@ -376,7 +377,8 @@ struct MultipleSubstFormat1 if (unlikely (!(this+coverage).add_coverage (c->input))) return; + hb_zip (this+coverage, sequence) | hb_map (hb_second) - | hb_apply ([c, this] (const OffsetTo &_) { (this+_).collect_glyphs (c); }) + | hb_map (hb_add (this)) + | hb_apply ([c] (const Sequence &_) { _.collect_glyphs (c); }) ; } @@ -541,7 +543,8 @@ struct AlternateSubstFormat1 { + hb_zip (this+coverage, alternateSet) | hb_map (hb_second) - | hb_apply ([c, this] (const OffsetTo &_) { (this+_).closure (c); }) + | hb_map (hb_add (this)) + | hb_apply ([c] (const AlternateSet &_) { _.closure (c); }) ; } @@ -550,7 +553,8 @@ struct AlternateSubstFormat1 if (unlikely (!(this+coverage).add_coverage (c->input))) return; + hb_zip (this+coverage, alternateSet) | hb_map (hb_second) - | hb_apply ([c, this] (const OffsetTo &_) { (this+_).collect_glyphs (c); }) + | hb_map (hb_add (this)) + | hb_apply ([c] (const AlternateSet &_) { _.collect_glyphs (c); }) ; } @@ -757,7 +761,8 @@ struct LigatureSet { return + hb_iter (ligature) - | hb_map ([this, glyphs] (const OffsetTo &_) { return (this+_).intersects (glyphs); }) + | hb_map (hb_add (this)) + | hb_map ([glyphs] (const Ligature &_) { return _.intersects (glyphs); }) | hb_any ; } @@ -765,14 +770,16 @@ struct LigatureSet void closure (hb_closure_context_t *c) const { + hb_iter (ligature) - | hb_apply ([this, c] (const OffsetTo &_) { (this+_).closure (c); }) + | hb_map (hb_add (this)) + | hb_apply ([c] (const Ligature &_) { _.closure (c); }) ; } void collect_glyphs (hb_collect_glyphs_context_t *c) const { + hb_iter (ligature) - | hb_apply ([this, c] (const OffsetTo &_) { (this+_).collect_glyphs (c); }) + | hb_map (hb_add (this)) + | hb_apply ([c] (const Ligature &_) { _.collect_glyphs (c); }) ; } @@ -780,7 +787,8 @@ struct LigatureSet { return + hb_iter (ligature) - | hb_map ([this, c] (const OffsetTo &_) { return (this+_).would_apply (c); }) + | hb_map (hb_add (this)) + | hb_map ([c] (const Ligature &_) { return _.would_apply (c); }) | hb_any ; } @@ -852,7 +860,8 @@ struct LigatureSubstFormat1 + hb_zip (this+coverage, ligatureSet) | hb_filter (*c->glyphs, hb_first) | hb_map (hb_second) - | hb_apply ([this, c] (const OffsetTo &_) { (this+_).closure (c); }) + | hb_map (hb_add (this)) + | hb_apply ([c] (const LigatureSet &_) { _.closure (c); }) ; } @@ -862,7 +871,8 @@ struct LigatureSubstFormat1 + hb_zip (this+coverage, ligatureSet) | hb_map (hb_second) - | hb_apply ([this, c] (const OffsetTo &_) { (this+_).collect_glyphs (c); }) + | hb_map (hb_add (this)) + | hb_apply ([c] (const LigatureSet &_) { _.collect_glyphs (c); }) ; } diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh index 091930cc2..7d395b5d8 100644 --- a/src/hb-ot-layout-gsubgpos.hh +++ b/src/hb-ot-layout-gsubgpos.hh @@ -1371,7 +1371,8 @@ struct RuleSet { return + hb_iter (rule) - | hb_map ([&] (const OffsetTo &_) { return (this+_).intersects (glyphs, lookup_context); }) + | hb_map (hb_add (this)) + | hb_map ([&] (const Rule &_) { return _.intersects (glyphs, lookup_context); }) | hb_any ; } @@ -1381,7 +1382,8 @@ struct RuleSet { return + hb_iter (rule) - | hb_apply ([&] (const OffsetTo &_) { (this+_).closure (c, lookup_context); }) + | hb_map (hb_add (this)) + | hb_apply ([&] (const Rule &_) { _.closure (c, lookup_context); }) ; } @@ -1390,7 +1392,8 @@ struct RuleSet { return + hb_iter (rule) - | hb_apply ([&] (const OffsetTo &_) { (this+_).collect_glyphs (c, lookup_context); }) + | hb_map (hb_add (this)) + | hb_apply ([&] (const Rule &_) { _.collect_glyphs (c, lookup_context); }) ; } @@ -1399,7 +1402,8 @@ struct RuleSet { return + hb_iter (rule) - | hb_map ([&] (const OffsetTo &_) { return (this+_).would_apply (c, lookup_context); }) + | hb_map (hb_add (this)) + | hb_map ([&] (const Rule &_) { return _.would_apply (c, lookup_context); }) | hb_any ; } @@ -1410,7 +1414,8 @@ struct RuleSet TRACE_APPLY (this); return_trace ( + hb_iter (rule) - | hb_map ([&] (const OffsetTo &_) { return (this+_).apply (c, lookup_context); }) + | hb_map (hb_add (this)) + | hb_map ([&] (const Rule &_) { return _.apply (c, lookup_context); }) | hb_any ) ; @@ -1444,7 +1449,8 @@ struct ContextFormat1 + hb_zip (this+coverage, ruleSet) | hb_filter (*glyphs, hb_first) | hb_map (hb_second) - | hb_map ([&] (const OffsetTo &_) { return (this+_).intersects (glyphs, lookup_context); }) + | hb_map (hb_add (this)) + | hb_map ([&] (const RuleSet &_) { return _.intersects (glyphs, lookup_context); }) | hb_any ; } @@ -1459,7 +1465,8 @@ struct ContextFormat1 + hb_zip (this+coverage, ruleSet) | hb_filter (*c->glyphs, hb_first) | hb_map (hb_second) - | hb_apply ([&] (const OffsetTo &_) { (this+_).closure (c, lookup_context); }) + | hb_map (hb_add (this)) + | hb_apply ([&] (const RuleSet &_) { _.closure (c, lookup_context); }) ; } @@ -1473,7 +1480,8 @@ struct ContextFormat1 }; + hb_iter (ruleSet) - | hb_apply ([&] (const OffsetTo &_) { (this+_).collect_glyphs (c, lookup_context); }) + | hb_map (hb_add (this)) + | hb_apply ([&] (const RuleSet &_) { _.collect_glyphs (c, lookup_context); }) ; } @@ -1571,7 +1579,8 @@ struct ContextFormat2 { return class_def.intersects_class (c->glyphs, _); }, hb_first) | hb_map (hb_second) - | hb_apply ([&] (const OffsetTo &_) { (this+_).closure (c, lookup_context); }) + | hb_map (hb_add (this)) + | hb_apply ([&] (const RuleSet &_) { _.closure (c, lookup_context); }) ; } @@ -1586,7 +1595,8 @@ struct ContextFormat2 }; + hb_iter (ruleSet) - | hb_apply ([&] (const OffsetTo &_) { (this+_).collect_glyphs (c, lookup_context); }) + | hb_map (hb_add (this)) + | hb_apply ([&] (const RuleSet &_) { _.collect_glyphs (c, lookup_context); }) ; } @@ -2022,7 +2032,8 @@ struct ChainRuleSet { return + hb_iter (rule) - | hb_map ([&] (const OffsetTo &_) { return (this+_).intersects (glyphs, lookup_context); }) + | hb_map (hb_add (this)) + | hb_map ([&] (const ChainRule &_) { return _.intersects (glyphs, lookup_context); }) | hb_any ; } @@ -2030,7 +2041,8 @@ struct ChainRuleSet { return + hb_iter (rule) - | hb_apply ([&] (const OffsetTo &_) { (this+_).closure (c, lookup_context); }) + | hb_map (hb_add (this)) + | hb_apply ([&] (const ChainRule &_) { _.closure (c, lookup_context); }) ; } @@ -2038,7 +2050,8 @@ struct ChainRuleSet { return + hb_iter (rule) - | hb_apply ([&] (const OffsetTo &_) { (this+_).collect_glyphs (c, lookup_context); }) + | hb_map (hb_add (this)) + | hb_apply ([&] (const ChainRule &_) { _.collect_glyphs (c, lookup_context); }) ; } @@ -2046,7 +2059,8 @@ struct ChainRuleSet { return + hb_iter (rule) - | hb_map ([&] (const OffsetTo &_) { return (this+_).would_apply (c, lookup_context); }) + | hb_map (hb_add (this)) + | hb_map ([&] (const ChainRule &_) { return _.would_apply (c, lookup_context); }) | hb_any ; } @@ -2056,7 +2070,8 @@ struct ChainRuleSet TRACE_APPLY (this); return_trace ( + hb_iter (rule) - | hb_map ([&] (const OffsetTo &_) { return (this+_).apply (c, lookup_context); }) + | hb_map (hb_add (this)) + | hb_map ([&] (const ChainRule &_) { return _.apply (c, lookup_context); }) | hb_any ) ; @@ -2089,7 +2104,8 @@ struct ChainContextFormat1 + hb_zip (this+coverage, ruleSet) | hb_filter (*glyphs, hb_first) | hb_map (hb_second) - | hb_map ([&] (const OffsetTo &_) { return (this+_).intersects (glyphs, lookup_context); }) + | hb_map (hb_add (this)) + | hb_map ([&] (const ChainRuleSet &_) { return _.intersects (glyphs, lookup_context); }) | hb_any ; } @@ -2104,7 +2120,8 @@ struct ChainContextFormat1 + hb_zip (this+coverage, ruleSet) | hb_filter (*c->glyphs, hb_first) | hb_map (hb_second) - | hb_apply ([&] (const OffsetTo &_) { (this+_).closure (c, lookup_context); }) + | hb_map (hb_add (this)) + | hb_apply ([&] (const ChainRuleSet &_) { _.closure (c, lookup_context); }) ; } @@ -2118,7 +2135,8 @@ struct ChainContextFormat1 }; + hb_iter (ruleSet) - | hb_apply ([&] (const OffsetTo &_) { (this+_).collect_glyphs (c, lookup_context); }) + | hb_map (hb_add (this)) + | hb_apply ([&] (const ChainRuleSet &_) { _.collect_glyphs (c, lookup_context); }) ; } @@ -2221,7 +2239,8 @@ struct ChainContextFormat2 { return input_class_def.intersects_class (c->glyphs, _); }, hb_first) | hb_map (hb_second) - | hb_apply ([&] (const OffsetTo &_) { (this+_).closure (c, lookup_context); }) + | hb_map (hb_add (this)) + | hb_apply ([&] (const ChainRuleSet &_) { _.closure (c, lookup_context); }) ; } @@ -2241,7 +2260,8 @@ struct ChainContextFormat2 }; + hb_iter (ruleSet) - | hb_apply ([&] (const OffsetTo &_) { (this+_).collect_glyphs (c, lookup_context); }) + | hb_map (hb_add (this)) + | hb_apply ([&] (const ChainRuleSet &_) { _.collect_glyphs (c, lookup_context); }) ; } diff --git a/src/hb-ot-stat-table.hh b/src/hb-ot-stat-table.hh index 228c3ecc1..8f9ff5ab2 100644 --- a/src/hb-ot-stat-table.hh +++ b/src/hb-ot-stat-table.hh @@ -289,7 +289,7 @@ struct STAT ; + get_axis_value_offsets () - | hb_map ([this] (const OffsetTo& _) { return hb_addressof (this + _); }) + | hb_map (hb_add (this)) | hb_map (&AxisValue::get_value_name_id) | hb_sink (nameids_to_retain) ;