Use hb_map(hb_add(this)) to dereference OffsetTo<>'s

This commit is contained in:
Behdad Esfahbod 2019-05-15 21:57:26 -07:00
parent 6f51e55524
commit 2376867649
3 changed files with 61 additions and 31 deletions

View File

@ -367,7 +367,8 @@ struct MultipleSubstFormat1
+ hb_zip (this+coverage, sequence) + hb_zip (this+coverage, sequence)
| hb_filter (*c->glyphs, hb_first) | hb_filter (*c->glyphs, hb_first)
| hb_map (hb_second) | hb_map (hb_second)
| hb_apply ([c, this] (const OffsetTo<Sequence> &_) { (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; if (unlikely (!(this+coverage).add_coverage (c->input))) return;
+ hb_zip (this+coverage, sequence) + hb_zip (this+coverage, sequence)
| hb_map (hb_second) | hb_map (hb_second)
| hb_apply ([c, this] (const OffsetTo<Sequence> &_) { (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_zip (this+coverage, alternateSet)
| hb_map (hb_second) | hb_map (hb_second)
| hb_apply ([c, this] (const OffsetTo<AlternateSet> &_) { (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; if (unlikely (!(this+coverage).add_coverage (c->input))) return;
+ hb_zip (this+coverage, alternateSet) + hb_zip (this+coverage, alternateSet)
| hb_map (hb_second) | hb_map (hb_second)
| hb_apply ([c, this] (const OffsetTo<AlternateSet> &_) { (this+_).collect_glyphs (c); }) | hb_map (hb_add (this))
| hb_apply ([c] (const AlternateSet &_) { _.collect_glyphs (c); })
; ;
} }
@ -757,7 +761,8 @@ struct LigatureSet
{ {
return return
+ hb_iter (ligature) + hb_iter (ligature)
| hb_map ([this, glyphs] (const OffsetTo<Ligature> &_) { return (this+_).intersects (glyphs); }) | hb_map (hb_add (this))
| hb_map ([glyphs] (const Ligature &_) { return _.intersects (glyphs); })
| hb_any | hb_any
; ;
} }
@ -765,14 +770,16 @@ struct LigatureSet
void closure (hb_closure_context_t *c) const void closure (hb_closure_context_t *c) const
{ {
+ hb_iter (ligature) + hb_iter (ligature)
| hb_apply ([this, c] (const OffsetTo<Ligature> &_) { (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 void collect_glyphs (hb_collect_glyphs_context_t *c) const
{ {
+ hb_iter (ligature) + hb_iter (ligature)
| hb_apply ([this, c] (const OffsetTo<Ligature> &_) { (this+_).collect_glyphs (c); }) | hb_map (hb_add (this))
| hb_apply ([c] (const Ligature &_) { _.collect_glyphs (c); })
; ;
} }
@ -780,7 +787,8 @@ struct LigatureSet
{ {
return return
+ hb_iter (ligature) + hb_iter (ligature)
| hb_map ([this, c] (const OffsetTo<Ligature> &_) { return (this+_).would_apply (c); }) | hb_map (hb_add (this))
| hb_map ([c] (const Ligature &_) { return _.would_apply (c); })
| hb_any | hb_any
; ;
} }
@ -852,7 +860,8 @@ struct LigatureSubstFormat1
+ hb_zip (this+coverage, ligatureSet) + hb_zip (this+coverage, ligatureSet)
| hb_filter (*c->glyphs, hb_first) | hb_filter (*c->glyphs, hb_first)
| hb_map (hb_second) | hb_map (hb_second)
| hb_apply ([this, c] (const OffsetTo<LigatureSet> &_) { (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_zip (this+coverage, ligatureSet)
| hb_map (hb_second) | hb_map (hb_second)
| hb_apply ([this, c] (const OffsetTo<LigatureSet> &_) { (this+_).collect_glyphs (c); }) | hb_map (hb_add (this))
| hb_apply ([c] (const LigatureSet &_) { _.collect_glyphs (c); })
; ;
} }

View File

@ -1371,7 +1371,8 @@ struct RuleSet
{ {
return return
+ hb_iter (rule) + hb_iter (rule)
| hb_map ([&] (const OffsetTo<Rule> &_) { return (this+_).intersects (glyphs, lookup_context); }) | hb_map (hb_add (this))
| hb_map ([&] (const Rule &_) { return _.intersects (glyphs, lookup_context); })
| hb_any | hb_any
; ;
} }
@ -1381,7 +1382,8 @@ struct RuleSet
{ {
return return
+ hb_iter (rule) + hb_iter (rule)
| hb_apply ([&] (const OffsetTo<Rule> &_) { (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 return
+ hb_iter (rule) + hb_iter (rule)
| hb_apply ([&] (const OffsetTo<Rule> &_) { (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 return
+ hb_iter (rule) + hb_iter (rule)
| hb_map ([&] (const OffsetTo<Rule> &_) { return (this+_).would_apply (c, lookup_context); }) | hb_map (hb_add (this))
| hb_map ([&] (const Rule &_) { return _.would_apply (c, lookup_context); })
| hb_any | hb_any
; ;
} }
@ -1410,7 +1414,8 @@ struct RuleSet
TRACE_APPLY (this); TRACE_APPLY (this);
return_trace ( return_trace (
+ hb_iter (rule) + hb_iter (rule)
| hb_map ([&] (const OffsetTo<Rule> &_) { return (this+_).apply (c, lookup_context); }) | hb_map (hb_add (this))
| hb_map ([&] (const Rule &_) { return _.apply (c, lookup_context); })
| hb_any | hb_any
) )
; ;
@ -1444,7 +1449,8 @@ struct ContextFormat1
+ hb_zip (this+coverage, ruleSet) + hb_zip (this+coverage, ruleSet)
| hb_filter (*glyphs, hb_first) | hb_filter (*glyphs, hb_first)
| hb_map (hb_second) | hb_map (hb_second)
| hb_map ([&] (const OffsetTo<RuleSet> &_) { return (this+_).intersects (glyphs, lookup_context); }) | hb_map (hb_add (this))
| hb_map ([&] (const RuleSet &_) { return _.intersects (glyphs, lookup_context); })
| hb_any | hb_any
; ;
} }
@ -1459,7 +1465,8 @@ struct ContextFormat1
+ hb_zip (this+coverage, ruleSet) + hb_zip (this+coverage, ruleSet)
| hb_filter (*c->glyphs, hb_first) | hb_filter (*c->glyphs, hb_first)
| hb_map (hb_second) | hb_map (hb_second)
| hb_apply ([&] (const OffsetTo<RuleSet> &_) { (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_iter (ruleSet)
| hb_apply ([&] (const OffsetTo<RuleSet> &_) { (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, _); }, { return class_def.intersects_class (c->glyphs, _); },
hb_first) hb_first)
| hb_map (hb_second) | hb_map (hb_second)
| hb_apply ([&] (const OffsetTo<RuleSet> &_) { (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_iter (ruleSet)
| hb_apply ([&] (const OffsetTo<RuleSet> &_) { (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 return
+ hb_iter (rule) + hb_iter (rule)
| hb_map ([&] (const OffsetTo<ChainRule> &_) { return (this+_).intersects (glyphs, lookup_context); }) | hb_map (hb_add (this))
| hb_map ([&] (const ChainRule &_) { return _.intersects (glyphs, lookup_context); })
| hb_any | hb_any
; ;
} }
@ -2030,7 +2041,8 @@ struct ChainRuleSet
{ {
return return
+ hb_iter (rule) + hb_iter (rule)
| hb_apply ([&] (const OffsetTo<ChainRule> &_) { (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 return
+ hb_iter (rule) + hb_iter (rule)
| hb_apply ([&] (const OffsetTo<ChainRule> &_) { (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 return
+ hb_iter (rule) + hb_iter (rule)
| hb_map ([&] (const OffsetTo<ChainRule> &_) { return (this+_).would_apply (c, lookup_context); }) | hb_map (hb_add (this))
| hb_map ([&] (const ChainRule &_) { return _.would_apply (c, lookup_context); })
| hb_any | hb_any
; ;
} }
@ -2056,7 +2070,8 @@ struct ChainRuleSet
TRACE_APPLY (this); TRACE_APPLY (this);
return_trace ( return_trace (
+ hb_iter (rule) + hb_iter (rule)
| hb_map ([&] (const OffsetTo<ChainRule> &_) { return (this+_).apply (c, lookup_context); }) | hb_map (hb_add (this))
| hb_map ([&] (const ChainRule &_) { return _.apply (c, lookup_context); })
| hb_any | hb_any
) )
; ;
@ -2089,7 +2104,8 @@ struct ChainContextFormat1
+ hb_zip (this+coverage, ruleSet) + hb_zip (this+coverage, ruleSet)
| hb_filter (*glyphs, hb_first) | hb_filter (*glyphs, hb_first)
| hb_map (hb_second) | hb_map (hb_second)
| hb_map ([&] (const OffsetTo<ChainRuleSet> &_) { return (this+_).intersects (glyphs, lookup_context); }) | hb_map (hb_add (this))
| hb_map ([&] (const ChainRuleSet &_) { return _.intersects (glyphs, lookup_context); })
| hb_any | hb_any
; ;
} }
@ -2104,7 +2120,8 @@ struct ChainContextFormat1
+ hb_zip (this+coverage, ruleSet) + hb_zip (this+coverage, ruleSet)
| hb_filter (*c->glyphs, hb_first) | hb_filter (*c->glyphs, hb_first)
| hb_map (hb_second) | hb_map (hb_second)
| hb_apply ([&] (const OffsetTo<ChainRuleSet> &_) { (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_iter (ruleSet)
| hb_apply ([&] (const OffsetTo<ChainRuleSet> &_) { (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, _); }, { return input_class_def.intersects_class (c->glyphs, _); },
hb_first) hb_first)
| hb_map (hb_second) | hb_map (hb_second)
| hb_apply ([&] (const OffsetTo<ChainRuleSet> &_) { (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_iter (ruleSet)
| hb_apply ([&] (const OffsetTo<ChainRuleSet> &_) { (this+_).collect_glyphs (c, lookup_context); }) | hb_map (hb_add (this))
| hb_apply ([&] (const ChainRuleSet &_) { _.collect_glyphs (c, lookup_context); })
; ;
} }

View File

@ -289,7 +289,7 @@ struct STAT
; ;
+ get_axis_value_offsets () + get_axis_value_offsets ()
| hb_map ([this] (const OffsetTo<AxisValue>& _) { return hb_addressof (this + _); }) | hb_map (hb_add (this))
| hb_map (&AxisValue::get_value_name_id) | hb_map (&AxisValue::get_value_name_id)
| hb_sink (nameids_to_retain) | hb_sink (nameids_to_retain)
; ;