0
0
mirror of https://github.com/vim/vim.git synced 2025-10-04 05:25:06 -04:00

patch 8.2.1913: GTK GUI: rounding for the cell height is too strict

Problem:    GTK GUI: rounding for the cell height is too strict.
Solution:   Round up above 15/16 of a pixel. (closes #7203)
This commit is contained in:
Bram Moolenaar
2020-10-27 20:43:26 +01:00
parent 68a48ee55e
commit 70cf45810c
2 changed files with 6 additions and 3 deletions

View File

@@ -4726,9 +4726,10 @@ gui_mch_adjust_charheight(void)
pango_font_metrics_unref(metrics);
// Round up, but not when the value is very close (e.g. 15.0009).
gui.char_height = (ascent + descent + PANGO_SCALE - 3) / PANGO_SCALE
+ p_linespace;
// Round up when the value is more than about 1/16 of a pixel above a whole
// pixel (12.0624 becomes 12, 12.07 becomes 13). Then add 'linespace'.
gui.char_height = (ascent + descent + (PANGO_SCALE * 15) / 16)
/ PANGO_SCALE + p_linespace;
// LINTED: avoid warning: bitwise operation on signed value
gui.char_ascent = PANGO_PIXELS(ascent + p_linespace * PANGO_SCALE / 2);