[lazy] Make hb_lazy_loader_t<> more usable
diff --git a/src/hb-ft.cc b/src/hb-ft.cc
index eea2da1..e716ec9 100644
--- a/src/hb-ft.cc
+++ b/src/hb-ft.cc
@@ -685,9 +685,8 @@
 
 static void free_static_ft_library (void);
 
-static struct hb_ft_library_lazy_loader_t : hb_lazy_loader_t<hb_ft_library_lazy_loader_t,
-							     void, 0,
-							     hb_remove_ptr_t<FT_Library>::value>
+static struct hb_ft_library_lazy_loader_t : hb_lazy_loader_t<hb_remove_ptr_t<FT_Library>::value,
+							     hb_ft_library_lazy_loader_t>
 {
   static inline FT_Library create (void)
   {
@@ -705,7 +704,7 @@
   {
     FT_Done_FreeType (l);
   }
-  static inline const FT_Library get_null (void)
+  static inline FT_Library get_null (void)
   {
     return nullptr;
   }
diff --git a/src/hb-machinery-private.hh b/src/hb-machinery-private.hh
index d40f9d9..e60e3be 100644
--- a/src/hb-machinery-private.hh
+++ b/src/hb-machinery-private.hh
@@ -610,20 +610,27 @@
 template <>
 struct hb_data_wrapper_t<void, 0>
 {
-  template <typename Stored, typename Subclass>
+  template <typename Stored, typename Funcs>
   inline Stored * call_create (void) const
   {
-    return Subclass::create ();
+    return Funcs::create ();
   }
 };
 
-template <typename Subclass,
-	  typename Data,
-	  unsigned int WheresData,
-	  typename Returned,
+template <typename T1, typename T2> struct hb_non_void_t { typedef T1 value; };
+template <typename T2> struct hb_non_void_t<void, T2> { typedef T2 value; };
+
+template <typename Returned,
+	  typename Subclass = void,
+	  typename Data = void,
+	  unsigned int WheresData = 0,
 	  typename Stored = Returned>
 struct hb_lazy_loader_t : hb_data_wrapper_t<Data, WheresData>
 {
+  typedef typename hb_non_void_t<Subclass,
+				 hb_lazy_loader_t<Returned,Subclass,Data,WheresData,Stored>
+				>::value Funcs;
+
   inline void init0 (void) {} /* Init, when memory is already set to 0. No-op for us. */
   inline void init (void) { instance.set_relaxed (nullptr); }
   inline void fini (void)
@@ -641,15 +648,15 @@
 
   inline Stored * do_create (void) const
   {
-    Stored *p = this->template call_create<Stored, Subclass> ();
+    Stored *p = this->template call_create<Stored, Funcs> ();
     if (unlikely (!p))
-      p = const_cast<Stored *> (Subclass::get_null ());
+      p = const_cast<Stored *> (Funcs::get_null ());
     return p;
   }
   static inline void do_destroy (Stored *p)
   {
-    if (p && p != Subclass::get_null ())
-      Subclass::destroy (p);
+    if (p && p != Funcs::get_null ())
+      Funcs::destroy (p);
   }
 
   inline const Returned * operator -> (void) const { return get (); }
@@ -687,8 +694,8 @@
     do_destroy (p);
   }
 
-  inline const Returned * get (void) const { return Subclass::convert (get_stored ()); }
-  inline Returned * get_unconst (void) const { return const_cast<Returned *> (Subclass::convert (get_stored ())); }
+  inline const Returned * get (void) const { return Funcs::convert (get_stored ()); }
+  inline Returned * get_unconst (void) const { return const_cast<Returned *> (Funcs::convert (get_stored ())); }
 
   /* To be possibly overloaded by subclasses. */
   static inline const Returned* convert (const Stored *p) { return p; }
@@ -703,6 +710,13 @@
       p->init (data);
     return p;
   }
+  static inline Stored *create (void)
+  {
+    Stored *p = (Stored *) calloc (1, sizeof (Stored));
+    if (likely (p))
+      p->init ();
+    return p;
+  }
   static inline void destroy (Stored *p)
   {
     p->fini ();
@@ -717,14 +731,15 @@
 /* Specializations. */
 
 template <unsigned int WheresFace, typename T>
-struct hb_face_lazy_loader_t : hb_lazy_loader_t<hb_face_lazy_loader_t<WheresFace, T>,
-						  hb_face_t, WheresFace,
-						  T> {};
+struct hb_face_lazy_loader_t : hb_lazy_loader_t<T,
+						hb_face_lazy_loader_t<WheresFace, T>,
+						hb_face_t, WheresFace> {};
 
 template <typename T, unsigned int WheresFace>
-struct hb_table_lazy_loader_t : hb_lazy_loader_t<hb_table_lazy_loader_t<T, WheresFace>,
+struct hb_table_lazy_loader_t : hb_lazy_loader_t<T,
+						 hb_table_lazy_loader_t<T, WheresFace>,
 						 hb_face_t, WheresFace,
-						 T, hb_blob_t>
+						 hb_blob_t>
 {
   static inline hb_blob_t *create (hb_face_t *face)
   {
@@ -750,9 +765,7 @@
 };
 
 template <typename Subclass>
-struct hb_font_funcs_lazy_loader_t : hb_lazy_loader_t<Subclass,
-						      void, 0,
-						      hb_font_funcs_t>
+struct hb_font_funcs_lazy_loader_t : hb_lazy_loader_t<hb_font_funcs_t, Subclass>
 {
   static inline void destroy (hb_font_funcs_t *p)
   {
@@ -764,9 +777,7 @@
   }
 };
 template <typename Subclass>
-struct hb_unicode_funcs_lazy_loader_t : hb_lazy_loader_t<Subclass,
-							 void, 0,
-							 hb_unicode_funcs_t>
+struct hb_unicode_funcs_lazy_loader_t : hb_lazy_loader_t<hb_unicode_funcs_t, Subclass>
 {
   static inline void destroy (hb_unicode_funcs_t *p)
   {