[gtk+/gtk-style-context] GtkStyleProperties: Merge font descriptions on merge()



commit 107a885d015477c4cbed3f993872a5f7cf73566f
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Nov 3 11:36:18 2010 +0100

    GtkStyleProperties: Merge font descriptions on merge()
    
    This is necessary so incomplete font descriptions are ensured to have
    family and size.

 gtk/gtkstyleproperties.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkstyleproperties.c b/gtk/gtkstyleproperties.c
index df8529b..2c3a955 100644
--- a/gtk/gtkstyleproperties.c
+++ b/gtk/gtkstyleproperties.c
@@ -1059,7 +1059,19 @@ gtk_style_properties_merge (GtkStyleProperties       *props,
           data = &g_array_index (prop_to_merge->values, ValueData, i);
           value = property_data_get_value (prop, data->state);
 
-          if (replace || !G_IS_VALUE (value))
+          if (G_VALUE_TYPE (&data->value) == PANGO_TYPE_FONT_DESCRIPTION &&
+              G_IS_VALUE (value))
+            {
+              PangoFontDescription *font_desc;
+              PangoFontDescription *font_desc_to_merge;
+
+              /* Handle merging of font descriptions */
+              font_desc = g_value_get_boxed (value);
+              font_desc_to_merge = g_value_get_boxed (&data->value);
+
+              pango_font_description_merge (font_desc, font_desc_to_merge, replace);
+            }
+          else if (replace || !G_IS_VALUE (value))
             {
               if (!G_IS_VALUE (value))
                 g_value_init (value, G_VALUE_TYPE (&data->value));



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