comparison src/gui_gtk_x11.c @ 20607:9f5f64cc9720 v8.2.0857

patch 8.2.0857: GTK cell height can be a pixel too much Commit: https://github.com/vim/vim/commit/5cd1cb9ff9d04979ff4cbc36ca8416d83364505d Author: Bram Moolenaar <Bram@vim.org> Date: Sun May 31 13:53:04 2020 +0200 patch 8.2.0857: GTK cell height can be a pixel too much Problem: GTK cell height can be a pixel too much. Solution: Subtract 3 instead of 1 when rounding. (closes https://github.com/vim/vim/issues/6168)
author Bram Moolenaar <Bram@vim.org>
date Sun, 31 May 2020 14:00:03 +0200
parents 3609e842f822
children d64520bfafa0
comparison
equal deleted inserted replaced
20606:7d5bd5affd11 20607:9f5f64cc9720
4709 ascent = pango_font_metrics_get_ascent(metrics); 4709 ascent = pango_font_metrics_get_ascent(metrics);
4710 descent = pango_font_metrics_get_descent(metrics); 4710 descent = pango_font_metrics_get_descent(metrics);
4711 4711
4712 pango_font_metrics_unref(metrics); 4712 pango_font_metrics_unref(metrics);
4713 4713
4714 gui.char_height = (ascent + descent + PANGO_SCALE - 1) / PANGO_SCALE 4714 // Round up, but not when the value is very close (e.g. 15.0009).
4715 gui.char_height = (ascent + descent + PANGO_SCALE - 3) / PANGO_SCALE
4715 + p_linespace; 4716 + p_linespace;
4716 // LINTED: avoid warning: bitwise operation on signed value 4717 // LINTED: avoid warning: bitwise operation on signed value
4717 gui.char_ascent = PANGO_PIXELS(ascent + p_linespace * PANGO_SCALE / 2); 4718 gui.char_ascent = PANGO_PIXELS(ascent + p_linespace * PANGO_SCALE / 2);
4718 4719
4719 // A not-positive value of char_height may crash Vim. Only happens 4720 // A not-positive value of char_height may crash Vim. Only happens