summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormattdangerw <mattdangerw@gmail.com>2014-02-07 11:55:46 -0800
committermattdangerw <mattdangerw@gmail.com>2014-02-07 11:55:46 -0800
commit797a69187303640cb27a41522cd2147487a7c712 (patch)
treef98fe66647e26f8ace3ac3423d962fcee07ca699
parent6fa77921058bd4a412c4153b8deb643f1666e191 (diff)
parent105762f30a12ede53bf5434d08e0cedbc9ac5529 (diff)
Merge pull request #555 from endlessm/issues/544
Fix font size CSS decimal point
-rw-r--r--endless/eoswindow.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/endless/eoswindow.c b/endless/eoswindow.c
index 57981e3..ce95ae8 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);