Refactor to keep hb-object-private.h and hb-open-type.h separate

Needed to be able to include <Windows.h> from hb-object-private.h.
diff --git a/src/hb-font.cc b/src/hb-font.cc
index 1242375..0a58377 100644
--- a/src/hb-font.cc
+++ b/src/hb-font.cc
@@ -26,12 +26,12 @@
 
 #include "hb-private.hh"
 
+#include "hb-ot-layout-private.hh"
+
 #include "hb-font-private.hh"
 #include "hb-blob-private.hh"
 #include "hb-open-file-private.hh"
 
-#include "hb-ot-layout-private.hh"
-
 #include <string.h>
 
 HB_BEGIN_DECLS
@@ -293,9 +293,6 @@
   NULL, /* user_data */
   NULL, /* destroy */
 
-  NULL, /* head_blob */
-  NULL, /* head_table */
-
   NULL  /* ot_layout */
 };
 
@@ -317,10 +314,7 @@
   face->user_data = user_data;
   face->destroy = destroy;
 
-  face->ot_layout = _hb_ot_layout_new (face);
-
-  face->head_blob = Sanitizer<head>::sanitize (hb_face_reference_table (face, HB_OT_TAG_head));
-  face->head_table = Sanitizer<head>::lock_instance (face->head_blob);
+  face->ot_layout = _hb_ot_layout_create (face);
 
   return face;
 }
@@ -399,10 +393,7 @@
 {
   if (!hb_object_destroy (face)) return;
 
-  _hb_ot_layout_free (face->ot_layout);
-
-  hb_blob_unlock (face->head_blob);
-  hb_blob_destroy (face->head_blob);
+  _hb_ot_layout_destroy (face->ot_layout);
 
   if (face->destroy)
     face->destroy (face->user_data);
@@ -446,7 +437,7 @@
 unsigned int
 hb_face_get_upem (hb_face_t *face)
 {
-  return (face->head_table ? face->head_table : &Null(head))->get_upem ();
+  return _hb_ot_layout_get_upem (face);
 }
 
 
diff --git a/src/hb-ot-layout-private.hh b/src/hb-ot-layout-private.hh
index 7b72515..5870248 100644
--- a/src/hb-ot-layout-private.hh
+++ b/src/hb-ot-layout-private.hh
@@ -30,7 +30,6 @@
 #include "hb-private.hh"
 
 #include "hb-ot-layout.h"
-#include "hb-ot-head-private.hh"
 
 #include "hb-font-private.hh"
 #include "hb-buffer-private.hh"
@@ -38,10 +37,13 @@
 HB_BEGIN_DECLS
 
 
+/*
+ * GDEF
+ */
+
 /* buffer var allocations */
 #define props_cache() var1.u16[1] /* glyph_props cache */
 
-
 /* XXX cleanup */
 typedef enum {
   HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED	= 0x0001,
@@ -52,46 +54,6 @@
 } hb_ot_layout_glyph_class_t;
 
 
-/*
- * hb_ot_layout_t
- */
-
-struct hb_ot_layout_t
-{
-  hb_blob_t *gdef_blob;
-  hb_blob_t *gsub_blob;
-  hb_blob_t *gpos_blob;
-
-  const struct GDEF *gdef;
-  const struct GSUB *gsub;
-  const struct GPOS *gpos;
-};
-
-struct hb_ot_layout_context_t
-{
-  hb_face_t *face;
-  hb_font_t *font;
-
-  /* Convert from font-space to user-space */
-  inline hb_position_t scale_x (int16_t v) { return scale (v, this->font->x_scale); }
-  inline hb_position_t scale_y (int16_t v) { return scale (v, this->font->y_scale); }
-
-  private:
-  inline hb_position_t scale (int16_t v, int scale) { return v * (int64_t) scale / this->face->head_table->get_upem (); }
-};
-
-
-HB_INTERNAL hb_ot_layout_t *
-_hb_ot_layout_new (hb_face_t *face);
-
-HB_INTERNAL void
-_hb_ot_layout_free (hb_ot_layout_t *layout);
-
-
-/*
- * GDEF
- */
-
 HB_INTERNAL unsigned int
 _hb_ot_layout_get_glyph_property (hb_face_t       *face,
 				  hb_glyph_info_t *info);
@@ -109,6 +71,52 @@
 			 unsigned int *property_out);
 
 
+/*
+ * head
+ */
+
+HB_INTERNAL unsigned int
+_hb_ot_layout_get_upem (hb_face_t    *face);
+
+
+/*
+ * hb_ot_layout_t
+ */
+
+struct hb_ot_layout_t
+{
+  hb_blob_t *gdef_blob;
+  hb_blob_t *gsub_blob;
+  hb_blob_t *gpos_blob;
+  hb_blob_t *head_blob;
+
+  const struct GDEF *gdef;
+  const struct GSUB *gsub;
+  const struct GPOS *gpos;
+  const struct head *head;
+};
+
+struct hb_ot_layout_context_t
+{
+  hb_face_t *face;
+  hb_font_t *font;
+
+  /* Convert from font-space to user-space */
+  inline hb_position_t scale_x (int16_t v) { return scale (v, this->font->x_scale); }
+  inline hb_position_t scale_y (int16_t v) { return scale (v, this->font->y_scale); }
+
+  private:
+  inline hb_position_t scale (int16_t v, int scale) { return v * (int64_t) scale / _hb_ot_layout_get_upem (this->face); }
+};
+
+
+HB_INTERNAL hb_ot_layout_t *
+_hb_ot_layout_create (hb_face_t *face);
+
+HB_INTERNAL void
+_hb_ot_layout_destroy (hb_ot_layout_t *layout);
+
+
 HB_END_DECLS
 
 #endif /* HB_OT_LAYOUT_PRIVATE_HH */
diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc
index 03a9455..7383e9f 100644
--- a/src/hb-ot-layout.cc
+++ b/src/hb-ot-layout.cc
@@ -33,6 +33,7 @@
 #include "hb-ot-layout-gdef-private.hh"
 #include "hb-ot-layout-gsub-private.hh"
 #include "hb-ot-layout-gpos-private.hh"
+#include "hb-ot-head-private.hh"
 
 
 #include <stdlib.h>
@@ -42,7 +43,7 @@
 
 
 hb_ot_layout_t *
-_hb_ot_layout_new (hb_face_t *face)
+_hb_ot_layout_create (hb_face_t *face)
 {
   /* Remove this object altogether */
   hb_ot_layout_t *layout = (hb_ot_layout_t *) calloc (1, sizeof (hb_ot_layout_t));
@@ -56,19 +57,24 @@
   layout->gpos_blob = Sanitizer<GPOS>::sanitize (hb_face_reference_table (face, HB_OT_TAG_GPOS));
   layout->gpos = Sanitizer<GPOS>::lock_instance (layout->gpos_blob);
 
+  layout->head_blob = Sanitizer<head>::sanitize (hb_face_reference_table (face, HB_OT_TAG_head));
+  layout->head = Sanitizer<head>::lock_instance (layout->head_blob);
+
   return layout;
 }
 
 void
-_hb_ot_layout_free (hb_ot_layout_t *layout)
+_hb_ot_layout_destroy (hb_ot_layout_t *layout)
 {
   hb_blob_unlock (layout->gdef_blob);
   hb_blob_unlock (layout->gsub_blob);
   hb_blob_unlock (layout->gpos_blob);
+  hb_blob_unlock (layout->head_blob);
 
   hb_blob_destroy (layout->gdef_blob);
   hb_blob_destroy (layout->gsub_blob);
   hb_blob_destroy (layout->gpos_blob);
+  hb_blob_destroy (layout->head_blob);
 
   free (layout);
 }
@@ -78,18 +84,21 @@
 {
   return likely (face->ot_layout && face->ot_layout->gdef) ? *face->ot_layout->gdef : Null(GDEF);
 }
-
 static inline const GSUB&
 _get_gsub (hb_face_t *face)
 {
   return likely (face->ot_layout && face->ot_layout->gsub) ? *face->ot_layout->gsub : Null(GSUB);
 }
-
 static inline const GPOS&
 _get_gpos (hb_face_t *face)
 {
   return likely (face->ot_layout && face->ot_layout->gpos) ? *face->ot_layout->gpos : Null(GPOS);
 }
+static inline const head&
+_get_head (hb_face_t *face)
+{
+  return likely (face->ot_layout && face->ot_layout->head) ? *face->ot_layout->head : Null(head);
+}
 
 
 /*
@@ -486,4 +495,15 @@
 }
 
 
+/*
+ * head
+ */
+
+unsigned int
+_hb_ot_layout_get_upem (hb_face_t *face)
+{
+  return _get_head (face).get_upem ();
+}
+
+
 HB_END_DECLS