[gtk+/gtk-3-0] gtksettings: unset attributes set to normal from font description



commit d2ef917821f2a18ac5f1cd2e3d1930d0498d01ba
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 d870b44..45f47fc 100644
--- a/gtk/gtksettings.c
+++ b/gtk/gtksettings.c
@@ -1341,6 +1341,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]