]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0532: GTK: preedit font size is wrong for fractional point sizes v9.2.0532
authorMuraoka Taro <koron.kaoriya@gmail.com>
Mon, 25 May 2026 15:26:08 +0000 (15:26 +0000)
committerChristian Brabandt <cb@256bit.org>
Mon, 25 May 2026 15:26:08 +0000 (15:26 +0000)
Problem:  GTK: preedit font size is wrong for fractional point sizes
Solution: Compute the font size as a double and round to the nearest
          integer (Muraoka Taro).

closes: #20316

Co-authored-by: Christian Brabandt <cb@256bit.org>
Signed-off-by: Muraoka Taro <koron.kaoriya@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/gui_xim.c
src/version.c

index a04667e2dc65b3c5d7c7090ff0e423fdc9dee4ff..0700ce41a540ff7aa2d56639b33259327601ed03 100644 (file)
@@ -474,8 +474,10 @@ im_preedit_window_open(void)
        gchar              *css = NULL;
        const char * const fontname
                           = pango_font_description_get_family(gui.norm_font);
-       gint    fontsize
-               = pango_font_description_get_size(gui.norm_font) / PANGO_SCALE;
+       // Since font sizes can be specified as non-integer values like 10.5,
+       // they must be handled as floating-point (gdouble).
+       gdouble fontsize
+               = (gdouble)pango_font_description_get_size(gui.norm_font) / PANGO_SCALE;
        gchar   *fontsize_propval = NULL;
 
        if (!pango_font_description_get_size_is_absolute(gui.norm_font))
@@ -488,7 +490,7 @@ im_preedit_window_open(void)
            fontsize = dpi * fontsize / 72;
        }
        if (fontsize > 0)
-           fontsize_propval = g_strdup_printf("%dpx", fontsize);
+           fontsize_propval = g_strdup_printf("%dpx", (gint)(fontsize + 0.5));
        else
            fontsize_propval = g_strdup_printf("inherit");
 
index 4db22e069b618e5ee15eae792bd8388044b6aa18..69f0ef22b8c28fb2a11d9a3308b4a17a362d7699 100644 (file)
@@ -729,6 +729,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    532,
 /**/
     531,
 /**/