[gtk/fix-4565: 1/2] gtkfontchooserwidget.c: Fix build with pre-1.44.x Pango




commit b0e3d0383199d322ad0175609cd215ace969315d
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Thu Dec 30 15:26:44 2021 +0800

    gtkfontchooserwidget.c: Fix build with pre-1.44.x Pango
    
    Pango headers after 1.44.0 include hb.h automatically, but not before, so
    re-structure the #if/#elif/#else checks for the availability of HarfBuzz 2.2.0
    or later.
    
    Pointed out in issue #4565.

 gtk/gtkfontchooserwidget.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
---
diff --git a/gtk/gtkfontchooserwidget.c b/gtk/gtkfontchooserwidget.c
index b4b8952cb1..8eb5b2ecde 100644
--- a/gtk/gtkfontchooserwidget.c
+++ b/gtk/gtkfontchooserwidget.c
@@ -53,12 +53,13 @@
 #include "gtkcombobox.h"
 #include "gtkgesturemultipress.h"
 
-#if (PANGO_VERSION_CHECK(1,44,0) && HB_VERSION_ATLEAST(2,2,0)) || \
-    (defined(HAVE_HARFBUZZ) && defined(HAVE_PANGOFT))
-#define HAVE_FONT_FEATURES 1
-#if !(PANGO_VERSION_CHECK(1,44,0) && HB_VERSION_ATLEAST(2,2,0))
-#define FONT_FEATURES_USE_PANGOFT2 1
-#endif
+#if !PANGO_VERSION_CHECK(1,44,0)
+# if (defined(HAVE_HARFBUZZ) && defined(HAVE_PANGOFT))
+#  define HAVE_FONT_FEATURES 1
+#  define FONT_FEATURES_USE_PANGOFT2 1
+# endif
+#elif HB_VERSION_ATLEAST(2,2,0)
+# define HAVE_FONT_FEATURES 1
 #endif
 
 #ifdef FONT_FEATURES_USE_PANGOFT2
@@ -2392,7 +2393,7 @@ gtk_font_chooser_widget_update_font_features (GtkFontChooserWidget *fontchooser)
   pango_font = pango_context_load_font (gtk_widget_get_pango_context (GTK_WIDGET (fontchooser)),
                                         priv->font_desc);
 
-#ifdef FONT_FEATURE_USE_PANGOFT2
+#ifdef FONT_FEATURES_USE_PANGOFT2
   if (PANGO_IS_FC_FONT (pango_font))
     {
       ft_face = pango_fc_font_lock_face (PANGO_FC_FONT (pango_font)),
@@ -2470,7 +2471,7 @@ gtk_font_chooser_widget_update_font_features (GtkFontChooserWidget *fontchooser)
         hb_face_destroy (hb_face);
     }
 
-#if FONT_FEATURE_USE_PANGOFT2
+#if FONT_FEATURES_USE_PANGOFT2
   if (PANGO_IS_FC_FONT (pango_font))
     pango_fc_font_unlock_face (PANGO_FC_FONT (pango_font));
 #endif


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]