[gtk/wip/baedert/css-values: 9/11] cssstyle: set font variations in get_pango_font()



commit 16ae695a6bce2bd664e96f973c5abc590a1844a2
Author: Timm Bäder <mail baedert org>
Date:   Thu Jan 16 11:33:12 2020 +0100

    cssstyle: set font variations in get_pango_font()
    
    Doesn't make sense to set all the css values on the font description in
    there except for the font variations, so do these here as well.

 gtk/gtkcssstyle.c | 8 +++++++-
 gtk/gtkwidget.c   | 9 ---------
 2 files changed, 7 insertions(+), 10 deletions(-)
---
diff --git a/gtk/gtkcssstyle.c b/gtk/gtkcssstyle.c
index eb699ad1d1..5c39550f3f 100644
--- a/gtk/gtkcssstyle.c
+++ b/gtk/gtkcssstyle.c
@@ -31,7 +31,7 @@
 #include "gtkcsscolorvalueprivate.h"
 #include "gtkcssshorthandpropertyprivate.h"
 #include "gtkcssstringvalueprivate.h"
-#include "gtkcssfontsizevalueprivate.h"
+#include "gtkcssfontvariationsvalueprivate.h"
 #include "gtkcssfontfeaturesvalueprivate.h"
 #include "gtkcssstylepropertyprivate.h"
 #include "gtkcsstransitionprivate.h"
@@ -421,6 +421,7 @@ gtk_css_style_get_pango_font (GtkCssStyle *style)
 {
   PangoFontDescription *description;
   GtkCssValue *v;
+  char *str;
 
   description = pango_font_description_new ();
 
@@ -458,5 +459,10 @@ gtk_css_style_get_pango_font (GtkCssStyle *style)
   v = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_FONT_STRETCH);
   pango_font_description_set_stretch (description, _gtk_css_font_stretch_value_get (v));
 
+  v = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_FONT_VARIATION_SETTINGS);
+  str = gtk_css_font_variations_value_get_variations (v);
+  pango_font_description_set_variations (description, str);
+  g_free (str);
+
   return description;
 }
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index d68b5dd79b..77c8107f22 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -6587,20 +6587,11 @@ update_pango_context (GtkWidget    *widget,
   PangoFontDescription *font_desc;
   GtkSettings *settings;
   cairo_font_options_t *font_options;
-  GtkCssValue *value;
-  char *variations;
 
   font_desc = gtk_css_style_get_pango_font (style);
-
-  value = _gtk_style_context_peek_property (_gtk_widget_get_style_context (widget), 
GTK_CSS_PROPERTY_FONT_VARIATION_SETTINGS);
-  variations = gtk_css_font_variations_value_get_variations (value);
-
-  pango_font_description_set_variations (font_desc, variations);
-
   pango_context_set_font_description (context, font_desc);
 
   pango_font_description_free (font_desc);
-  g_free (variations);
 
   pango_context_set_base_dir (context,
                              _gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR ?


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