summaryrefslogtreecommitdiff
path: root/pango/pango-layout.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-layout.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-layout.c')
-rw-r--r--pango/pango-layout.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index db2c870c..cb6e14d7 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -3910,10 +3910,17 @@ pango_layout_run_get_extents (PangoLayoutRun *run,
PangoRectangle *run_ink,
PangoRectangle *run_logical)
{
+ PangoRectangle logical;
ItemProperties properties;
+ if (G_UNLIKELY (!run_ink && !run_logical))
+ return;
+
pango_layout_get_item_properties (run->item, &properties);
+ if (!run_logical && run->item->analysis.centered_baseline)
+ run_logical = &logical;
+
if (properties.shape_set)
imposed_extents (run->item->num_chars,
properties.shape_ink_rect,
@@ -3959,6 +3966,9 @@ pango_layout_run_get_extents (PangoLayoutRun *run,
pango_font_metrics_unref (metrics);
}
+ if (run->item->analysis.centered_baseline)
+ properties.rise += run_logical->y + run_logical->height / 2;
+
if (properties.rise != 0)
{
if (run_ink)