summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Ward <patrick@endlessm.com>2014-02-07 10:18:32 -0800
committerPatrick Ward <patrick@endlessm.com>2014-02-07 10:18:32 -0800
commit105762f30a12ede53bf5434d08e0cedbc9ac5529 (patch)
treef72e056e39ee25efd822f66900f380c8d61e2c82
parent9131ccb56266d770fbfaae71f1b43c0e69a3078f (diff)
Fix font size CSS decimal point
Changed the decimal point of the font size's CSS to always use a '.' so that the metric decimal point ',' is never used. This makes sure that GTK's CSS parser will always be able to parse the font-size CSS. [endlessm/eos-sdk#544]
-rw-r--r--endless/eoswindow.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/endless/eoswindow.c b/endless/eoswindow.c
index 0b280a3..cdf0fc7 100644
--- a/endless/eoswindow.c
+++ b/endless/eoswindow.c
@@ -69,7 +69,7 @@
#define BACKGROUND_FRAME_NAME_TEMPLATE "_eos-window-background-%d"
-#define FONT_SIZE_TEMPLATE "EosWindow { font-size: %fpx; }"
+#define FONT_SIZE_TEMPLATE "EosWindow { font-size: %spx; }"
#define TRANSPARENT_FRAME_CSS_PROPERTIES "{ background-image: none;\n" \
" background-color: transparent\n;" \
@@ -599,7 +599,15 @@ eos_window_size_allocate (GtkWidget *window, GtkAllocation *allocation)
GError *error = NULL;
- gchar *font_size_css = g_strdup_printf (FONT_SIZE_TEMPLATE, priv->font_scaling_calculated_font_size);
+ /* A float will only have one decimal point when printed as a string.
+ * The decimal point can be represented as a comma or period when using
+ * either Imperial or metric units. However, the CSS parser only recognizes
+ * periods as valid decimal points. Therefore, we convert the float to a
+ * string using a period as the decimal point. */
+ gchar font_size_float_str [G_ASCII_DTOSTR_BUF_SIZE];
+ g_ascii_dtostr (font_size_float_str, G_ASCII_DTOSTR_BUF_SIZE, priv->font_scaling_calculated_font_size);
+
+ gchar *font_size_css = g_strdup_printf (FONT_SIZE_TEMPLATE, font_size_float_str);
GdkScreen *screen = gdk_screen_get_default ();
gtk_style_context_remove_provider_for_screen (screen, provider);