File gtk-use-multiple-font-family-values.patch of Package gtk3.15354
From f7b1e5b4689563963745258a3e7fe50885bef9d9 Mon Sep 17 00:00:00 2001
From: Matthias Clasen <mclasen@redhat.com>
Date: Fri, 3 May 2019 01:18:42 +0000
Subject: 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 dc67a64..4cb7ad8 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);
--
2.16.4
From 2dc620634aa2b2211f64eacfef6b77a2b33d6ef1 Mon Sep 17 00:00:00 2001
From: Matthias Clasen <mclasen@redhat.com>
Date: Fri, 3 May 2019 01:33:09 +0000
Subject: Add a reftest for multiple font families
This tests that listing multiple font
families in the css font-family property
works as expected.
---
testsuite/reftests/Makefile.am | 3 +++
testsuite/reftests/Makefile.in | 3 +++
testsuite/reftests/label-fonts.css | 3 +++
testsuite/reftests/label-fonts.ref.ui | 11 +++++++++++
testsuite/reftests/label-fonts.ui | 11 +++++++++++
5 files changed, 31 insertions(+)
create mode 100644 testsuite/reftests/label-fonts.css
create mode 100644 testsuite/reftests/label-fonts.ref.ui
create mode 100644 testsuite/reftests/label-fonts.ui
diff --git a/testsuite/reftests/Makefile.am b/testsuite/reftests/Makefile.am
index 969c995..dda89a6 100644
--- a/testsuite/reftests/Makefile.am
+++ b/testsuite/reftests/Makefile.am
@@ -321,6 +321,9 @@ testdata = \
label-ellipsize-small.ui \
label-ellipsize-with-big.ref.ui \
label-ellipsize-with-big.ui \
+ label-fonts.css \
+ label-fonts.ref.ui \
+ label-fonts.ui \
label-shadows.css \
label-shadows.ref.ui \
label-shadows.ui \
diff --git a/testsuite/reftests/Makefile.in b/testsuite/reftests/Makefile.in
index 189aecd..b44ca90 100644
--- a/testsuite/reftests/Makefile.in
+++ b/testsuite/reftests/Makefile.in
@@ -884,6 +884,9 @@ testdata = \
label-ellipsize-small.ui \
label-ellipsize-with-big.ref.ui \
label-ellipsize-with-big.ui \
+ label-fonts.css \
+ label-fonts.ref.ui \
+ label-fonts.ui \
label-shadows.css \
label-shadows.ref.ui \
label-shadows.ui \
diff --git a/testsuite/reftests/label-fonts.css b/testsuite/reftests/label-fonts.css
new file mode 100644
index 0000000..aa44add
--- /dev/null
+++ b/testsuite/reftests/label-fonts.css
@@ -0,0 +1,3 @@
+* {
+ font-family: nonexisting,Sans;
+}
diff --git a/testsuite/reftests/label-fonts.ref.ui b/testsuite/reftests/label-fonts.ref.ui
new file mode 100644
index 0000000..b00757e
--- /dev/null
+++ b/testsuite/reftests/label-fonts.ref.ui
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <object class="GtkWindow" id="window1">
+ <property name="type">popup</property>
+ <child>
+ <object class="GtkLabel" id="label3">
+ <property name="label" translatable="yes">abcdefg</property>
+ </object>
+ </child>
+ </object>
+</interface>
diff --git a/testsuite/reftests/label-fonts.ui b/testsuite/reftests/label-fonts.ui
new file mode 100644
index 0000000..b00757e
--- /dev/null
+++ b/testsuite/reftests/label-fonts.ui
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <object class="GtkWindow" id="window1">
+ <property name="type">popup</property>
+ <child>
+ <object class="GtkLabel" id="label3">
+ <property name="label" translatable="yes">abcdefg</property>
+ </object>
+ </child>
+ </object>
+</interface>
--
2.16.4