[pango/harfbuzz-ng-external] Update to harfbuzz 0.3 api



commit 79e0de9ba027bd803c043749d0208873d97de7fd
Author: Behdad Esfahbod <behdad behdad org>
Date:   Wed Oct 27 01:15:43 2010 -0400

    Update to harfbuzz 0.3 api

 configure.in             |    2 +-
 modules/basic/basic-fc.c |   38 +++++++++++++++++++++++++++-----------
 2 files changed, 28 insertions(+), 12 deletions(-)
---
diff --git a/configure.in b/configure.in
index f88d5c8..87fe0e9 100644
--- a/configure.in
+++ b/configure.in
@@ -433,7 +433,7 @@ AM_CONDITIONAL(HAVE_CAIRO_FREETYPE, $have_cairo_freetype)
 AM_CONDITIONAL(HAVE_CAIRO_ATSUI, $have_cairo_atsui)
 
 
-harfbuzz_required=0.2
+harfbuzz_required=0.3
 PKG_CHECK_MODULES(HARFBUZZ, harfbuzz >= $harfbuzz_required, have_harfbuzz=true, have_harfbuzz=false)
 AM_CONDITIONAL(HAVE_HARFBUZZ, $have_harfbuzz)
 
diff --git a/modules/basic/basic-fc.c b/modules/basic/basic-fc.c
index 5ac7c77..0f823e4 100644
--- a/modules/basic/basic-fc.c
+++ b/modules/basic/basic-fc.c
@@ -156,21 +156,32 @@ pango_fc_hb_font_get_contour_point (hb_font_t *font, hb_face_t *face, const void
 }
 
 static void
-pango_fc_hb_font_get_glyph_metrics (hb_font_t *font, hb_face_t *face, const void *user_data,
-				    hb_codepoint_t glyph, hb_glyph_metrics_t *metrics)
+pango_fc_hb_font_get_glyph_advance (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 G_GNUC_UNUSED)
 {
   PangoFcHbContext *context = (PangoFcHbContext *) user_data;
   PangoFcFont *fc_font = context->fc_font;
-  PangoRectangle ink, logical;
+  PangoRectangle logical;
 
-  pango_font_get_glyph_extents ((PangoFont *) fc_font, glyph, &ink, &logical);
+  pango_font_get_glyph_extents ((PangoFont *) fc_font, glyph, NULL, &logical);
 
-  metrics->x_advance = logical.width;
-  metrics->y_advance = 0;
-  metrics->x_offset  =  ink.x;
-  metrics->y_offset  = -ink.y;
-  metrics->width     = ink.width;
-  metrics->height    = ink.height;
+  *x_advance = logical.width;
+}
+
+static void
+pango_fc_hb_font_get_glyph_extents (hb_font_t *font, hb_face_t *face, const void *user_data,
+				    hb_codepoint_t glyph, hb_glyph_extents_t *extents)
+{
+  PangoFcHbContext *context = (PangoFcHbContext *) user_data;
+  PangoFcFont *fc_font = context->fc_font;
+  PangoRectangle ink;
+
+  pango_font_get_glyph_extents ((PangoFont *) fc_font, glyph, &ink, NULL);
+
+  extents->x_bearing  =  ink.x;
+  extents->y_bearing  = -ink.y; /* XXX */
+  extents->width     = ink.width;
+  extents->height    = ink.height;
 }
 
 static hb_position_t
@@ -196,8 +207,9 @@ pango_fc_get_hb_font_funcs (void)
   if (G_UNLIKELY (!funcs)) {
     funcs = hb_font_funcs_create ();
     hb_font_funcs_set_glyph_func (funcs, pango_fc_hb_font_get_glyph);
+    hb_font_funcs_set_glyph_advance_func (funcs, pango_fc_hb_font_get_glyph_advance);
+    hb_font_funcs_set_glyph_extents_func (funcs, pango_fc_hb_font_get_glyph_extents);
     hb_font_funcs_set_contour_point_func (funcs, pango_fc_hb_font_get_contour_point);
-    hb_font_funcs_set_glyph_metrics_func (funcs, pango_fc_hb_font_get_glyph_metrics);
     hb_font_funcs_set_kerning_func (funcs, pango_fc_hb_font_get_kerning);
   }
 
@@ -278,6 +290,10 @@ basic_engine_shape (PangoEngineShape *engine G_GNUC_UNUSED,
       glyphs->glyphs[i].attr.is_cluster_start = glyphs->log_clusters[i] != last_cluster;
       last_cluster = glyphs->log_clusters[i];
 
+      /* XXX
+      if (is_hinted)
+	advance = PANGO_UNITS_ROUND (advance);
+	*/
       glyphs->glyphs[i].geometry.width = hb_position->x_advance;
       glyphs->glyphs[i].geometry.x_offset =  hb_position->x_offset;
       glyphs->glyphs[i].geometry.y_offset = -hb_position->y_offset;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]