Mercurial > vim
changeset 22730:28001013f467 v8.2.1913
patch 8.2.1913: GTK GUI: rounding for the cell height is too strict
Commit: https://github.com/vim/vim/commit/70cf45810cb9be5bd17074f7fb4ee238f2c4d57b
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Oct 27 20:43:26 2020 +0100
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 https://github.com/vim/vim/issues/7203)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 27 Oct 2020 20:45:03 +0100 |
parents | e4892caf7b5c |
children | 45c95095984a |
files | src/gui_gtk_x11.c src/version.c |
diffstat | 2 files changed, 6 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/gui_gtk_x11.c +++ b/src/gui_gtk_x11.c @@ -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);