[OTLayout] Clean up closure() a bit
diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh
index 201ca27..0679dc1 100644
--- a/src/hb-ot-layout-gsub-table.hh
+++ b/src/hb-ot-layout-gsub-table.hh
@@ -1141,6 +1141,13 @@
     return TRACE_RETURN (c->default_return_value ());
   }
 
+  static inline void_t closure_recurse_func (hb_closure_context_t *c, unsigned int lookup_index);
+  inline hb_closure_context_t::return_t closure (hb_closure_context_t *c) const
+  {
+    c->set_recurse_func (closure_recurse_func);
+    return process (c);
+  }
+
   template <typename set_t>
   inline void add_coverage (set_t *glyphs) const
   {
@@ -1173,7 +1180,6 @@
   }
 
   static bool apply_recurse_func (hb_apply_context_t *c, unsigned int lookup_index);
-
   inline bool apply_string (hb_apply_context_t *c, const hb_set_digest_t *digest) const
   {
     bool ret = false;
@@ -1323,20 +1329,6 @@
   static inline void substitute_start (hb_font_t *font, hb_buffer_t *buffer);
   static inline void substitute_finish (hb_font_t *font, hb_buffer_t *buffer);
 
-  static inline void_t closure_recurse_func (hb_closure_context_t *c, unsigned int lookup_index)
-  {
-    const GSUB &gsub = *(hb_ot_layout_from_face (c->face)->gsub);
-    const SubstLookup &l = gsub.get_lookup (lookup_index);
-    return l.process (c);
-  }
-  inline hb_closure_context_t::return_t closure_lookup (hb_face_t *face,
-							hb_set_t *glyphs,
-							unsigned int lookup_index) const
-  {
-    hb_closure_context_t c (face, glyphs, closure_recurse_func);
-    return get_lookup (lookup_index).process (&c);
-  }
-
 #if 0
   inline hb_collect_glyphs_context_t::return_t collect_glyphs_lookup (hb_collect_glyphs_context_t *c,
 								      unsigned int lookup_index) const
@@ -1385,6 +1377,13 @@
   return SubstLookup::lookup_type_is_reverse (type);
 }
 
+inline void_t SubstLookup::closure_recurse_func (hb_closure_context_t *c, unsigned int lookup_index)
+{
+  const GSUB &gsub = *(hb_ot_layout_from_face (c->face)->gsub);
+  const SubstLookup &l = gsub.get_lookup (lookup_index);
+  return l.process (c);
+}
+
 inline bool SubstLookup::apply_recurse_func (hb_apply_context_t *c, unsigned int lookup_index)
 {
   const GSUB &gsub = *(hb_ot_layout_from_face (c->face)->gsub);
diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh
index f47f80b..93b14e9 100644
--- a/src/hb-ot-layout-gsubgpos-private.hh
+++ b/src/hb-ot-layout-gsubgpos-private.hh
@@ -65,7 +65,7 @@
   bool stop_sublookup_iteration (const return_t r) const { return false; }
   return_t recurse (unsigned int lookup_index)
   {
-    if (unlikely (nesting_level_left == 0))
+    if (unlikely (nesting_level_left == 0 || !recurse_func))
       return default_return_value ();
 
     nesting_level_left--;
@@ -82,13 +82,14 @@
 
   hb_closure_context_t (hb_face_t *face_,
 			hb_set_t *glyphs_,
-			recurse_func_t recurse_func_,
 		        unsigned int nesting_level_left_ = MAX_NESTING_LEVEL) :
 			  face (face_),
 			  glyphs (glyphs_),
-			  recurse_func (recurse_func_),
+			  recurse_func (NULL),
 			  nesting_level_left (nesting_level_left_),
 			  debug_depth (0) {}
+
+  void set_recurse_func (recurse_func_t func) { recurse_func = func; }
 };
 
 
diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc
index 7af75c0..d345ba6 100644
--- a/src/hb-ot-layout.cc
+++ b/src/hb-ot-layout.cc
@@ -498,7 +498,11 @@
 				        unsigned int  lookup_index,
 				        hb_set_t     *glyphs)
 {
-  _get_gsub (face).closure_lookup (face, glyphs, lookup_index);
+  OT::hb_closure_context_t c (face, glyphs);
+
+  const OT::SubstLookup& l = _get_gsub (face).get_lookup (lookup_index);
+
+  l.closure (&c);
 }
 
 /*