[glyf] Move GlyphHeader::from_bytes to hb_bytes_t, introduce .as<T> ()
diff --git a/src/hb-array.hh b/src/hb-array.hh
index 4c0f73e..2e7a4fa 100644
--- a/src/hb-array.hh
+++ b/src/hb-array.hh
@@ -181,6 +181,12 @@
   hb_array_t<Type> sub_array (unsigned int start_offset, unsigned int seg_count) const
   { return sub_array (start_offset, &seg_count); }
 
+  template <typename T,
+	    unsigned P = sizeof (Type),
+	    hb_enable_if (P == 1)>
+  const T *as () const
+  { return length < hb_null_size (T) ? &Null (T) : reinterpret_cast<const T *> (arrayZ); }
+
   /* Only call if you allocated the underlying array using malloc() or similar. */
   void free ()
   { ::free ((void *) arrayZ); arrayZ = nullptr; length = 0; }