summaryrefslogtreecommitdiff
path: root/pango/pangocairo-fcfont.c
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2006-08-15 19:26:40 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2006-08-15 19:26:40 +0000
commit099d3b8efa4b04c8d578aa9e1de3e108ef4c77a9 (patch)
treeb9dd21fb459506b945fcf43032c2acd7b7ff3f2c /pango/pangocairo-fcfont.c
parent9f96e87af64452c67466dc48636d7df77cdd5cd4 (diff)
downloadpango-099d3b8efa4b04c8d578aa9e1de3e108ef4c77a9.tar.gz
Fix handling of WEST and EAST gravity effect on bidi level.
2006-08-15 Behdad Esfahbod <behdad@gnome.org> * pango/pango-context.c (itemize_state_add_character): Fix handling of WEST and EAST gravity effect on bidi level. * pango/pangocairo-fcfont.c (pango_cairo_fc_font_glyph_extents_cache_init): For NORTH gravity (upside down text), swap ascent and descent, and for EAST/WEST, center baseline between ascent/descent. * pango/shape.c (pango_shape): If glyph width is negative, negate it and shift glyph by that amount. This allows having font matrices that essentially move the glyph origin to the right of the glyph to still work.
Diffstat (limited to 'pango/pangocairo-fcfont.c')
-rw-r--r--pango/pangocairo-fcfont.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/pango/pangocairo-fcfont.c b/pango/pangocairo-fcfont.c
index 1b5a56fe..1af98e11 100644
--- a/pango/pangocairo-fcfont.c
+++ b/pango/pangocairo-fcfont.c
@@ -270,9 +270,27 @@ pango_cairo_fc_font_glyph_extents_cache_init (PangoCairoFcFont *cffont)
cairo_scaled_font_extents (scaled_font, &font_extents);
cffont->font_extents.x = 0;
- cffont->font_extents.y = - PANGO_UNITS (font_extents.ascent);
- cffont->font_extents.height = PANGO_UNITS (font_extents.ascent + font_extents.descent);
cffont->font_extents.width = 0;
+ cffont->font_extents.height = PANGO_UNITS (font_extents.ascent + font_extents.descent);
+ switch (cffont->gravity)
+ {
+ default:
+ case PANGO_GRAVITY_SOUTH:
+ cffont->font_extents.y = - PANGO_UNITS (font_extents.ascent);
+ break;
+ case PANGO_GRAVITY_NORTH:
+ cffont->font_extents.y = - PANGO_UNITS (font_extents.descent);
+ break;
+ /* The case of EAST/WEST is tricky. In vertical layout, ascent/descent
+ * are useless. I'm trying to get a patch into cairo to use
+ * max_x_advance*0.5 for ascent and descent for vertical fonts. That's
+ * at least more useful. But with or without it, doesn't harm to center
+ * ourselves here.
+ */
+ case PANGO_GRAVITY_EAST:
+ case PANGO_GRAVITY_WEST:
+ cffont->font_extents.y = - PANGO_UNITS ((font_extents.ascent + font_extents.descent) * 0.5);
+ }
cffont->glyph_extents_cache = g_new0 (GlyphExtentsCacheEntry, GLYPH_CACHE_NUM_ENTRIES);
/* Make sure all cache entries are invalid initially */