summaryrefslogtreecommitdiff
path: root/pango/pango-renderer.c
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2006-08-16 02:01:17 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2006-08-16 02:01:17 +0000
commit927657a432fadf219e7fdf057e4493658192a963 (patch)
tree4ed60f3434529a69f7e7586def646437623a9486 /pango/pango-renderer.c
parent3b88b840eac1b8b8dca9c6d93f916ef70e973ca8 (diff)
downloadpango-927657a432fadf219e7fdf057e4493658192a963.tar.gz
Return if none of logical_rect or ink_rect is non-NULL.
2006-08-15 Behdad Esfahbod <behdad@gnome.org> * pango/pango-layout.c (pango_layout_run_get_extents): * pango/glyphstring.c (pango_glyph_string_extents_range): Return if none of logical_rect or ink_rect is non-NULL. * pango/pango-item.h (PangoAnalysis): Add new member centered_baseline which if set, makes item rendered such that ascent == descent. * pango/pango-context.c (itemize_state_init), (itemize_state_add_character): * pango/pango-renderer.c (pango_renderer_draw_layout_line): Implement centered_baseline. * pango/pangocairo-fcfont.c (pango_cairo_fc_font_get_metrics): When adjusting ascent/descent for vertical fonts, adjust strikethrough and underline position too. * docs/tmpl/main.sgml: Document new struct member.
Diffstat (limited to 'pango/pango-renderer.c')
-rw-r--r--pango/pango-renderer.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/pango/pango-renderer.c b/pango/pango-renderer.c
index c53f645d..f54e1282 100644
--- a/pango/pango-renderer.c
+++ b/pango/pango-renderer.c
@@ -479,7 +479,11 @@ pango_renderer_draw_layout_line (PangoRenderer *renderer,
gint rise;
PangoLayoutRun *run = l->data;
PangoAttrShape *shape_attr;
- PangoRectangle ink_rect;
+ PangoRectangle ink_rect, *ink = NULL;
+ PangoRectangle logical_rect, *logical = NULL;
+
+ if (run->item->analysis.centered_baseline)
+ logical = &logical_rect;
pango_renderer_prepare_run (renderer, run);
@@ -488,19 +492,28 @@ pango_renderer_draw_layout_line (PangoRenderer *renderer,
if (shape_attr)
{
ink_rect = shape_attr->ink_rect;
+ logical_rect = shape_attr->logical_rect;
glyph_string_width = shape_attr->logical_rect.width;
}
else
{
if (renderer->underline != PANGO_UNDERLINE_NONE ||
renderer->strikethrough)
- pango_glyph_string_extents (run->glyphs, run->item->analysis.font,
- &ink_rect, NULL);
- glyph_string_width = pango_glyph_string_get_width (run->glyphs);
+ ink = &ink_rect;
+ pango_glyph_string_extents (run->glyphs, run->item->analysis.font,
+ ink, logical);
+ if (logical)
+ glyph_string_width = logical_rect.width;
+ else
+ glyph_string_width = pango_glyph_string_get_width (run->glyphs);
}
state.logical_rect_end = x + x_off + glyph_string_width;
+ if (run->item->analysis.centered_baseline)
+ rise += logical_rect.y + logical_rect.height / 2;
+
+
if (renderer->priv->color_set[PANGO_RENDER_PART_BACKGROUND])
{
if (!got_overall)