From 54aa8c4d3616f9bc9d62784180fddc092e4673ae Mon Sep 17 00:00:00 2001 From: Max Verevkin Date: Sun, 3 Apr 2022 16:48:18 +0300 Subject: fix weird gaps when using non integer font size --- src/text.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/text.rs b/src/text.rs index a1d2e48..1af64ec 100644 --- a/src/text.rs +++ b/src/text.rs @@ -108,7 +108,7 @@ impl ComputedText { } context.save().unwrap(); - context.translate(options.x_offset, 0.0); + context.translate(options.x_offset - 1.0, 0.0); // Set the width/height on the Pango layout so that it word-wraps/ellipises. let text_width = self.width - text.attr.padding_left - text.attr.padding_right; @@ -119,13 +119,13 @@ impl ComputedText { if let Some(bg) = options.bg_color { bg.apply(context); - context.rectangle(0.0, 0.0, self.width, options.bar_height); + context.rectangle(0.0, 0.0, self.width + 1.0, options.bar_height); context.fill().unwrap(); } options.fg_color.apply(context); context.translate( - text.attr.padding_left, + text.attr.padding_left + 1.0, (options.bar_height - self.height) * 0.5, ); show_pango_layout(context, &layout); -- cgit v1.3.1