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.
This commit is contained in:
Jehan 2024-03-15 15:27:27 +01:00
parent b8a9a1e9e9
commit c4d5f67388
1 changed files with 7 additions and 10 deletions

View File

@ -493,20 +493,17 @@ themes_apply_theme (Gimp *gimp,
if (! error && config->font_relative_size != 1.0) if (! error && config->font_relative_size != 1.0)
{ {
/* CSS does not like numbers with commas as the radix. /* Intermediate buffer for locale-independent float to string
* To prevent, we create the string with a point used. */ * conversion. See issue #11048.
gchar *font_size_string = NULL; */
gint font_size; gchar font_size_string[G_ASCII_DTOSTR_BUF_SIZE];
font_size = config->font_relative_size * 100;
font_size_string = g_strdup_printf ("%d.%d", (font_size / 100),
font_size % 100);
g_output_stream_printf (output, NULL, NULL, &error, g_output_stream_printf (output, NULL, NULL, &error,
"\n" "\n"
"* { font-size: %srem; }", "* { font-size: %srem; }",
font_size_string); g_ascii_dtostr (font_size_string,
g_free (font_size_string); G_ASCII_DTOSTR_BUF_SIZE,
config->font_relative_size));
} }
if (! error) if (! error)