Divide get_metrics into get_advance and get_extents

Graphite module not updated.
Bump version to 0.3.
diff --git a/src/hb-font-private.h b/src/hb-font-private.h
index f91da83..b147bce 100644
--- a/src/hb-font-private.h
+++ b/src/hb-font-private.h
@@ -45,8 +45,9 @@
 
   struct {
     hb_font_get_glyph_func_t		get_glyph;
+    hb_font_get_glyph_advance_func_t	get_glyph_advance;
+    hb_font_get_glyph_extents_func_t	get_glyph_extents;
     hb_font_get_contour_point_func_t	get_contour_point;
-    hb_font_get_glyph_metrics_func_t	get_glyph_metrics;
     hb_font_get_kerning_func_t		get_kerning;
   } v;
 };
diff --git a/src/hb-font.cc b/src/hb-font.cc
index bd55681..63631a9 100644
--- a/src/hb-font.cc
+++ b/src/hb-font.cc
@@ -49,6 +49,23 @@
 		       hb_codepoint_t variation_selector HB_UNUSED)
 { return 0; }
 
+static void
+hb_font_get_glyph_advance_nil (hb_font_t *font HB_UNUSED,
+			       hb_face_t *face HB_UNUSED,
+			       const void *user_data HB_UNUSED,
+			       hb_codepoint_t glyph HB_UNUSED,
+			       hb_position_t *x_advance HB_UNUSED,
+			       hb_position_t *y_advance HB_UNUSED)
+{ }
+
+static void
+hb_font_get_glyph_extents_nil (hb_font_t *font HB_UNUSED,
+			       hb_face_t *face HB_UNUSED,
+			       const void *user_data HB_UNUSED,
+			       hb_codepoint_t glyph HB_UNUSED,
+			       hb_glyph_extents_t *extents HB_UNUSED)
+{ }
+
 static hb_bool_t
 hb_font_get_contour_point_nil (hb_font_t *font HB_UNUSED,
 			       hb_face_t *face HB_UNUSED,
@@ -59,14 +76,6 @@
 			       hb_position_t *y HB_UNUSED)
 { return false; }
 
-static void
-hb_font_get_glyph_metrics_nil (hb_font_t *font HB_UNUSED,
-			       hb_face_t *face HB_UNUSED,
-			       const void *user_data HB_UNUSED,
-			       hb_codepoint_t glyph HB_UNUSED,
-			       hb_glyph_metrics_t *metrics HB_UNUSED)
-{ }
-
 static hb_position_t
 hb_font_get_kerning_nil (hb_font_t *font HB_UNUSED,
 			 hb_face_t *face HB_UNUSED,
@@ -80,8 +89,9 @@
   TRUE,  /* immutable */
   {
     hb_font_get_glyph_nil,
+    hb_font_get_glyph_advance_nil,
+    hb_font_get_glyph_extents_nil,
     hb_font_get_contour_point_nil,
-    hb_font_get_glyph_metrics_nil,
     hb_font_get_kerning_nil
   }
 };
@@ -159,6 +169,26 @@
 }
 
 void
+hb_font_funcs_set_glyph_advance_func (hb_font_funcs_t *ffuncs,
+				      hb_font_get_glyph_advance_func_t glyph_advance_func)
+{
+  if (ffuncs->immutable)
+    return;
+
+  ffuncs->v.get_glyph_advance = glyph_advance_func ? glyph_advance_func : hb_font_get_glyph_advance_nil;
+}
+
+void
+hb_font_funcs_set_glyph_extents_func (hb_font_funcs_t *ffuncs,
+				      hb_font_get_glyph_extents_func_t glyph_extents_func)
+{
+  if (ffuncs->immutable)
+    return;
+
+  ffuncs->v.get_glyph_extents = glyph_extents_func ? glyph_extents_func : hb_font_get_glyph_extents_nil;
+}
+
+void
 hb_font_funcs_set_contour_point_func (hb_font_funcs_t *ffuncs,
 				      hb_font_get_contour_point_func_t contour_point_func)
 {
@@ -169,16 +199,6 @@
 }
 
 void
-hb_font_funcs_set_glyph_metrics_func (hb_font_funcs_t *ffuncs,
-				      hb_font_get_glyph_metrics_func_t glyph_metrics_func)
-{
-  if (ffuncs->immutable)
-    return;
-
-  ffuncs->v.get_glyph_metrics = glyph_metrics_func ? glyph_metrics_func : hb_font_get_glyph_metrics_nil;
-}
-
-void
 hb_font_funcs_set_kerning_func (hb_font_funcs_t *ffuncs,
 				hb_font_get_kerning_func_t kerning_func)
 {
@@ -195,18 +215,24 @@
   return ffuncs->v.get_glyph;
 }
 
+hb_font_get_glyph_advance_func_t
+hb_font_funcs_get_glyph_advance_func (hb_font_funcs_t *ffuncs)
+{
+  return ffuncs->v.get_glyph_advance;
+}
+
+hb_font_get_glyph_extents_func_t
+hb_font_funcs_get_glyph_extents_func (hb_font_funcs_t *ffuncs)
+{
+  return ffuncs->v.get_glyph_extents;
+}
+
 hb_font_get_contour_point_func_t
 hb_font_funcs_get_contour_point_func (hb_font_funcs_t *ffuncs)
 {
   return ffuncs->v.get_contour_point;
 }
 
-hb_font_get_glyph_metrics_func_t
-hb_font_funcs_get_glyph_metrics_func (hb_font_funcs_t *ffuncs)
-{
-  return ffuncs->v.get_glyph_metrics;
-}
-
 hb_font_get_kerning_func_t
 hb_font_funcs_get_kerning_func (hb_font_funcs_t *ffuncs)
 {
@@ -223,6 +249,25 @@
 				   unicode, variation_selector);
 }
 
+void
+hb_font_get_glyph_advance (hb_font_t *font, hb_face_t *face,
+			   hb_codepoint_t glyph,
+			   hb_position_t *x_advance, hb_position_t *y_advance)
+{
+  *x_advance = *y_advance = 0;
+  return font->klass->v.get_glyph_advance (font, face, font->user_data,
+					   glyph, x_advance, y_advance);
+}
+
+void
+hb_font_get_glyph_extents (hb_font_t *font, hb_face_t *face,
+			   hb_codepoint_t glyph, hb_glyph_extents_t *extents)
+{
+  memset (extents, 0, sizeof (*extents));
+  return font->klass->v.get_glyph_extents (font, face, font->user_data,
+					   glyph, extents);
+}
+
 hb_bool_t
 hb_font_get_contour_point (hb_font_t *font, hb_face_t *face,
 			   unsigned int point_index,
@@ -234,15 +279,6 @@
 					   glyph, x, y);
 }
 
-void
-hb_font_get_glyph_metrics (hb_font_t *font, hb_face_t *face,
-			   hb_codepoint_t glyph, hb_glyph_metrics_t *metrics)
-{
-  memset (metrics, 0, sizeof (*metrics));
-  return font->klass->v.get_glyph_metrics (font, face, font->user_data,
-					   glyph, metrics);
-}
-
 hb_position_t
 hb_font_get_kerning (hb_font_t *font, hb_face_t *face,
 		     hb_codepoint_t first_glyph, hb_codepoint_t second_glyph)
diff --git a/src/hb-font.h b/src/hb-font.h
index 934f17c..7b3f1ed 100644
--- a/src/hb-font.h
+++ b/src/hb-font.h
@@ -111,23 +111,25 @@
 
 /* funcs */
 
-typedef struct _hb_glyph_metrics_t
+typedef struct _hb_glyph_extents_t
 {
-    hb_position_t x_advance;
-    hb_position_t y_advance;
-    hb_position_t x_offset;
-    hb_position_t y_offset;
+    hb_position_t x_bearing;
+    hb_position_t y_bearing;
     hb_position_t width;
     hb_position_t height;
-} hb_glyph_metrics_t;
+} hb_glyph_extents_t;
 
 typedef hb_codepoint_t (*hb_font_get_glyph_func_t) (hb_font_t *font, hb_face_t *face, const void *user_data,
 						    hb_codepoint_t unicode, hb_codepoint_t variation_selector);
+typedef void (*hb_font_get_glyph_advance_func_t) (hb_font_t *font, hb_face_t *face, const void *user_data,
+						  hb_codepoint_t glyph,
+						  hb_position_t *x_advance, hb_position_t *y_advance);
+typedef void (*hb_font_get_glyph_extents_func_t) (hb_font_t *font, hb_face_t *face, const void *user_data,
+						  hb_codepoint_t glyph,
+						  hb_glyph_extents_t *metrics);
 typedef hb_bool_t (*hb_font_get_contour_point_func_t) (hb_font_t *font, hb_face_t *face, const void *user_data,
-						       unsigned int point_index,
-						       hb_codepoint_t glyph, hb_position_t *x, hb_position_t *y);
-typedef void (*hb_font_get_glyph_metrics_func_t) (hb_font_t *font, hb_face_t *face, const void *user_data,
-						  hb_codepoint_t glyph, hb_glyph_metrics_t *metrics);
+						       unsigned int point_index, hb_codepoint_t glyph,
+						       hb_position_t *x, hb_position_t *y);
 typedef hb_position_t (*hb_font_get_kerning_func_t) (hb_font_t *font, hb_face_t *face, const void *user_data,
 						     hb_codepoint_t first_glyph, hb_codepoint_t second_glyph);
 
@@ -137,12 +139,16 @@
 			      hb_font_get_glyph_func_t glyph_func);
 
 void
-hb_font_funcs_set_contour_point_func (hb_font_funcs_t *ffuncs,
-				      hb_font_get_contour_point_func_t contour_point_func);
+hb_font_funcs_set_glyph_advance_func (hb_font_funcs_t *ffuncs,
+				      hb_font_get_glyph_advance_func_t glyph_advance_func);
 
 void
-hb_font_funcs_set_glyph_metrics_func (hb_font_funcs_t *ffuncs,
-				      hb_font_get_glyph_metrics_func_t glyph_metrics_func);
+hb_font_funcs_set_glyph_extents_func (hb_font_funcs_t *ffuncs,
+				      hb_font_get_glyph_extents_func_t glyph_extents_func);
+
+void
+hb_font_funcs_set_contour_point_func (hb_font_funcs_t *ffuncs,
+				      hb_font_get_contour_point_func_t contour_point_func);
 
 void
 hb_font_funcs_set_kerning_func (hb_font_funcs_t *ffuncs,
@@ -154,12 +160,15 @@
 hb_font_get_glyph_func_t
 hb_font_funcs_get_glyph_func (hb_font_funcs_t *ffuncs);
 
+hb_font_get_glyph_advance_func_t
+hb_font_funcs_get_glyph_advance_func (hb_font_funcs_t *ffuncs);
+
+hb_font_get_glyph_extents_func_t
+hb_font_funcs_get_glyph_extents_func (hb_font_funcs_t *ffuncs);
+
 hb_font_get_contour_point_func_t
 hb_font_funcs_get_contour_point_func (hb_font_funcs_t *ffuncs);
 
-hb_font_get_glyph_metrics_func_t
-hb_font_funcs_get_glyph_metrics_func (hb_font_funcs_t *ffuncs);
-
 hb_font_get_kerning_func_t
 hb_font_funcs_get_kerning_func (hb_font_funcs_t *ffuncs);
 
@@ -168,14 +177,20 @@
 hb_font_get_glyph (hb_font_t *font, hb_face_t *face,
 		   hb_codepoint_t unicode, hb_codepoint_t variation_selector);
 
-hb_bool_t
-hb_font_get_contour_point (hb_font_t *font, hb_face_t *face,
-			   unsigned int point_index,
-			   hb_codepoint_t glyph, hb_position_t *x, hb_position_t *y);
+void
+hb_font_get_glyph_advance (hb_font_t *font, hb_face_t *face,
+			   hb_codepoint_t glyph,
+			   hb_position_t *x_advance, hb_position_t *y_advance);
 
 void
-hb_font_get_glyph_metrics (hb_font_t *font, hb_face_t *face,
-			   hb_codepoint_t glyph, hb_glyph_metrics_t *metrics);
+hb_font_get_glyph_extents (hb_font_t *font, hb_face_t *face,
+			   hb_codepoint_t glyph,
+			   hb_glyph_extents_t *metrics);
+
+hb_bool_t
+hb_font_get_contour_point (hb_font_t *font, hb_face_t *face,
+			   unsigned int point_index, hb_codepoint_t glyph,
+			   hb_position_t *x, hb_position_t *y);
 
 hb_position_t
 hb_font_get_kerning (hb_font_t *font, hb_face_t *face,
diff --git a/src/hb-ft.c b/src/hb-ft.c
index 8619456..1c27668 100644
--- a/src/hb-ft.c
+++ b/src/hb-ft.c
@@ -56,6 +56,48 @@
   return FT_Get_Char_Index (ft_face, unicode);
 }
 
+static void
+hb_ft_get_glyph_advance (hb_font_t *font HB_UNUSED,
+			 hb_face_t *face HB_UNUSED,
+			 const void *user_data,
+			 hb_codepoint_t glyph,
+			 hb_position_t *x_advance,
+			 hb_position_t *y_advance)
+{
+  FT_Face ft_face = (FT_Face) user_data;
+  int load_flags = FT_LOAD_DEFAULT;
+
+  /* TODO: load_flags, embolden, etc */
+
+  if (likely (!FT_Load_Glyph (ft_face, glyph, load_flags)))
+  {
+    *x_advance = ft_face->glyph->advance.x;
+    *y_advance = ft_face->glyph->advance.y;
+  }
+}
+
+static void
+hb_ft_get_glyph_extents (hb_font_t *font HB_UNUSED,
+			 hb_face_t *face HB_UNUSED,
+			 const void *user_data,
+			 hb_codepoint_t glyph,
+			 hb_glyph_extents_t *extents)
+{
+  FT_Face ft_face = (FT_Face) user_data;
+  int load_flags = FT_LOAD_DEFAULT;
+
+  /* TODO: load_flags, embolden, etc */
+
+  if (likely (!FT_Load_Glyph (ft_face, glyph, load_flags)))
+  {
+    /* XXX: A few negations should be in order here, not sure. */
+    extents->x_bearing = ft_face->glyph->metrics.horiBearingX;
+    extents->y_bearing = ft_face->glyph->metrics.horiBearingY;
+    extents->width = ft_face->glyph->metrics.width;
+    extents->height = ft_face->glyph->metrics.height;
+  }
+}
+
 static hb_bool_t
 hb_ft_get_contour_point (hb_font_t *font HB_UNUSED,
 			 hb_face_t *face HB_UNUSED,
@@ -85,33 +127,6 @@
   return TRUE;
 }
 
-static void
-hb_ft_get_glyph_metrics (hb_font_t *font HB_UNUSED,
-			 hb_face_t *face HB_UNUSED,
-			 const void *user_data,
-			 hb_codepoint_t glyph,
-			 hb_glyph_metrics_t *metrics)
-{
-  FT_Face ft_face = (FT_Face) user_data;
-  int load_flags = FT_LOAD_DEFAULT;
-
-  /* TODO: load_flags, embolden, etc */
-
-  metrics->x_advance = metrics->y_advance = 0;
-  metrics->x_offset = metrics->y_offset = 0;
-  metrics->width = metrics->height = 0;
-  if (likely (!FT_Load_Glyph (ft_face, glyph, load_flags)))
-  {
-    /* TODO: A few negations should be in order here, not sure. */
-    metrics->x_advance = ft_face->glyph->advance.x;
-    metrics->y_advance = ft_face->glyph->advance.y;
-    metrics->x_offset = ft_face->glyph->metrics.horiBearingX;
-    metrics->y_offset = ft_face->glyph->metrics.horiBearingY;
-    metrics->width = ft_face->glyph->metrics.width;
-    metrics->height = ft_face->glyph->metrics.height;
-  }
-}
-
 static hb_position_t
 hb_ft_get_kerning (hb_font_t *font HB_UNUSED,
 		   hb_face_t *face HB_UNUSED,
@@ -134,8 +149,9 @@
   TRUE, /* immutable */
   {
     hb_ft_get_glyph,
+    hb_ft_get_glyph_advance,
+    hb_ft_get_glyph_extents,
     hb_ft_get_contour_point,
-    hb_ft_get_glyph_metrics,
     hb_ft_get_kerning
   }
 };
diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index 7b4a451..91ed400 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -233,10 +233,9 @@
 
   unsigned int count = c->buffer->len;
   for (unsigned int i = 0; i < count; i++) {
-    hb_glyph_metrics_t metrics;
-    hb_font_get_glyph_metrics (c->font, c->face, c->buffer->info[i].codepoint, &metrics);
-    c->buffer->pos[i].x_advance = metrics.x_advance;
-    c->buffer->pos[i].y_advance = metrics.y_advance;
+    hb_font_get_glyph_advance (c->font, c->face, c->buffer->info[i].codepoint,
+			       &c->buffer->pos[i].x_advance,
+			       &c->buffer->pos[i].y_advance);
   }
 }