static gboolean font_description_value_parse (GtkCssParser *parser, GFile *base, GValue *value) { PangoFontDescription *font_desc; char *str; str = _gtk_css_parser_read_value (parser); if (str == NULL) return FALSE; font_desc = pango_font_description_from_string (str); g_free (str); g_value_take_boxed (value, font_desc); return TRUE; }
static GtkCssValue * gtk_css_custom_property_parse_value (GtkStyleProperty *property, GtkCssParser *parser) { GtkCssCustomProperty *custom = GTK_CSS_CUSTOM_PROPERTY (property); GValue value = G_VALUE_INIT; gboolean success; if (custom->property_parse_func) { GError *error = NULL; char *value_str; g_value_init (&value, _gtk_style_property_get_value_type (property)); value_str = _gtk_css_parser_read_value (parser); if (value_str != NULL) { success = (* custom->property_parse_func) (value_str, &value, &error); g_free (value_str); } else success = FALSE; } else { g_value_init (&value, gtk_css_custom_property_get_specified_type (custom->pspec)); success = _gtk_css_style_parse_value (&value, parser); } if (!success) { g_value_unset (&value); return NULL; } return _gtk_css_typed_value_new_take (&value); }
static gboolean font_description_value_parse (GtkCssParser *parser, GValue *value) { PangoFontDescription *font_desc; guint mask; char *str; str = _gtk_css_parser_read_value (parser); if (str == NULL) 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; }
static gboolean animation_description_value_parse (GtkCssParser *parser, GFile *base, GValue *value) { GtkAnimationDescription *desc; char *str; str = _gtk_css_parser_read_value (parser); if (str == NULL) return FALSE; desc = _gtk_animation_description_from_string (str); g_free (str); if (desc == NULL) { _gtk_css_parser_error (parser, "Invalid animation description"); return FALSE; } g_value_take_boxed (value, desc); return TRUE; }