summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2010-10-27 01:15:43 -0400
committerBehdad Esfahbod <behdad@behdad.org>2010-10-27 01:15:43 -0400
commit79e0de9ba027bd803c043749d0208873d97de7fd (patch)
treebd2e86f59cfdbccde3a946958aa3de84b9f2cff7 /modules
parentf5a23a517f1c8d886603f3401a1dba9ab9f0767f (diff)
downloadpango-79e0de9ba027bd803c043749d0208873d97de7fd.tar.gz
Update to harfbuzz 0.3 api
Diffstat (limited to 'modules')
-rw-r--r--modules/basic/basic-fc.c38
1 files changed, 27 insertions, 11 deletions
diff --git a/modules/basic/basic-fc.c b/modules/basic/basic-fc.c
index 5ac7c772..0f823e46 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;