Commit: patch 9.2.0965: GTK4: blurry text rendering

2 views
Skip to first unread message

Christian Brabandt

unread,
Aug 17, 2026, 5:00:14 PM (18 hours ago) Aug 17
to vim...@googlegroups.com
patch 9.2.0965: GTK4: blurry text rendering

Commit: https://github.com/vim/vim/commit/5a0e4889d185dd2cb9c3c7049b726160393ef7c6
Author: Christoffer Aasted <dez...@gmail.com>
Date: Mon Aug 17 20:49:08 2026 +0000

patch 9.2.0965: GTK4: blurry text rendering

Problem: The GTK4 GUI rounds the character width up instead of to the
nearest pixel, and adjacent row nodes leave a one pixel seam
because their boundaries are not snapped to device pixels.
Solution: Round the character width to the nearest pixel and overlap
adjacent row nodes by one pixel (Christoffer Aasted).

closes: #21013

Signed-off-by: Christoffer Aasted <dez...@gmail.com>
Signed-off-by: Foxe Chen <chen...@gmail.com>
Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/gui_gtk4.c b/src/gui_gtk4.c
index 5b31e587b..90e3e8603 100644
--- a/src/gui_gtk4.c
+++ b/src/gui_gtk4.c
@@ -1303,7 +1303,7 @@ gui_mch_init_font(char_u *font_name, int fontset UNUSED)
pango_layout_get_size(layout, &width, NULL);
g_object_unref(layout);

- gui.char_width = (width / 2 + PANGO_SCALE - 1) / PANGO_SCALE;
+ gui.char_width = (width / 2 + PANGO_SCALE / 2) / PANGO_SCALE;
if (gui.char_width <= 0)
gui.char_width = 8;

diff --git a/src/gui_gtk4_da.c b/src/gui_gtk4_da.c
index d7e460254..6eb9798e2 100644
--- a/src/gui_gtk4_da.c
+++ b/src/gui_gtk4_da.c
@@ -694,8 +694,8 @@ draw_layer_get_texture(

// Scale texture to actual size
node = gsk_texture_scale_node_new(texture,
- &GRAPHENE_RECT_INIT(FILL_X(0), FILL_Y(row),
- (da->n_cols + bleed) * gui.char_width, gui.char_height),
+ &GRAPHENE_RECT_INIT(FILL_X(0), FILL_Y(row),
+ (da->n_cols + bleed) * gui.char_width, gui.char_height + bleed),
GSK_SCALING_FILTER_NEAREST);
if (bleed)
{
@@ -704,7 +704,7 @@ draw_layer_get_texture(
new = gsk_clip_node_new(node,
&GRAPHENE_RECT_INIT(FILL_X(0), FILL_Y(row),
da->n_cols * gui.char_width + da->bleed_right,
- gui.char_height));
+ gui.char_height + 1));
gsk_render_node_unref(node);
node = new;
}
diff --git a/src/version.c b/src/version.c
index bd636ef46..ae56e26a8 100644
--- a/src/version.c
+++ b/src/version.c
@@ -763,6 +763,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 965,
/**/
964,
/**/
Reply all
Reply to author
Forward
0 new messages