From 4a350d0eb25db60d95638664c892d4c8dacf050b Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 4 Dec 2012 17:13:09 -0500 Subject: [PATCH] [OTLayout] Reuse context in collect_glyphs() recursion --- src/hb-ot-layout-gsubgpos-private.hh | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh index 69c1739e6..63c23d540 100644 --- a/src/hb-ot-layout-gsubgpos-private.hh +++ b/src/hb-ot-layout-gsubgpos-private.hh @@ -158,13 +158,24 @@ struct hb_collect_glyphs_context_t /* Note that GPOS sets recurse_func to NULL already, so it doesn't get * past the previous check. For GSUB, we only want to collect the output - * glyphs in the recursion. If those are not requested, we can go home now. */ + * glyphs in the recursion. If output is not requested, we can go home now. */ + + if (output == hb_set_get_empty ()) + return VOID; + + hb_set_t *old_before = before; + hb_set_t *old_input = input; + hb_set_t *old_after = after; + before = input = after = hb_set_get_empty (); nesting_level_left--; - /* Only collect output glyphs in the recursion. */ - hb_collect_glyphs_context_t new_c (this->face, NULL, NULL, NULL, output, nesting_level_left); - recurse_func (&new_c, lookup_index); + recurse_func (this, lookup_index); nesting_level_left++; + + before = old_before; + input = old_input; + after = old_after; + return VOID; }