From 6830d171cfa7b95b2ca0addf5e817c815e19223d Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Thu, 8 Apr 2021 09:40:54 -0700 Subject: [PATCH] fixup metrics when line_height==1.0 This was broken by b441be3ac92d7b2390fd416fe5c76da13679aa30 For whatever reason, the breakage was only visible with the Iosveka font on Windows. I couldn't reproduce it on my other systems, even though the code technically applies to any system. The breakage was: the metrics resulted in a difference of about 0.4 pixels being used for the descender with that particular font, resulting in weird vertical alignment problems. The offset needs to be computed against the ceil of the cell height, which removes the fractional offset. refs: https://github.com/wez/wezterm/issues/661 refs: https://github.com/wez/wezterm/issues/582 --- wezterm-gui/src/utilsprites.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wezterm-gui/src/utilsprites.rs b/wezterm-gui/src/utilsprites.rs index 890171cb8..dd93531cc 100644 --- a/wezterm-gui/src/utilsprites.rs +++ b/wezterm-gui/src/utilsprites.rs @@ -35,7 +35,7 @@ impl RenderMetrics { // When line_height != 1.0, we want to adjust the baseline position // such that we are horizontally centered. - let line_height_y_adjust = (cell_height as f64 - metrics.cell_height.get()) / 2.; + let line_height_y_adjust = (cell_height as f64 - metrics.cell_height.get().ceil()) / 2.; let underline_height = metrics.underline_thickness.get().round().max(1.) as isize;