summaryrefslogtreecommitdiff
path: root/pango/pango-renderer.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-08-27 15:27:04 -0400
committerMatthias Clasen <mclasen@redhat.com>2021-08-27 15:27:04 -0400
commitada1bc9385d638e4c42a5aa58706c0a6874779e7 (patch)
tree0729040859be4ef9a8823099db5a8a2e1e7e4ee3 /pango/pango-renderer.c
parentaf2cce982209b9750dd73675a73bfc5a002d9e27 (diff)
downloadpango-ada1bc9385d638e4c42a5aa58706c0a6874779e7.tar.gz
renderer: Use ink rects for line lengthsunderline-kerning
When rendering underlines and the like, we should use ink extents, since the logical extents will get shortened by kerning, which can be pretty noticable when underlining individual glyphs, such as the T in To. Fixes: #139
Diffstat (limited to 'pango/pango-renderer.c')
-rw-r--r--pango/pango-renderer.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/pango/pango-renderer.c b/pango/pango-renderer.c
index c91cb6ee..055cdd97 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 + logical_rect->x;
- new_rect.width = logical_rect->width;
+ new_rect.x = base_x + ink_rect->x;
+ new_rect.width = ink_rect->width;
new_rect.height = underline_thickness;
new_rect.y = base_y;
@@ -425,8 +425,8 @@ add_overline (PangoRenderer *renderer,
int underline_thickness = pango_font_metrics_get_underline_thickness (metrics);
int ascent = pango_font_metrics_get_ascent (metrics);
- new_rect.x = base_x + logical_rect->x;
- new_rect.width = logical_rect->width;
+ new_rect.x = base_x + ink_rect->x;
+ new_rect.width = ink_rect->width;
new_rect.height = underline_thickness;
new_rect.y = base_y;
@@ -480,8 +480,8 @@ add_strikethrough (PangoRenderer *renderer,
int strikethrough_thickness = pango_font_metrics_get_strikethrough_thickness (metrics);
int strikethrough_position = pango_font_metrics_get_strikethrough_position (metrics);
- new_rect.x = base_x + logical_rect->x;
- new_rect.width = logical_rect->width;
+ new_rect.x = base_x + ink_rect->x;
+ new_rect.width = ink_rect->width;
new_rect.y = (base_y - strikethrough_position) * num_glyphs;
new_rect.height = strikethrough_thickness * num_glyphs;