diff options
-rw-r--r-- | pango/pango-layout.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/pango/pango-layout.c b/pango/pango-layout.c index 9b61cf77..a56e5329 100644 --- a/pango/pango-layout.c +++ b/pango/pango-layout.c @@ -176,9 +176,10 @@ static PangoLayoutLine* _pango_layout_iter_get_line (PangoLayoutIter *iter); static void pango_layout_get_item_properties (PangoItem *item, ItemProperties *properties); -static void pango_layout_get_empty_extents_at_index (PangoLayout *layout, +static void pango_layout_get_empty_extents_and_height_at_index (PangoLayout *layout, int index, - PangoRectangle *logical_rect); + PangoRectangle *logical_rect, + int *height); static void pango_layout_finalize (GObject *object); @@ -4335,8 +4336,9 @@ pango_layout_check_lines (PangoLayout *layout) if (layout->height >= 0) { PangoRectangle logical; - pango_layout_get_empty_extents_at_index (layout, 0, &logical); - state.line_height = logical.height; + int height; + pango_layout_get_empty_extents_and_height_at_index (layout, 0, &logical, &height); + state.line_height = layout->line_spacing == 0.0 ? logical.height : layout->line_spacing * height; } do @@ -4884,9 +4886,10 @@ pango_layout_line_get_x_ranges (PangoLayoutLine *line, } static void -pango_layout_get_empty_extents_at_index (PangoLayout *layout, - int index, - PangoRectangle *logical_rect) +pango_layout_get_empty_extents_and_height_at_index (PangoLayout *layout, + int index, + PangoRectangle *logical_rect, + int *height) { if (logical_rect) { @@ -4950,6 +4953,8 @@ pango_layout_get_empty_extents_at_index (PangoLayout *layout, { logical_rect->y = - pango_font_metrics_get_ascent (metrics); logical_rect->height = - logical_rect->y + pango_font_metrics_get_descent (metrics); + if (height) + *height = pango_font_metrics_get_height (metrics); pango_font_metrics_unref (metrics); } @@ -4975,10 +4980,11 @@ pango_layout_get_empty_extents_at_index (PangoLayout *layout, } static void -pango_layout_line_get_empty_extents (PangoLayoutLine *line, - PangoRectangle *logical_rect) +pango_layout_line_get_empty_extents_and_height (PangoLayoutLine *line, + PangoRectangle *logical_rect, + int *height) { - pango_layout_get_empty_extents_at_index (line->layout, line->start_index, logical_rect); + pango_layout_get_empty_extents_and_height_at_index (line->layout, line->start_index, logical_rect, height); } static void @@ -5229,9 +5235,7 @@ pango_layout_line_get_extents_and_height (PangoLayoutLine *line, PangoRectangle r, *rect; rect = logical_rect ? logical_rect : &r; - pango_layout_line_get_empty_extents (line, rect); - if (height) - *height = rect->height; + pango_layout_line_get_empty_extents_and_height (line, rect, height); } if (caching) |