fixup metrics when line_height==1.0

This was broken by b441be3ac9

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
This commit is contained in:
Wez Furlong committed 2021-04-08 09:48:47 -07:00
1 parent 064b591a1b
commit 6830d171cf
1 file changed
+1 -1
+1 -1
View File
@@ -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;