summaryrefslogtreecommitdiff
path: root/gtk/gtkcssstyle.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2016-06-03 00:29:05 -0400
committerMatthias Clasen <mclasen@redhat.com>2016-06-03 00:30:29 -0400
commitdb50849d7918cc4337042e22b29ce13377e3d454 (patch)
tree87b0362089bc6de75b4ae8675c4fff2a4d6b8ffd /gtk/gtkcssstyle.c
parent7b0929ad388d26e7c24620c5b8e93f9401eb8859 (diff)
downloadgtk+-db50849d7918cc4337042e22b29ce13377e3d454.tar.gz
Add a function to get a font from a css style
Similar in spirit to gtk_style_context_get (ctx, state, "font", ...) but avoids the need for a style context. This will be used to for css-styled text rendering from css subnodes.
Diffstat (limited to 'gtk/gtkcssstyle.c')
-rw-r--r--gtk/gtkcssstyle.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gtk/gtkcssstyle.c b/gtk/gtkcssstyle.c
index f4a84a1e74..1d607d8367 100644
--- a/gtk/gtkcssstyle.c
+++ b/gtk/gtkcssstyle.c
@@ -264,3 +264,22 @@ gtk_css_style_get_pango_attributes (GtkCssStyle *style)
return attrs;
}
+
+static GtkCssValue *
+query_func (guint id,
+ gpointer values)
+{
+ return gtk_css_style_get_value (values, id);
+}
+
+PangoFontDescription *
+gtk_css_style_get_pango_font (GtkCssStyle *style)
+{
+ GtkStyleProperty *prop;
+ GValue value = { 0, };
+
+ prop = _gtk_style_property_lookup ("font");
+ _gtk_style_property_query (prop, &value, query_func, style);
+
+ return (PangoFontDescription *)g_value_get_boxed (&value);
+}