summaryrefslogtreecommitdiff
path: root/pango/pangocairo-fcfont.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2005-05-16 18:00:22 +0000
committerOwen Taylor <otaylor@src.gnome.org>2005-05-16 18:00:22 +0000
commita1d091f8b9fa18792c6d989a5eb7c8bad1c87258 (patch)
tree07faa7897569c0196b7774af26a5fdfdbdfd92b6 /pango/pangocairo-fcfont.c
parent774df2fe97bc6180fe55659ccff10c349976a022 (diff)
downloadpango-a1d091f8b9fa18792c6d989a5eb7c8bad1c87258.tar.gz
pango/pangocairo-render.c (pango_cairo_renderer_draw_glyphs): Handle glyph
2005-05-16 Owen Taylor <otaylor@redhat.com> * pango/pangocairo-fcfont.c (pango_cairo_fc_font_get_glyph_extents): pango/pangocairo-render.c (pango_cairo_renderer_draw_glyphs): Handle glyph == 0. * modules/indic/indic-ot.h modules/basic/basic-common.h: Treat LINE SEPARATOR as a zero-width character.
Diffstat (limited to 'pango/pangocairo-fcfont.c')
-rw-r--r--pango/pangocairo-fcfont.c55
1 files changed, 36 insertions, 19 deletions
diff --git a/pango/pangocairo-fcfont.c b/pango/pangocairo-fcfont.c
index f14e8e9a..cde571bf 100644
--- a/pango/pangocairo-fcfont.c
+++ b/pango/pangocairo-fcfont.c
@@ -152,40 +152,57 @@ pango_cairo_fc_font_get_glyph_extents (PangoFont *font,
PangoRectangle *logical_rect)
{
cairo_scaled_font_t *scaled_font;
- cairo_text_extents_t extents;
- cairo_glyph_t cairo_glyph;
scaled_font = pango_cairo_fc_font_get_scaled_font (PANGO_CAIRO_FONT (font));
- cairo_glyph.index = glyph;
- cairo_glyph.x = 0;
- cairo_glyph.y = 0;
-
- cairo_scaled_font_glyph_extents (scaled_font,
- &cairo_glyph, 1, &extents);
-
- if (ink_rect)
- {
- ink_rect->x = extents.x_bearing * PANGO_SCALE;
- ink_rect->y = extents.y_bearing * PANGO_SCALE;
- ink_rect->width = extents.width * PANGO_SCALE;
- ink_rect->height = extents.height * PANGO_SCALE;
- }
-
if (logical_rect)
{
/* It may well be worth caching the font_extents here, since getting them
* is pretty expensive.
*/
cairo_font_extents_t font_extents;
-
+
cairo_scaled_font_extents (scaled_font, &font_extents);
logical_rect->x = 0;
logical_rect->y = - font_extents.ascent * PANGO_SCALE;
- logical_rect->width = extents.x_advance * PANGO_SCALE;
+ logical_rect->width = 0;
logical_rect->height = (font_extents.ascent + font_extents.descent) * PANGO_SCALE;
}
+
+ if (glyph)
+ {
+ cairo_text_extents_t extents;
+ cairo_glyph_t cairo_glyph;
+
+ cairo_glyph.index = glyph;
+ cairo_glyph.x = 0;
+ cairo_glyph.y = 0;
+
+ cairo_scaled_font_glyph_extents (scaled_font,
+ &cairo_glyph, 1, &extents);
+
+ if (ink_rect)
+ {
+ ink_rect->x = extents.x_bearing * PANGO_SCALE;
+ ink_rect->y = extents.y_bearing * PANGO_SCALE;
+ ink_rect->width = extents.width * PANGO_SCALE;
+ ink_rect->height = extents.height * PANGO_SCALE;
+ }
+
+ if (logical_rect)
+ logical_rect->width = extents.x_advance * PANGO_SCALE;
+ }
+ else
+ {
+ if (ink_rect)
+ {
+ ink_rect->x = 0;
+ ink_rect->y = 0;
+ ink_rect->width = 0;
+ ink_rect->height = 0;
+ }
+ }
}
static FT_Face