summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-10-29 22:22:33 -0400
committerMatthias Clasen <mclasen@redhat.com>2020-10-29 22:22:33 -0400
commit0f0dad24f4c07e18f797b252072ec243c97ededa (patch)
tree0478d4eb7fe5597079418c1233bbedafc2bf1853
parent9536d3aeaa7c0e3dca4abbda735453750193d696 (diff)
downloadgtk+-0f0dad24f4c07e18f797b252072ec243c97ededa.tar.gz
Fix the build with older pango
pango_font_family_get_face() was only introduced in pango 1.46. Work around this for older releases.
-rw-r--r--gtk/gtkfontchooserwidget.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/gtk/gtkfontchooserwidget.c b/gtk/gtkfontchooserwidget.c
index 70de067d96..ed52352d7a 100644
--- a/gtk/gtkfontchooserwidget.c
+++ b/gtk/gtkfontchooserwidget.c
@@ -942,8 +942,6 @@ gtk_font_chooser_widget_load_fonts (GtkFontChooserWidget *fontchooser,
for (i = 0; i < n_families; i++)
{
GtkTreeIter iter;
- PangoFontFace **faces;
- int j, n_faces;
const gchar *fam_name = pango_font_family_get_name (families[i]);
if ((priv->level & GTK_FONT_CHOOSER_LEVEL_STYLE) == 0)
@@ -951,7 +949,25 @@ gtk_font_chooser_widget_load_fonts (GtkFontChooserWidget *fontchooser,
GtkDelayedFontDescription *desc;
PangoFontFace *face;
+#if PANGO_VERSION_CHECK(1,46,0)
face = pango_font_family_get_face (families[i], NULL);
+#else
+ {
+ PangoFontFace **faces;
+ int j, n_faces;
+ pango_font_family_list_faces (families[i], &faces, &n_faces);
+ face = faces[0];
+ for (j = 0; j < n_faces; j++)
+ {
+ if (strcmp (pango_font_face_get_face_name (faces[j]), "Regular") == 0)
+ {
+ face = faces[j];
+ break;
+ }
+ }
+ g_free (faces);
+ }
+#endif
desc = gtk_delayed_font_description_new (face);
gtk_list_store_insert_with_values (list_store, &iter, -1,
@@ -965,6 +981,9 @@ gtk_font_chooser_widget_load_fonts (GtkFontChooserWidget *fontchooser,
}
else
{
+ PangoFontFace **faces;
+ int j, n_faces;
+
pango_font_family_list_faces (families[i], &faces, &n_faces);
for (j = 0; j < n_faces; j++)