[gtk+] css: Ensure that font shorthand parsing sets font name and size



commit 72bc10a61cdb4a5ccea250446d54ecb55afe3c47
Author: Benjamin Otte <otte redhat com>
Date:   Thu Jul 21 02:40:06 2011 +0200

    css: Ensure that font shorthand parsing sets font name and size

 gtk/gtkstyleproperty.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkstyleproperty.c b/gtk/gtkstyleproperty.c
index ea2707e..89e7817 100644
--- a/gtk/gtkstyleproperty.c
+++ b/gtk/gtkstyleproperty.c
@@ -302,6 +302,7 @@ font_description_value_parse (GtkCssParser *parser,
                               GValue       *value)
 {
   PangoFontDescription *font_desc;
+  guint mask;
   char *str;
 
   str = _gtk_css_parser_read_value (parser);
@@ -309,6 +310,13 @@ font_description_value_parse (GtkCssParser *parser,
     return FALSE;
 
   font_desc = pango_font_description_from_string (str);
+  mask = pango_font_description_get_set_fields (font_desc);
+  /* These values are not really correct,
+   * but the fields must be set, so we set them to something */
+  if ((mask & PANGO_FONT_MASK_FAMILY) == 0)
+    pango_font_description_set_family_static (font_desc, "Sans");
+  if ((mask & PANGO_FONT_MASK_SIZE) == 0)
+    pango_font_description_set_size (font_desc, 10 * PANGO_SCALE);
   g_free (str);
   g_value_take_boxed (value, font_desc);
   return TRUE;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]