From 1661f1b2c1651009c324f851eeee1957db097910 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 8 May 2021 22:17:54 -0400 Subject: layout: handle empty lines better When using line-spacing, we were not giving empty lines their expected width. Fix that. Fixes: #499 --- pango/pango-layout.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pango/pango-layout.c b/pango/pango-layout.c index 57ec7606..c483526f 100644 --- a/pango/pango-layout.c +++ b/pango/pango-layout.c @@ -5213,8 +5213,15 @@ pango_layout_line_get_extents_and_height (PangoLayoutLine *line, tmp_list = tmp_list->next; } - if (logical_rect && !line->runs) - pango_layout_line_get_empty_extents (line, logical_rect); + if (!line->runs) + { + PangoRectangle r, *rect; + + rect = logical_rect ? logical_rect : &r; + pango_layout_line_get_empty_extents (line, rect); + if (height) + *height = rect->height; + } if (caching) { -- cgit v1.2.1