From 4f9ea5e54ba294bf33f6cca87bfeab917e38bb16 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 3 May 2019 01:18:42 +0000 Subject: [PATCH] css: Use multiple font-family values Pango API to support this, so we can implement this very easily. Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1854 --- gtk/gtkcssshorthandpropertyimpl.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/gtk/gtkcssshorthandpropertyimpl.c b/gtk/gtkcssshorthandpropertyimpl.c index dc67a64537..d46be8bd0d 100644 --- a/gtk/gtkcssshorthandpropertyimpl.c +++ b/gtk/gtkcssshorthandpropertyimpl.c @@ -1141,8 +1141,18 @@ pack_font_description (GtkCssShorthandProperty *shorthand, v = (* query_func) (_gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("font-family"))), query_data); if (v) { - /* xxx: Can we set all the families here somehow? */ - pango_font_description_set_family (description, _gtk_css_string_value_get (_gtk_css_array_value_get_nth (v, 0))); + int i; + GString *s = g_string_new (""); + + for (i = 0; i < _gtk_css_array_value_get_n_values (v); i++) + { + if (i > 0) + g_string_append (s, ","); + g_string_append (s, _gtk_css_string_value_get (_gtk_css_array_value_get_nth (v, i))); + } + + pango_font_description_set_family (description, s->str); + g_string_free (s, TRUE); } v = (* query_func) (_gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("-gtk-dpi"))), query_data);