[gtk/gtk-3-24] Fix the build with older pango
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/gtk-3-24] Fix the build with older pango
- Date: Fri, 30 Oct 2020 02:24:07 +0000 (UTC)
commit 0f0dad24f4c07e18f797b252072ec243c97ededa
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Oct 29 22:22:33 2020 -0400
Fix the build with older pango
pango_font_family_get_face() was only introduced
in pango 1.46. Work around this for older releases.
gtk/gtkfontchooserwidget.c | 23 +++++++++++++++++++++--
1 file 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++)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]