[gtk+] gtksettings: unset attributes set to normal from font description



commit 24bba4cc56db7a75569063a0bdc09bffb0e21da5
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Tue Mar 22 14:51:06 2011 -0400

    gtksettings: unset attributes set to normal from font description
    
    So that they do not override values coming from the theme.
    
    Based on a patch by Carlos Garnacho.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=645458

 gtk/gtksettings.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtksettings.c b/gtk/gtksettings.c
index 3a83440..2599607 100644
--- a/gtk/gtksettings.c
+++ b/gtk/gtksettings.c
@@ -1345,6 +1345,24 @@ gtk_settings_get_style (GtkStyleProvider *provider,
 
   font_desc = pango_font_description_from_string (font_name);
 
+  /* Unset normal attributes from this description,
+   * so they do not override theme values */
+  if (pango_font_description_get_weight (font_desc) == PANGO_WEIGHT_NORMAL)
+    pango_font_description_unset_fields (font_desc,
+                                         PANGO_FONT_MASK_WEIGHT);
+
+  if (pango_font_description_get_stretch (font_desc) == PANGO_STRETCH_NORMAL)
+    pango_font_description_unset_fields (font_desc,
+                                         PANGO_FONT_MASK_STRETCH);
+
+  if (pango_font_description_get_variant (font_desc) == PANGO_VARIANT_NORMAL)
+    pango_font_description_unset_fields (font_desc,
+                                         PANGO_FONT_MASK_VARIANT);
+
+  if (pango_font_description_get_style (font_desc) == PANGO_STYLE_NORMAL)
+    pango_font_description_unset_fields (font_desc,
+                                         PANGO_FONT_MASK_STYLE);
+
   gtk_style_properties_set (props, 0,
                             "font", font_desc,
                             NULL);



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