[pango/fix-underlined-spaces] Underline spaces again
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/fix-underlined-spaces] Underline spaces again
- Date: Fri, 24 Sep 2021 16:10:24 +0000 (UTC)
commit 2e49eb0c706b5124e7acc30d098564aa929296ae
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Sep 24 12:07:17 2021 -0400
Underline spaces again
in ada1bc9385d638e4c42, I switched to using ink rects
for horizontal underline extents, to improve the placement
of single-character underlines in the presence of
kerning. I overlooked the fact that spaces don't have ink,
so the change caused leading and trailing whitespace to
not be underlined anymore. Fix this by using the union
of ink and logical rectangles.
Fixes: #613
pango/pango-renderer.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/pango/pango-renderer.c b/pango/pango-renderer.c
index b3b70549..311c28cd 100644
--- a/pango/pango-renderer.c
+++ b/pango/pango-renderer.c
@@ -362,8 +362,8 @@ add_underline (PangoRenderer *renderer,
int underline_thickness = pango_font_metrics_get_underline_thickness (metrics);
int underline_position = pango_font_metrics_get_underline_position (metrics);
- new_rect.x = base_x + ink_rect->x;
- new_rect.width = ink_rect->width;
+ new_rect.x = base_x + MIN (ink_rect->x, logical_rect->x);
+ new_rect.width = MAX (ink_rect->width, logical_rect->width);
new_rect.height = underline_thickness;
new_rect.y = base_y;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]