summaryrefslogtreecommitdiff
path: root/src/gui_gtk_x11.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-10-27 20:43:26 +0100
committerBram Moolenaar <Bram@vim.org>2020-10-27 20:43:26 +0100
commit70cf45810cb9be5bd17074f7fb4ee238f2c4d57b (patch)
treea985f1b4c9e9fef6868384b5b9e8fd786a472037 /src/gui_gtk_x11.c
parent68a48ee55e55c189b03a6718a0d06af1dfedcd16 (diff)
downloadvim-git-70cf45810cb9be5bd17074f7fb4ee238f2c4d57b.tar.gz
patch 8.2.1913: GTK GUI: rounding for the cell height is too strictv8.2.1913
Problem: GTK GUI: rounding for the cell height is too strict. Solution: Round up above 15/16 of a pixel. (closes #7203)
Diffstat (limited to 'src/gui_gtk_x11.c')
-rw-r--r--src/gui_gtk_x11.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c
index 2c5864ed4..1a4ebf9ba 100644
--- 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);