From e17e7443007fc0debc4a26e5cf37d5d76c747fbf Mon Sep 17 00:00:00 2001 From: Garret Rieger Date: Wed, 9 Oct 2019 11:45:42 -0700 Subject: [PATCH] Convert existing uses of serialize_append in gsub subsetting to use subset_offset_array. --- src/hb-ot-layout-gsub-table.hh | 44 +++------------------------------- 1 file changed, 3 insertions(+), 41 deletions(-) diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index f080d682a..fc21cb056 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh @@ -452,20 +452,7 @@ struct MultipleSubstFormat1 hb_sorted_vector_t new_coverage; + hb_zip (this+coverage, sequence) | hb_filter (glyphset, hb_first) - | hb_filter ([this, c, out] (const OffsetTo& _) - { - auto *o = out->sequence.serialize_append (c->serializer); - if (unlikely (!o)) return false; - auto snap = c->serializer->snapshot (); - bool ret = o->serialize_subset (c, _, this, out); - if (!ret) - { - out->sequence.pop (); - c->serializer->revert (snap); - } - return ret; - }, - hb_second) + | hb_filter (subset_offset_array (c, out->sequence, this, out), hb_second) | hb_map (hb_first) | hb_map (glyph_map) | hb_sink (new_coverage) @@ -675,20 +662,7 @@ struct AlternateSubstFormat1 hb_sorted_vector_t new_coverage; + hb_zip (this+coverage, alternateSet) | hb_filter (glyphset, hb_first) - | hb_filter ([this, c, out] (const OffsetTo& _) - { - auto *o = out->alternateSet.serialize_append (c->serializer); - if (unlikely (!o)) return false; - auto snap = c->serializer->snapshot (); - bool ret = o->serialize_subset (c, _, this, out); - if (!ret) - { - out->alternateSet.pop (); - c->serializer->revert (snap); - } - return ret; - }, - hb_second) + | hb_filter (subset_offset_array (c, out->alternateSet, this, out), hb_second) | hb_map (hb_first) | hb_map (glyph_map) | hb_sink (new_coverage) @@ -948,19 +922,7 @@ struct LigatureSet if (unlikely (!c->serializer->extend_min (out))) return_trace (false); + hb_iter (ligature) - | hb_filter ([this, c, out] (const OffsetTo& _) - { - auto *o = out->ligature.serialize_append (c->serializer); - if (unlikely (!o)) return false; - auto snap = c->serializer->snapshot (); - bool ret = o->serialize_subset (c, _, this, out); - if (!ret) - { - out->ligature.pop (); - c->serializer->revert (snap); - } - return ret; - }) + | hb_filter (subset_offset_array (c, out->ligature, this, out)) | hb_drain ; return_trace (bool (out->ligature));