summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2005-05-02 21:22:19 +0000
committerOwen Taylor <otaylor@src.gnome.org>2005-05-02 21:22:19 +0000
commitcdc77f57773bfb4639f15b77a14736658a3d9926 (patch)
tree206b419e9cb0e5f7df4aae933f10cd07d12420a5
parent1dff283f45f52c10dfd6894c444a1c54816c280f (diff)
downloadpango-cdc77f57773bfb4639f15b77a14736658a3d9926.tar.gz
Get the ascent/descent from Cairo to fix bugs in metrics computation with
2005-04-29 Owen Taylor <otaylor@redhat.com> * pango/pangocairo-fcfont.c (pango_cairo_fc_font_get_glyph_extents): Get the ascent/descent from Cairo to fix bugs in metrics computation with a transformation in effect.
-rw-r--r--ChangeLog10
-rw-r--r--ChangeLog.pre-1-1010
-rw-r--r--pango/pangocairo-fcfont.c31
3 files changed, 17 insertions, 34 deletions
diff --git a/ChangeLog b/ChangeLog
index 057ce96f..98e77f1a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,14 +1,14 @@
-2005-05-01 Owen Taylor <otaylor@redhat.com>
-
- * examples/cairoview.c: Fix for the change of cairo_clip() not to preserve
- the path.
-
2005-04-29 Owen Taylor <otaylor@redhat.com>
* pango/pangocairo-fcfont.c (pango_cairo_fc_font_get_glyph_extents):
Get the ascent/descent from Cairo to fix bugs in metrics computation
with a transformation in effect.
+2005-05-01 Owen Taylor <otaylor@redhat.com>
+
+ * examples/cairoview.c: Fix for the change of cairo_clip() not to preserve
+ the path.
+
2005-04-28 Tor Lillqvist <tml@novell.com>
* pango/pangocairo-win32font.c (pango_cairo_win32_font_get_font_face):
diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10
index 057ce96f..98e77f1a 100644
--- a/ChangeLog.pre-1-10
+++ b/ChangeLog.pre-1-10
@@ -1,14 +1,14 @@
-2005-05-01 Owen Taylor <otaylor@redhat.com>
-
- * examples/cairoview.c: Fix for the change of cairo_clip() not to preserve
- the path.
-
2005-04-29 Owen Taylor <otaylor@redhat.com>
* pango/pangocairo-fcfont.c (pango_cairo_fc_font_get_glyph_extents):
Get the ascent/descent from Cairo to fix bugs in metrics computation
with a transformation in effect.
+2005-05-01 Owen Taylor <otaylor@redhat.com>
+
+ * examples/cairoview.c: Fix for the change of cairo_clip() not to preserve
+ the path.
+
2005-04-28 Tor Lillqvist <tml@novell.com>
* pango/pangocairo-win32font.c (pango_cairo_win32_font_get_font_face):
diff --git a/pango/pangocairo-fcfont.c b/pango/pangocairo-fcfont.c
index 27a20e0e..7b2d9243 100644
--- a/pango/pangocairo-fcfont.c
+++ b/pango/pangocairo-fcfont.c
@@ -147,26 +147,6 @@ pango_cairo_fc_font_finalize (GObject *object)
}
static void
-get_ascent_descent (PangoCairoFcFont *cffont,
- int *ascent,
- int *descent)
-{
- PangoFcFont *fcfont = PANGO_FC_FONT (cffont);
- FT_Face face;
-
- face = pango_fc_font_lock_face (fcfont);
-
- /* This is complicated in general (see pangofc-font.c:get_face_metrics(),
- * but simple for hinted, untransformed fonts. cairo_glyph_extents() will
- * have set up the right size on the font as a side-effect.
- */
- *descent = - PANGO_UNITS_26_6 (face->size->metrics.descender);
- *ascent = PANGO_UNITS_26_6 (face->size->metrics.ascender);
-
- pango_fc_font_unlock_face (fcfont);
-}
-
-static void
pango_cairo_fc_font_get_glyph_extents (PangoFont *font,
PangoGlyph glyph,
PangoRectangle *ink_rect,
@@ -196,14 +176,17 @@ pango_cairo_fc_font_get_glyph_extents (PangoFont *font,
if (logical_rect)
{
- int ascent, descent;
+ /* It may well be worth caching the font_extents here, since getting them
+ * is pretty expensive.
+ */
+ cairo_font_extents_t font_extents;
- get_ascent_descent (cffont, &ascent, &descent);
+ cairo_scaled_font_extents (scaled_font, &font_extents);
logical_rect->x = 0;
- logical_rect->y = - ascent;
+ logical_rect->y = - font_extents.ascent * PANGO_SCALE;
logical_rect->width = extents.x_advance * PANGO_SCALE;
- logical_rect->height = ascent + descent;
+ logical_rect->height = (font_extents.ascent + font_extents.descent) * PANGO_SCALE;
}
}