Minor, turn more of hb_apply to for each

This commit is contained in:
Ebrahim Byagowi 2019-09-21 16:25:54 +04:30
parent 0665dce116
commit 6e42a418c8
4 changed files with 20 additions and 37 deletions

View File

@ -144,9 +144,8 @@ struct glyf
{
TRACE_SERIALIZE (this);
+ it
| hb_apply ([=] (const SubsetGlyph& _) { _.serialize (c, plan); })
;
for (const SubsetGlyph& _ : it)
_.serialize (c, plan);
return_trace (true);
}

View File

@ -512,9 +512,8 @@ struct SinglePosFormat1
auto vals = hb_second (*it);
+ vals
| hb_apply ([=] (const Value& _) { c->copy (_); })
;
for (const Value& _ : vals)
c->copy (_);
auto glyphs =
+ it
@ -601,15 +600,10 @@ struct SinglePosFormat2
if (unlikely (!c->check_assign (valueFormat, valFormat))) return;
if (unlikely (!c->check_assign (valueCount, it.len ()))) return;
+ it
| hb_map (hb_second)
| hb_apply ([=] (hb_array_t<const Value> val_iter)
{
+ val_iter
| hb_apply ([=] (const Value& _) { c->copy (_); })
;
})
;
for (hb_array_t<const Value> val_iter : + it
| hb_map (hb_second))
for (const Value& _ : val_iter)
c->copy (_);
auto glyphs =
+ it
@ -675,22 +669,14 @@ struct SinglePos
unsigned subset_format = 1;
hb_array_t<const Value> first_val_iter = hb_second (*glyph_val_iter_pairs);
+ glyph_val_iter_pairs
| hb_map (hb_second)
| hb_apply ([&] (hb_array_t<const Value> val_iter)
{
+ hb_zip (val_iter, first_val_iter)
| hb_apply ([&] (const hb_pair_t<Value, Value>& _)
{
for (hb_array_t<const Value> val_iter : + glyph_val_iter_pairs
| hb_map (hb_second))
for (const hb_pair_t<Value, Value>& _ : hb_zip (val_iter, first_val_iter))
if (_.first != _.second)
{
subset_format = 2;
return;
continue;
}
})
;
})
;
return subset_format;
}

View File

@ -191,9 +191,8 @@ struct name
const void *dst_string_pool = &(this + this->stringOffset);
+ it
| hb_apply ([=] (const NameRecord& _) { c->copy (_, src_string_pool, dst_string_pool); })
;
for (const NameRecord& _ : it)
c->copy (_, src_string_pool, dst_string_pool);
if (unlikely (c->ran_out_of_room)) return_trace (false);

View File

@ -84,9 +84,8 @@ struct VORG
this->defaultVertOriginY = defaultVertOriginY;
this->vertYOrigins.len = it.len ();
+ it
| hb_apply ([c] (const VertOriginMetric& _) { c->copy (_); })
;
for (const VertOriginMetric& _ : it)
c->copy (_);
}
bool subset (hb_subset_context_t *c) const