diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh index 5ec7e0788..f98bd133f 100644 --- a/src/hb-ot-layout-gpos-table.hh +++ b/src/hb-ot-layout-gpos-table.hh @@ -1446,7 +1446,7 @@ struct PosLookup : Lookup inline hb_collect_glyphs_context_t::return_t collect_glyphs_lookup (hb_collect_glyphs_context_t *c) const { TRACE_COLLECT_GLYPHS (this); - c->set_recurse_func (process_recurse_func); + c->set_recurse_func (NULL); return TRACE_RETURN (process (c)); } diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh index 7bf3e71ce..bdeae845c 100644 --- a/src/hb-ot-layout-gsubgpos-private.hh +++ b/src/hb-ot-layout-gsubgpos-private.hh @@ -156,6 +156,10 @@ struct hb_collect_glyphs_context_t if (unlikely (nesting_level_left == 0 || !recurse_func)) return default_return_value (); + /* 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. */ + 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);