From c4d5f673888f3ce6a93efd13ebf7333fcdadd118 Mon Sep 17 00:00:00 2001 From: Jehan Date: Fri, 15 Mar 2024 15:27:27 +0100 Subject: [PATCH] Issue #11048: simplify the previous fix. Though commit a14caafa8c was not wrong per-se, it's a bit too much. ;-) Functions like g_ascii_dtostr() already exists for this very purpose of converting a double/float to string in a locale-independent format. --- app/gui/themes.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/app/gui/themes.c b/app/gui/themes.c index 73cb6b1c4b..09d07fa078 100644 --- a/app/gui/themes.c +++ b/app/gui/themes.c @@ -493,20 +493,17 @@ themes_apply_theme (Gimp *gimp, if (! error && config->font_relative_size != 1.0) { - /* CSS does not like numbers with commas as the radix. - * To prevent, we create the string with a point used. */ - gchar *font_size_string = NULL; - gint font_size; - - font_size = config->font_relative_size * 100; - font_size_string = g_strdup_printf ("%d.%d", (font_size / 100), - font_size % 100); + /* Intermediate buffer for locale-independent float to string + * conversion. See issue #11048. + */ + gchar font_size_string[G_ASCII_DTOSTR_BUF_SIZE]; g_output_stream_printf (output, NULL, NULL, &error, "\n" "* { font-size: %srem; }", - font_size_string); - g_free (font_size_string); + g_ascii_dtostr (font_size_string, + G_ASCII_DTOSTR_BUF_SIZE, + config->font_relative_size)); } if (! error)