From 0e0110e7f210e568e8afc6d63a200e2e28004ebe Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 2 Jun 2023 13:34:58 -0600 Subject: [PATCH] [glyf] Avoid a SubsetGlyph copy Unfortunately hb_second() always does a copy... --- src/OT/glyf/glyf.hh | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/OT/glyf/glyf.hh b/src/OT/glyf/glyf.hh index 809e6e9e0..0ce691838 100644 --- a/src/OT/glyf/glyf.hh +++ b/src/OT/glyf/glyf.hh @@ -54,8 +54,8 @@ struct glyf TRACE_SERIALIZE (this); unsigned init_len = c->length (); - for (const auto &_ : it) - if (unlikely (!_.serialize (c, use_short_loca, plan))) + for (auto &_ : it) + if (unlikely (!_.second.serialize (c, use_short_loca, plan))) return false; /* As a special case when all glyph in the font are empty, add a zero byte @@ -136,11 +136,7 @@ struct glyf padded_offsets.arrayZ[i] = 0; } - auto it = - + hb_iter (glyphs) - | hb_map (hb_second) - ; - bool result = glyf_prime->serialize (c->serializer, it, use_short_loca, c->plan); + bool result = glyf_prime->serialize (c->serializer, glyphs, use_short_loca, c->plan); if (c->plan->normalized_coords && !c->plan->pinned_at_default) _free_compiled_subset_glyphs (glyphs);