From ea637cde1c82ad971078671aff087236f3fb0fbd Mon Sep 17 00:00:00 2001 From: Christian Duerr Date: Fri, 16 Nov 2018 21:28:49 +0000 Subject: [PATCH] Fix blurry fonts without dynamic padding There were some minor rounding issues in the padding codepath without dynamic padding. These have been fixed, which should resolve issues with blurry fonts on monitors with a fractional DPR. This fixes https://github.com/jwilm/alacritty/issues/1806. --- src/display.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/display.rs b/src/display.rs index 3fe5fbc4..1a145185 100644 --- a/src/display.rs +++ b/src/display.rs @@ -330,12 +330,12 @@ impl Display { let mut padding_y = f32::from(config.padding().y) * dpr as f32; if config.window().dynamic_padding() { - padding_x = (padding_x + ((width - 2. * padding_x) % cell_width) / 2.).floor(); - padding_y = (padding_y + ((height - 2. * padding_y) % cell_height) / 2.).floor(); + padding_x = padding_x + ((width - 2. * padding_x) % cell_width) / 2.; + padding_y = padding_y + ((height - 2. * padding_y) % cell_height) / 2.; } - self.size_info.padding_x = padding_x; - self.size_info.padding_y = padding_y; + self.size_info.padding_x = padding_x.floor(); + self.size_info.padding_y = padding_y.floor(); let size = &self.size_info; terminal.resize(size); @@ -345,7 +345,7 @@ impl Display { } self.window.resize(psize); - self.renderer.resize(psize, padding_x, padding_y); + self.renderer.resize(psize, self.size_info.padding_x, self.size_info.padding_y); } }