From 420d8ac350590d776832dc7b353d997857cd7b45 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 9 Jan 2019 20:58:25 -0800 Subject: [PATCH] [algs] Add hb_iter() Makes it nicer in pipelines. --- src/hb-algs.hh | 4 ++++ src/hb-ot-layout-gsub-table.hh | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/hb-algs.hh b/src/hb-algs.hh index 86d7fec93..90f4c87eb 100644 --- a/src/hb-algs.hh +++ b/src/hb-algs.hh @@ -31,6 +31,10 @@ #include "hb-null.hh" +template +inline typename T::iter_t +hb_iter (const T& c) { return c.iter (); } + static HB_UNUSED struct hb_identity_t { template T diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index 205d729ee..bb26bafd6 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh @@ -46,7 +46,7 @@ struct SingleSubstFormat1 void closure (hb_closure_context_t *c) const { - for (auto it = (this+coverage).iter () + for (auto it = hb_iter (this+coverage) | hb_filter (*c->glyphs); it; ++it) c->output->add ((*it + deltaGlyphID) & 0xFFFFu); } @@ -54,7 +54,7 @@ struct SingleSubstFormat1 void collect_glyphs (hb_collect_glyphs_context_t *c) const { if (unlikely (!(this+coverage).add_coverage (c->input))) return; - for (auto it = (this+coverage).iter (); it; ++it) + for (auto it = hb_iter (this+coverage); it; ++it) c->output->add ((*it + deltaGlyphID) & 0xFFFFu); } @@ -100,7 +100,7 @@ struct SingleSubstFormat1 hb_sorted_vector_t from; hb_vector_t to; hb_codepoint_t delta = deltaGlyphID; - for (auto it = (this+coverage).iter () + for (auto it = hb_iter (this+coverage) | hb_filter (glyphset); it; ++it) { from.push ()->set (glyph_map[*it]);