[vim/vim] GTK4: letterspacing, signscolumn off (Issue #21002)

3 views
Skip to first unread message

dezza

unread,
Aug 10, 2026, 10:08:30 PM (14 hours ago) Aug 10
to vim/vim, Subscribed
dezza created an issue (vim/vim#21002)

Steps to reproduce

⬅️ gtk4 ... ➡️ gtk3
Image: gtk4_left_gtk3_right (view on web)

It might have gotten a lot better since last time I took a close look, but you can clearly see the:

  • letterspacing is stretched.
  • ⬅️ signs column has border

Expected behaviour

Match gtk3

Version of Vim

9.2.0927

Environment

Operating system: OpenSUSE Tumbleweed

Logs and stack traces


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/21002@github.com>

Foxe Chen

unread,
Aug 10, 2026, 10:21:20 PM (13 hours ago) Aug 10
to vim/vim, Subscribed
64-bitman left a comment (vim/vim#21002)

Can you try using the latest version? Things look fine to me. What font are you using?


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/21002/5248281454@github.com>

dezza

unread,
Aug 10, 2026, 10:33:14 PM (13 hours ago) Aug 10
to vim/vim, Subscribed
dezza left a comment (vim/vim#21002)

@64-bitman no font-related changes, it has been this way all the time and I've always noticed it and its not the only font I've used. Before I used Roboto Mono now I use Commit Mono.

I assume this https://github.com/vim/vim/blob/d03735e8d29a228e6a37300335983101edb69431/src/gui_gtk4_da.c#L1361

Is copied from https://github.com/vim/vim/blob/d03735e8d29a228e6a37300335983101edb69431/src/gui_gtk_x11.c#L6404

It most likely need to be adapted.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/21002/5248344326@github.com>

Foxe Chen

unread,
Aug 10, 2026, 10:42:16 PM (13 hours ago) Aug 10
to vim/vim, Subscribed
64-bitman left a comment (vim/vim#21002)

Hm, I'm also using Commit Mono and nothing seems out of the ordinary. Can you compare both GTK3 and GTK4 together using Commit Mono font? In your screenshot the font is different for GTK3


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/21002/5248392469@github.com>

dezza

unread,
Aug 10, 2026, 10:43:39 PM (13 hours ago) Aug 10
to vim/vim, Subscribed
dezza left a comment (vim/vim#21002)

Even starting regular without vimrc also shows. Look closer, it definetily adds letter spacing and the signcolumn is inarguable.

Font rendering is 99% priority for me in text editor.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/21002/5248399498@github.com>

Foxe Chen

unread,
Aug 10, 2026, 10:52:47 PM (13 hours ago) Aug 10
to vim/vim, Subscribed
64-bitman left a comment (vim/vim#21002)

This is what mines looks like using latest commit:

Image: Image (view on web)

Both are Commit Mono, you are looking at the same font.

Are you sure? The g character is different for both


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/21002/5248450360@github.com>

dezza

unread,
Aug 10, 2026, 10:58:04 PM (13 hours ago) Aug 10
to vim/vim, Subscribed
dezza left a comment (vim/vim#21002)

Yes, its the same settings. Its most likely a combination of gtk4,3 hinting,kerning,antialiasing differences and because my font has tighter letterspacing and shorter lineheight.

You did not compare, but try. Also try 1pt higher font size.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/21002/5248478646@github.com>

Foxe Chen

unread,
Aug 10, 2026, 11:53:55 PM (12 hours ago) Aug 10
to vim/vim, Subscribed
64-bitman left a comment (vim/vim#21002)

Can you try this patch, I removed the fixed width hack?

diff --git a/src/gui_gtk4_da.c b/src/gui_gtk4_da.c
index 330706e86..5e4397ba8 100644
--- a/src/gui_gtk4_da.c
+++ b/src/gui_gtk4_da.c
@@ -420,38 +420,6 @@ count_cluster_cells(
     return cellcount;
 }
 
-/*
- * Handle combining characters that form a zero-width cluster.
- */
-    static void
-setup_zero_width_cluster(
-	PangoItem	*item,
-	PangoGlyphInfo	*glyph,
-	int		last_cellcount,
-	int		last_cluster_width,
-	int		last_glyph_rbearing)
-{
-    PangoRectangle  ink_rect;
-    PangoRectangle  logical_rect;
-    int		    width;
-
-    width = last_cellcount * gui.char_width * PANGO_SCALE;
-    glyph->geometry.x_offset = -width + MAX(0, width - last_cluster_width) / 2;
-    glyph->geometry.width = 0;
-
-    pango_font_get_glyph_extents(item->analysis.font,
-	    glyph->glyph,
-	    &ink_rect, &logical_rect);
-    if (ink_rect.x < 0)
-    {
-	glyph->geometry.x_offset += last_glyph_rbearing;
-	glyph->geometry.y_offset  = logical_rect.height
-	    - (gui.char_height - p_linespace) * PANGO_SCALE;
-    }
-    else
-	glyph->geometry.x_offset = -width + MAX(0, width - ink_rect.width) / 2;
-}
-
 #ifdef FEAT_IMAGE_GDK
     static void
 draw_image_free(DrawImage *dimg)
@@ -1238,7 +1206,6 @@ vim_draw_area_add_string(
     int			column_offset = 0;
     int			cluster_width;
     int			last_glyph_rbearing;
-    int			cells = 0;
     int			i = 0;
     gboolean		has_unicode = FALSE;
     gboolean		needs_shaping = FALSE;
@@ -1358,10 +1325,6 @@ vim_draw_area_add_string(
 	pango_shape_full((const char *)s + item->offset, item->length,
 		(const char *)s, len, &item->analysis, glyphs);
 
-	// Fixed-width hack: assign a fixed width to each glyph based on the
-	// number of cells it occupies, handling composing characters and
-	// cluster boundaries properly.
-	//
 	// At the end of each cluster, add it to the draw area.
 	for (i = 0; i < glyphs->num_glyphs; ++i)
 	{
@@ -1392,40 +1355,9 @@ vim_draw_area_add_string(
 		    current_cluster_cells = 0;
 		}
 
-		if (cellcount > 0)
-		{
-		    int width;
-
-		    width = cellcount * gui.char_width * PANGO_SCALE;
-		    glyph->geometry.x_offset +=
-			MAX(0, width - cluster_width) / 2;
-		    glyph->geometry.width = width;
-		}
-		else
-		    setup_zero_width_cluster(item, glyph, cells,
-			    cluster_width,
-			    last_glyph_rbearing);
-
 		item_cells += cellcount;
-		cells = cellcount;
 		current_cluster_cells += cellcount;
 	    }
-	    else if (i > 0)
-	    {
-		int width;
-
-		if (glyph->geometry.x_offset >= 0)
-		{
-		    glyphs->glyphs[i].geometry.width =
-			glyphs->glyphs[i - 1].geometry.width;
-		    glyphs->glyphs[i - 1].geometry.width = 0;
-		}
-		width = cells * gui.char_width * PANGO_SCALE;
-		glyph->geometry.x_offset +=
-		    MAX(0, width - cluster_width) / 2;
-	    }
-	    else
-		glyph->geometry.width = 0;
 
 
 	    if (!current_cluster_ink)

Also were you using the latest version of Vim? (you did not say)


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/21002/5248778761@github.com>

dezza

unread,
Aug 10, 2026, 11:56:29 PM (12 hours ago) Aug 10
to vim/vim, Subscribed
dezza left a comment (vim/vim#21002)

The version in issue is written from :version I will try patch tomorrow, thanks.

Not saying its not partly KDE Plasma font smoothing or other factors.

Yours look good. GNOME?


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/21002/5248792749@github.com>

Foxe Chen

unread,
12:05 AM (12 hours ago) 12:05 AM
to vim/vim, Subscribed
64-bitman left a comment (vim/vim#21002)

The version in issue is written from :version I will try patch after I slept, thanks.

Whoops missed that

Not saying its not partly KDE Plasma font smoothing or other factors - could be, but I doubt its the major factor.

Yours look good. GNOME?

I'm using the Sway Wayland compositor


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/21002/5248852823@github.com>

Reply all
Reply to author
Forward
0 new messages