[API] Vertical support, take 2
authorBehdad Esfahbod <behdad@behdad.org>
Tue, 17 May 2011 21:55:03 +0000 (17:55 -0400)
committerBehdad Esfahbod <behdad@behdad.org>
Tue, 17 May 2011 21:55:03 +0000 (17:55 -0400)
I like this API *much* better.  Implementation still incomplete, but
horizontal works.

src/hb-font-private.hh
src/hb-font.cc
src/hb-font.h
src/hb-ft.cc
src/hb-ot-layout-gdef-private.hh
src/hb-ot-layout-gpos-private.hh
src/hb-ot-shape.cc

index 875a884..fcd96da 100644 (file)
@@ -52,11 +52,12 @@ struct _hb_font_funcs_t {
   HB_FONT_FUNC_IMPLEMENT (glyph) \
   HB_FONT_FUNC_IMPLEMENT (glyph_h_advance) \
   HB_FONT_FUNC_IMPLEMENT (glyph_v_advance) \
+  HB_FONT_FUNC_IMPLEMENT (glyph_h_origin) \
   HB_FONT_FUNC_IMPLEMENT (glyph_v_origin) \
-  HB_FONT_FUNC_IMPLEMENT (h_kerning) \
-  HB_FONT_FUNC_IMPLEMENT (v_kerning) \
+  HB_FONT_FUNC_IMPLEMENT (glyph_h_kerning) \
+  HB_FONT_FUNC_IMPLEMENT (glyph_v_kerning) \
   HB_FONT_FUNC_IMPLEMENT (glyph_extents) \
-  HB_FONT_FUNC_IMPLEMENT (contour_point)
+  HB_FONT_FUNC_IMPLEMENT (glyph_contour_point)
 
 
   struct {
index 9cdb302..df1dfb1 100644 (file)
@@ -97,6 +97,26 @@ hb_font_get_glyph_v_advance_nil (hb_font_t *font HB_UNUSED,
 }
 
 static hb_bool_t
+hb_font_get_glyph_h_origin_nil (hb_font_t *font HB_UNUSED,
+                               void *font_data HB_UNUSED,
+                               hb_codepoint_t glyph,
+                               hb_position_t *x_origin,
+                               hb_position_t *y_origin,
+                               void *user_data HB_UNUSED)
+{
+  if (font->parent) {
+    hb_bool_t ret = hb_font_get_glyph_h_origin (font->parent,
+                                               glyph,
+                                               x_origin, y_origin);
+    font->parent_scale_distance (x_origin, y_origin);
+    return ret;
+  }
+
+  *x_origin = *y_origin = 0;
+  return FALSE;
+}
+
+static hb_bool_t
 hb_font_get_glyph_v_origin_nil (hb_font_t *font HB_UNUSED,
                                void *font_data HB_UNUSED,
                                hb_codepoint_t glyph,
@@ -117,18 +137,18 @@ hb_font_get_glyph_v_origin_nil (hb_font_t *font HB_UNUSED,
 }
 
 static hb_bool_t
-hb_font_get_h_kerning_nil (hb_font_t *font HB_UNUSED,
-                          void *font_data HB_UNUSED,
-                          hb_codepoint_t left_glyph,
-                          hb_codepoint_t right_glyph,
-                          hb_position_t *x_kern,
-                          hb_position_t *y_kern,
-                          void *user_data HB_UNUSED)
+hb_font_get_glyph_h_kerning_nil (hb_font_t *font HB_UNUSED,
+                                void *font_data HB_UNUSED,
+                                hb_codepoint_t left_glyph,
+                                hb_codepoint_t right_glyph,
+                                hb_position_t *x_kern,
+                                hb_position_t *y_kern,
+                                void *user_data HB_UNUSED)
 {
   if (font->parent) {
-    hb_bool_t ret = hb_font_get_h_kerning (font->parent,
-                                          left_glyph, right_glyph,
-                                          x_kern, y_kern);
+    hb_bool_t ret = hb_font_get_glyph_h_kerning (font->parent,
+                                                left_glyph, right_glyph,
+                                                x_kern, y_kern);
     font->parent_scale_distance (x_kern, y_kern);
     return ret;
   }
@@ -138,18 +158,18 @@ hb_font_get_h_kerning_nil (hb_font_t *font HB_UNUSED,
 }
 
 static hb_bool_t
-hb_font_get_v_kerning_nil (hb_font_t *font HB_UNUSED,
-                          void *font_data HB_UNUSED,
-                          hb_codepoint_t top_glyph,
-                          hb_codepoint_t bottom_glyph,
-                          hb_position_t *x_kern,
-                          hb_position_t *y_kern,
-                          void *user_data HB_UNUSED)
+hb_font_get_glyph_v_kerning_nil (hb_font_t *font HB_UNUSED,
+                                void *font_data HB_UNUSED,
+                                hb_codepoint_t top_glyph,
+                                hb_codepoint_t bottom_glyph,
+                                hb_position_t *x_kern,
+                                hb_position_t *y_kern,
+                                void *user_data HB_UNUSED)
 {
   if (font->parent) {
-    hb_bool_t ret = hb_font_get_v_kerning (font->parent,
-                                          top_glyph, bottom_glyph,
-                                          x_kern, y_kern);
+    hb_bool_t ret = hb_font_get_glyph_v_kerning (font->parent,
+                                                top_glyph, bottom_glyph,
+                                                x_kern, y_kern);
     font->parent_scale_distance (x_kern, y_kern);
     return ret;
   }
@@ -162,14 +182,12 @@ static hb_bool_t
 hb_font_get_glyph_extents_nil (hb_font_t *font HB_UNUSED,
                               void *font_data HB_UNUSED,
                               hb_codepoint_t glyph,
-                              hb_bool_t *vertical,
                               hb_glyph_extents_t *extents,
                               void *user_data HB_UNUSED)
 {
   if (font->parent) {
     hb_bool_t ret = hb_font_get_glyph_extents (font->parent,
                                               glyph,
-                                              vertical,
                                               extents);
     font->parent_scale_position (&extents->x_bearing, &extents->y_bearing);
     font->parent_scale_distance (&extents->width, &extents->height);
@@ -182,20 +200,18 @@ hb_font_get_glyph_extents_nil (hb_font_t *font HB_UNUSED,
 }
 
 static hb_bool_t
-hb_font_get_contour_point_nil (hb_font_t *font HB_UNUSED,
-                              void *font_data HB_UNUSED,
-                              hb_codepoint_t glyph,
-                              unsigned int point_index,
-                              hb_bool_t *vertical,
-                              hb_position_t *x,
-                              hb_position_t *y,
-                              void *user_data HB_UNUSED)
+hb_font_get_glyph_contour_point_nil (hb_font_t *font HB_UNUSED,
+                                    void *font_data HB_UNUSED,
+                                    hb_codepoint_t glyph,
+                                    unsigned int point_index,
+                                    hb_position_t *x,
+                                    hb_position_t *y,
+                                    void *user_data HB_UNUSED)
 {
   if (font->parent) {
-    hb_bool_t ret = hb_font_get_contour_point (font->parent,
-                                              glyph, point_index,
-                                              vertical,
-                                              x, y);
+    hb_bool_t ret = hb_font_get_glyph_contour_point (font->parent,
+                                                    glyph, point_index,
+                                                    x, y);
     font->parent_scale_position (x, y);
     return ret;
   }
@@ -351,6 +367,17 @@ hb_font_get_glyph_v_advance (hb_font_t *font,
 }
 
 hb_bool_t
+hb_font_get_glyph_h_origin (hb_font_t *font,
+                           hb_codepoint_t glyph,
+                           hb_position_t *x_origin, hb_position_t *y_origin)
+{
+  *x_origin = *y_origin = 0;
+  return font->klass->get.glyph_h_origin (font, font->user_data,
+                                          glyph, x_origin, y_origin,
+                                          font->klass->user_data.glyph_h_origin);
+}
+
+hb_bool_t
 hb_font_get_glyph_v_origin (hb_font_t *font,
                            hb_codepoint_t glyph,
                            hb_position_t *x_origin, hb_position_t *y_origin)
@@ -362,55 +389,51 @@ hb_font_get_glyph_v_origin (hb_font_t *font,
 }
 
 hb_bool_t
-hb_font_get_h_kerning (hb_font_t *font,
-                      hb_codepoint_t left_glyph, hb_codepoint_t right_glyph,
-                      hb_position_t *x_kern, hb_position_t *y_kern)
+hb_font_get_glyph_h_kerning (hb_font_t *font,
+                            hb_codepoint_t left_glyph, hb_codepoint_t right_glyph,
+                            hb_position_t *x_kern, hb_position_t *y_kern)
 {
   *x_kern = *y_kern = 0;
-  return font->klass->get.h_kerning (font, font->user_data,
-                                    left_glyph, right_glyph,
-                                    x_kern, y_kern,
-                                    font->klass->user_data.h_kerning);
+  return font->klass->get.glyph_h_kerning (font, font->user_data,
+                                          left_glyph, right_glyph,
+                                          x_kern, y_kern,
+                                          font->klass->user_data.glyph_h_kerning);
 }
 
 hb_bool_t
-hb_font_get_v_kerning (hb_font_t *font,
-                      hb_codepoint_t left_glyph, hb_codepoint_t right_glyph,
-                      hb_position_t *x_kern, hb_position_t *y_kern)
+hb_font_get_glyph_v_kerning (hb_font_t *font,
+                            hb_codepoint_t left_glyph, hb_codepoint_t right_glyph,
+                            hb_position_t *x_kern, hb_position_t *y_kern)
 {
   *x_kern = *y_kern = 0;
-  return font->klass->get.v_kerning (font, font->user_data,
+  return font->klass->get.glyph_v_kerning (font, font->user_data,
                                     left_glyph, right_glyph,
                                     x_kern, y_kern,
-                                    font->klass->user_data.v_kerning);
+                                    font->klass->user_data.glyph_v_kerning);
 }
 
 hb_bool_t
 hb_font_get_glyph_extents (hb_font_t *font,
                           hb_codepoint_t glyph,
-                          hb_bool_t *vertical,
                           hb_glyph_extents_t *extents)
 {
   memset (extents, 0, sizeof (*extents));
   return font->klass->get.glyph_extents (font, font->user_data,
                                         glyph,
-                                        vertical,
                                         extents,
                                         font->klass->user_data.glyph_extents);
 }
 
 hb_bool_t
-hb_font_get_contour_point (hb_font_t *font,
-                          hb_codepoint_t glyph, unsigned int point_index,
-                          hb_bool_t *vertical,
-                          hb_position_t *x, hb_position_t *y)
+hb_font_get_glyph_contour_point (hb_font_t *font,
+                                hb_codepoint_t glyph, unsigned int point_index,
+                                hb_position_t *x, hb_position_t *y)
 {
   *x = *y = 0;
-  return font->klass->get.contour_point (font, font->user_data,
-                                        glyph, point_index,
-                                        vertical,
-                                        x, y,
-                                        font->klass->user_data.contour_point);
+  return font->klass->get.glyph_contour_point (font, font->user_data,
+                                              glyph, point_index,
+                                              x, y,
+                                              font->klass->user_data.glyph_contour_point);
 }
 
 
@@ -433,20 +456,36 @@ hb_font_get_glyph_advance_for_direction (hb_font_t *font,
 }
 
 void
-hb_font_get_kerning_for_direction (hb_font_t *font,
-                                  hb_codepoint_t first_glyph, hb_codepoint_t second_glyph,
-                                  hb_direction_t direction,
-                                  hb_position_t *x_kern, hb_position_t *y_kern)
+hb_font_get_glyph_origin_for_direction (hb_font_t *font,
+                                       hb_codepoint_t glyph,
+                                       hb_direction_t direction,
+                                       hb_position_t *x_origin, hb_position_t *y_origin)
+{
+  if (HB_DIRECTION_IS_VERTICAL (direction)) {
+    hb_bool_t ret = hb_font_get_glyph_v_origin (font, glyph, x_origin, y_origin);
+    if (!ret) {
+      /* TODO Simulate using XXX h_origin and font_extents */
+    }
+  } else {
+    hb_font_get_glyph_h_origin (font, glyph, x_origin, y_origin);
+  }
+}
+
+void
+hb_font_get_glyph_kerning_for_direction (hb_font_t *font,
+                                        hb_codepoint_t first_glyph, hb_codepoint_t second_glyph,
+                                        hb_direction_t direction,
+                                        hb_position_t *x_kern, hb_position_t *y_kern)
 {
   switch (direction) {
     case HB_DIRECTION_LTR:
     case HB_DIRECTION_RTL:
-      hb_font_get_h_kerning (font, first_glyph, second_glyph, x_kern, y_kern);
+      hb_font_get_glyph_h_kerning (font, first_glyph, second_glyph, x_kern, y_kern);
       break;
 
     case HB_DIRECTION_TTB:
     case HB_DIRECTION_BTT:
-      hb_font_get_v_kerning (font, first_glyph, second_glyph, x_kern, y_kern);
+      hb_font_get_glyph_v_kerning (font, first_glyph, second_glyph, x_kern, y_kern);
       break;
 
     case HB_DIRECTION_INVALID:
@@ -461,28 +500,24 @@ hb_font_get_glyph_extents_for_direction (hb_font_t *font,
                                         hb_direction_t direction,
                                         hb_glyph_extents_t *extents)
 {
-  hb_bool_t vertical = HB_DIRECTION_IS_VERTICAL (direction);
-  hb_bool_t ret = hb_font_get_glyph_extents (font, glyph, &vertical, extents);
+  hb_bool_t ret = hb_font_get_glyph_extents (font, glyph, extents);
 
   if (ret) {
-    if (vertical != HB_DIRECTION_IS_VERTICAL (direction)) {
-      /* XXX Adjust origin */
-    }
+    /* XXX Adjust origin */
   } else {
     /* TODO Simulate using get_h_advance and font_extents? */
   }
 }
 
 hb_bool_t
-hb_font_get_contour_point_for_direction (hb_font_t *font,
-                                        hb_codepoint_t glyph, unsigned int point_index,
-                                        hb_direction_t direction,
-                                        hb_position_t *x, hb_position_t *y)
+hb_font_get_glyph_contour_point_for_direction (hb_font_t *font,
+                                              hb_codepoint_t glyph, unsigned int point_index,
+                                              hb_direction_t direction,
+                                              hb_position_t *x, hb_position_t *y)
 {
-  hb_bool_t vertical = HB_DIRECTION_IS_VERTICAL (direction);
-  hb_bool_t ret = hb_font_get_contour_point (font, glyph, point_index, &vertical, x, y);
+  hb_bool_t ret = hb_font_get_glyph_contour_point (font, glyph, point_index, x, y);
 
-  if (ret && vertical != HB_DIRECTION_IS_VERTICAL (direction)) {
+  if (ret) {
     /* XXX Adjust origin */
   }
 
index 625ff4a..a73b8d1 100644 (file)
@@ -144,34 +144,34 @@ typedef hb_bool_t (*hb_font_get_glyph_func_t) (hb_font_t *font, void *font_data,
 
 typedef hb_bool_t (*hb_font_get_glyph_advance_func_t) (hb_font_t *font, void *font_data,
                                                       hb_codepoint_t glyph,
-                                                      hb_position_t *x_advance, hb_position_t *y_advance,
+                                                      hb_position_t *x, hb_position_t *y,
                                                       void *user_data);
 typedef hb_font_get_glyph_advance_func_t hb_font_get_glyph_h_advance_func_t;
 typedef hb_font_get_glyph_advance_func_t hb_font_get_glyph_v_advance_func_t;
 
-typedef hb_bool_t (*hb_font_get_glyph_v_origin_func_t) (hb_font_t *font, void *font_data,
-                                                       hb_codepoint_t glyph,
-                                                       hb_position_t *x_origin, hb_position_t *y_origin,
-                                                       void *user_data);
+typedef hb_bool_t (*hb_font_get_glyph_origin_func_t) (hb_font_t *font, void *font_data,
+                                                     hb_codepoint_t glyph,
+                                                     hb_position_t *x, hb_position_t *y,
+                                                     void *user_data);
+typedef hb_font_get_glyph_origin_func_t hb_font_get_glyph_h_origin_func_t;
+typedef hb_font_get_glyph_origin_func_t hb_font_get_glyph_v_origin_func_t;
 
-typedef hb_bool_t (*hb_font_get_kerning_func_t) (hb_font_t *font, void *font_data,
-                                                hb_codepoint_t first_glyph, hb_codepoint_t second_glyph,
-                                                hb_position_t *x_kern, hb_position_t *y_kern,
-                                                void *user_data);
-typedef hb_font_get_kerning_func_t hb_font_get_h_kerning_func_t;
-typedef hb_font_get_kerning_func_t hb_font_get_v_kerning_func_t;
+typedef hb_bool_t (*hb_font_get_glyph_kerning_func_t) (hb_font_t *font, void *font_data,
+                                                      hb_codepoint_t first_glyph, hb_codepoint_t second_glyph,
+                                                      hb_position_t *x, hb_position_t *y,
+                                                      void *user_data);
+typedef hb_font_get_glyph_kerning_func_t hb_font_get_glyph_h_kerning_func_t;
+typedef hb_font_get_glyph_kerning_func_t hb_font_get_glyph_v_kerning_func_t;
 
 
 typedef hb_bool_t (*hb_font_get_glyph_extents_func_t) (hb_font_t *font, void *font_data,
                                                       hb_codepoint_t glyph,
-                                                      hb_bool_t *vertical,
                                                       hb_glyph_extents_t *extents,
                                                       void *user_data);
-typedef hb_bool_t (*hb_font_get_contour_point_func_t) (hb_font_t *font, void *font_data,
-                                                      hb_codepoint_t glyph, unsigned int point_index,
-                                                      hb_bool_t *vertical,
-                                                      hb_position_t *x, hb_position_t *y,
-                                                      void *user_data);
+typedef hb_bool_t (*hb_font_get_glyph_contour_point_func_t) (hb_font_t *font, void *font_data,
+                                                            hb_codepoint_t glyph, unsigned int point_index,
+                                                            hb_position_t *x, hb_position_t *y,
+                                                            void *user_data);
 
 
 /* func setters */
@@ -191,27 +191,31 @@ hb_font_funcs_set_glyph_v_advance_func (hb_font_funcs_t *ffuncs,
                                        void *user_data, hb_destroy_func_t destroy);
 
 void
+hb_font_funcs_set_glyph_h_origin_func (hb_font_funcs_t *ffuncs,
+                                      hb_font_get_glyph_h_origin_func_t glyph_advance_func,
+                                      void *user_data, hb_destroy_func_t destroy);
+void
 hb_font_funcs_set_glyph_v_origin_func (hb_font_funcs_t *ffuncs,
                                       hb_font_get_glyph_v_origin_func_t glyph_advance_func,
                                       void *user_data, hb_destroy_func_t destroy);
 
 void
-hb_font_funcs_set_h_kerning_func (hb_font_funcs_t *ffuncs,
-                                 hb_font_get_h_kerning_func_t kerning_func,
-                                 void *user_data, hb_destroy_func_t destroy);
+hb_font_funcs_set_glyph_h_kerning_func (hb_font_funcs_t *ffuncs,
+                                       hb_font_get_glyph_h_kerning_func_t kerning_func,
+                                       void *user_data, hb_destroy_func_t destroy);
 void
-hb_font_funcs_set_v_kerning_func (hb_font_funcs_t *ffuncs,
-                                 hb_font_get_v_kerning_func_t kerning_func,
-                                 void *user_data, hb_destroy_func_t destroy);
+hb_font_funcs_set_glyph_v_kerning_func (hb_font_funcs_t *ffuncs,
+                                       hb_font_get_glyph_v_kerning_func_t kerning_func,
+                                       void *user_data, hb_destroy_func_t destroy);
 
 void
 hb_font_funcs_set_glyph_extents_func (hb_font_funcs_t *ffuncs,
                                      hb_font_get_glyph_extents_func_t glyph_extents_func,
                                      void *user_data, hb_destroy_func_t destroy);
 void
-hb_font_funcs_set_contour_point_func (hb_font_funcs_t *ffuncs,
-                                     hb_font_get_contour_point_func_t contour_point_func,
-                                     void *user_data, hb_destroy_func_t destroy);
+hb_font_funcs_set_glyph_contour_point_func (hb_font_funcs_t *ffuncs,
+                                           hb_font_get_glyph_contour_point_func_t glyph_contour_point_func,
+                                           void *user_data, hb_destroy_func_t destroy);
 
 
 /* func dispatch */
@@ -224,37 +228,39 @@ hb_font_get_glyph (hb_font_t *font,
 hb_bool_t
 hb_font_get_glyph_h_advance (hb_font_t *font,
                             hb_codepoint_t glyph,
-                            hb_position_t *x_advance, hb_position_t *y_advance);
+                            hb_position_t *x, hb_position_t *y);
 hb_bool_t
 hb_font_get_glyph_v_advance (hb_font_t *font,
                             hb_codepoint_t glyph,
-                            hb_position_t *x_advance, hb_position_t *y_advance);
+                            hb_position_t *x, hb_position_t *y);
 
 hb_bool_t
+hb_font_get_glyph_h_origin (hb_font_t *font,
+                           hb_codepoint_t glyph,
+                           hb_position_t *x, hb_position_t *y);
+hb_bool_t
 hb_font_get_glyph_v_origin (hb_font_t *font,
                            hb_codepoint_t glyph,
-                           hb_position_t *x_kern, hb_position_t *y_kern);
+                           hb_position_t *x, hb_position_t *y);
 
 hb_bool_t
-hb_font_get_h_kerning (hb_font_t *font,
-                      hb_codepoint_t left_glyph, hb_codepoint_t right_glyph,
-                      hb_position_t *x_kern, hb_position_t *y_kern);
+hb_font_get_glyph_h_kerning (hb_font_t *font,
+                            hb_codepoint_t left_glyph, hb_codepoint_t right_glyph,
+                            hb_position_t *x, hb_position_t *y);
 hb_bool_t
-hb_font_get_v_kerning (hb_font_t *font,
-                      hb_codepoint_t top_glyph, hb_codepoint_t bottom_glyph,
-                      hb_position_t *x_kern, hb_position_t *y_kern);
+hb_font_get_glyph_v_kerning (hb_font_t *font,
+                            hb_codepoint_t top_glyph, hb_codepoint_t bottom_glyph,
+                            hb_position_t *x, hb_position_t *y);
 
 hb_bool_t
 hb_font_get_glyph_extents (hb_font_t *font,
                           hb_codepoint_t glyph,
-                          hb_bool_t *vertical,
                           hb_glyph_extents_t *extents);
 
 hb_bool_t
-hb_font_get_contour_point (hb_font_t *font,
-                          hb_codepoint_t glyph, unsigned int point_index,
-                          hb_bool_t *vertical,
-                          hb_position_t *x, hb_position_t *y);
+hb_font_get_glyph_contour_point (hb_font_t *font,
+                                hb_codepoint_t glyph, unsigned int point_index,
+                                hb_position_t *x, hb_position_t *y);
 
 
 /* high-level funcs, with fallback */
@@ -263,13 +269,18 @@ void
 hb_font_get_glyph_advance_for_direction (hb_font_t *font,
                                         hb_codepoint_t glyph,
                                         hb_direction_t direction,
-                                        hb_position_t *x_advance, hb_position_t *y_advance);
+                                        hb_position_t *x, hb_position_t *y);
+void
+hb_font_get_glyph_origin_for_direction (hb_font_t *font,
+                                       hb_codepoint_t glyph,
+                                       hb_direction_t direction,
+                                       hb_position_t *x, hb_position_t *y);
 
 void
-hb_font_get_kerning_for_direction (hb_font_t *font,
-                                  hb_codepoint_t first_glyph, hb_codepoint_t second_glyph,
-                                  hb_direction_t direction,
-                                  hb_position_t *x_kern, hb_position_t *y_kern);
+hb_font_get_glyph_kerning_for_direction (hb_font_t *font,
+                                        hb_codepoint_t first_glyph, hb_codepoint_t second_glyph,
+                                        hb_direction_t direction,
+                                        hb_position_t *x, hb_position_t *y);
 
 void
 hb_font_get_glyph_extents_for_direction (hb_font_t *font,
@@ -278,10 +289,10 @@ hb_font_get_glyph_extents_for_direction (hb_font_t *font,
                                         hb_glyph_extents_t *extents);
 
 hb_bool_t
-hb_font_get_contour_point_for_direction (hb_font_t *font,
-                                        hb_codepoint_t glyph, unsigned int point_index,
-                                        hb_direction_t direction,
-                                        hb_position_t *x, hb_position_t *y);
+hb_font_get_glyph_contour_point_for_direction (hb_font_t *font,
+                                              hb_codepoint_t glyph, unsigned int point_index,
+                                              hb_direction_t direction,
+                                              hb_position_t *x, hb_position_t *y);
 
 
 /*
index 3e66adc..3b00068 100644 (file)
@@ -115,6 +115,18 @@ hb_ft_get_glyph_v_advance (hb_font_t *font HB_UNUSED,
 }
 
 static hb_bool_t
+hb_ft_get_glyph_h_origin (hb_font_t *font HB_UNUSED,
+                         void *font_data HB_UNUSED,
+                         hb_codepoint_t glyph HB_UNUSED,
+                         hb_position_t *x_origin HB_UNUSED,
+                         hb_position_t *y_origin HB_UNUSED,
+                         void *user_data HB_UNUSED)
+{
+  /* We always work in the horizontal coordinates. */
+  return TRUE;
+}
+
+static hb_bool_t
 hb_ft_get_glyph_v_origin (hb_font_t *font HB_UNUSED,
                          void *font_data,
                          hb_codepoint_t glyph,
@@ -128,18 +140,18 @@ hb_ft_get_glyph_v_origin (hb_font_t *font HB_UNUSED,
   if (unlikely (FT_Load_Glyph (ft_face, glyph, load_flags)))
     return FALSE;
 
-  *y_origin = ft_face->glyph->metrics.vertAdvance;
+  /* XXX */*y_origin = ft_face->glyph->metrics.vertAdvance;
   return TRUE;
 }
 
 static hb_bool_t
-hb_ft_get_h_kerning (hb_font_t *font HB_UNUSED,
-                    void *font_data,
-                    hb_codepoint_t left_glyph,
-                    hb_codepoint_t right_glyph,
-                    hb_position_t *x_kern,
-                    hb_position_t *y_kern,
-                    void *user_data HB_UNUSED)
+hb_ft_get_glyph_h_kerning (hb_font_t *font HB_UNUSED,
+                          void *font_data,
+                          hb_codepoint_t left_glyph,
+                          hb_codepoint_t right_glyph,
+                          hb_position_t *x_kern,
+                          hb_position_t *y_kern,
+                          void *user_data HB_UNUSED)
 {
   FT_Face ft_face = (FT_Face) font_data;
   FT_Vector kerning;
@@ -153,13 +165,13 @@ hb_ft_get_h_kerning (hb_font_t *font HB_UNUSED,
 }
 
 static hb_bool_t
-hb_ft_get_v_kerning (hb_font_t *font HB_UNUSED,
-                    void *font_data,
-                    hb_codepoint_t top_glyph,
-                    hb_codepoint_t bottom_glyph,
-                    hb_position_t *x_kern,
-                    hb_position_t *y_kern,
-                    void *user_data HB_UNUSED)
+hb_ft_get_glyph_v_kerning (hb_font_t *font HB_UNUSED,
+                          void *font_data HB_UNUSED,
+                          hb_codepoint_t top_glyph HB_UNUSED,
+                          hb_codepoint_t bottom_glyph HB_UNUSED,
+                          hb_position_t *x_kern HB_UNUSED,
+                          hb_position_t *y_kern HB_UNUSED,
+                          void *user_data HB_UNUSED)
 {
   /* FreeType API doesn't support vertical kerning */
   return FALSE;
@@ -169,7 +181,6 @@ static hb_bool_t
 hb_ft_get_glyph_extents (hb_font_t *font HB_UNUSED,
                         void *font_data,
                         hb_codepoint_t glyph,
-                        hb_bool_t *vertical,
                         hb_glyph_extents_t *extents,
                         void *user_data HB_UNUSED)
 {
@@ -190,14 +201,13 @@ hb_ft_get_glyph_extents (hb_font_t *font HB_UNUSED,
 }
 
 static hb_bool_t
-hb_ft_get_contour_point (hb_font_t *font HB_UNUSED,
-                        void *font_data,
-                        hb_codepoint_t glyph,
-                        unsigned int point_index,
-                        hb_bool_t *vertical,
-                        hb_position_t *x,
-                        hb_position_t *y,
-                        void *user_data HB_UNUSED)
+hb_ft_get_glyph_contour_point (hb_font_t *font HB_UNUSED,
+                              void *font_data,
+                              hb_codepoint_t glyph,
+                              unsigned int point_index,
+                              hb_position_t *x,
+                              hb_position_t *y,
+                              void *user_data HB_UNUSED)
 {
   FT_Face ft_face = (FT_Face) font_data;
   int load_flags = FT_LOAD_DEFAULT;
@@ -213,7 +223,6 @@ hb_ft_get_contour_point (hb_font_t *font HB_UNUSED,
 
   *x = ft_face->glyph->outline.points[point_index].x;
   *y = ft_face->glyph->outline.points[point_index].y;
-  *vertical = FALSE; /* We always return position in horizontal coordinates */
 
   return TRUE;
 }
@@ -227,11 +236,12 @@ static hb_font_funcs_t ft_ffuncs = {
     hb_ft_get_glyph,
     hb_ft_get_glyph_h_advance,
     hb_ft_get_glyph_v_advance,
+    hb_ft_get_glyph_h_origin,
     hb_ft_get_glyph_v_origin,
-    hb_ft_get_h_kerning,
-    hb_ft_get_v_kerning,
+    hb_ft_get_glyph_h_kerning,
+    hb_ft_get_glyph_v_kerning,
     hb_ft_get_glyph_extents,
-    hb_ft_get_contour_point,
+    hb_ft_get_glyph_contour_point,
   }
 };
 
index a14dada..01ac4ba 100644 (file)
@@ -121,7 +121,7 @@ struct CaretValueFormat2
   inline int get_caret_value (hb_font_t *font, hb_direction_t direction, hb_codepoint_t glyph_id) const
   {
     hb_position_t x, y;
-    if (hb_font_get_contour_point_for_direction (font, glyph_id, caretValuePoint, direction, &x, &y))
+    if (hb_font_get_glyph_contour_point_for_direction (font, glyph_id, caretValuePoint, direction, &x, &y))
       return HB_DIRECTION_IS_HORIZONTAL (direction) ? x : y;
     else
       return 0;
index 6701a6a..cfb5e82 100644 (file)
@@ -245,7 +245,7 @@ struct AnchorFormat2
       hb_bool_t ret = false;
 
       if (x_ppem || y_ppem)
-       ret = hb_font_get_contour_point_for_direction (font, glyph_id, anchorPoint, direction, &cx, &cy);
+       ret = hb_font_get_glyph_contour_point_for_direction (font, glyph_id, anchorPoint, direction, &cx, &cy);
       *x = x_ppem && ret ? cx : font->em_scale_x (xCoordinate);
       *y = y_ppem && ret ? cy : font->em_scale_y (yCoordinate);
   }
index 3b6aa5a..8823f5a 100644 (file)
@@ -278,10 +278,10 @@ hb_truetype_kern (hb_ot_shape_context_t *c)
   unsigned int count = c->buffer->len;
   for (unsigned int i = 1; i < count; i++) {
     hb_position_t x_kern, y_kern, kern1, kern2;
-    hb_font_get_kerning_for_direction (c->font,
-                                      c->buffer->info[i - 1].codepoint, c->buffer->info[i].codepoint,
-                                      c->buffer->props.direction,
-                                      &x_kern, &y_kern);
+    hb_font_get_glyph_kerning_for_direction (c->font,
+                                            c->buffer->info[i - 1].codepoint, c->buffer->info[i].codepoint,
+                                            c->buffer->props.direction,
+                                            &x_kern, &y_kern);
 
     kern1 = x_kern >> 1;
     kern2 = x_kern - kern1;