gui: Prevent localization issues with font-size
CSS breaks when given a number with a comma as the radix instead of a decimal. Depending on the system localization, printf () may return numbers in this format when resizing the font. This causes the theme to break unless font size is set to 100. To prevent this issue, we create the font size string manually using integer division and mod operations.
This commit is contained in:
parent
7e58a00a74
commit
a14caafa8c
1 changed files with 16 additions and 4 deletions
|
|
@ -492,10 +492,22 @@ themes_apply_theme (Gimp *gimp,
|
|||
}
|
||||
|
||||
if (! error && config->font_relative_size != 1.0)
|
||||
g_output_stream_printf (output, NULL, NULL, &error,
|
||||
"\n"
|
||||
"* { font-size: %frem; }",
|
||||
config->font_relative_size);
|
||||
{
|
||||
/* 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);
|
||||
|
||||
g_output_stream_printf (output, NULL, NULL, &error,
|
||||
"\n"
|
||||
"* { font-size: %srem; }",
|
||||
font_size_string);
|
||||
g_free (font_size_string);
|
||||
}
|
||||
|
||||
if (! error)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue