demos/gtk-demo/font_features.c: Fix build on Pango < 1.44.x

The Pango headers prior to 1.44.0 do not include the HarfBuzz headers, so we
need to re-structure how we check for HarfBuzz 2.2.0 or later if we have Pango
1.44.x or later.

Fixes issue #4565.
This commit is contained in:
Chun-wei Fan 2021-12-30 15:33:14 +08:00
parent b0e3d03831
commit bec88ded5f

View File

@ -10,8 +10,12 @@
#include <gtk/gtk.h>
#if !(PANGO_VERSION_CHECK(1,44,0) && HB_VERSION_ATLEAST(2,2,0))
#define FONT_FEATURES_USE_PANGOFT2 1
#if PANGO_VERSION_CHECK(1,44,0)
# if !HB_VERSION_ATLEAST(2,2,0)
# define FONT_FEATURES_USE_PANGOFT2 1
# endif
#else
# define FONT_FEATURES_USE_PANGOFT2 1
#endif
#ifdef FONT_FEATURES_USE_PANGOFT2
@ -231,7 +235,7 @@ update_script_combo (void)
pango_font = get_pango_font ();
#ifdef FONT_FEATURES_USE_PANGOFT2
if (PANGO_IS_FC_FONT (pango_font)
if (PANGO_IS_FC_FONT (pango_font))
{
ft_face = pango_fc_font_lock_face (PANGO_FC_FONT (pango_font)),
hb_font = hb_ft_font_create (ft_face, NULL);
@ -291,7 +295,7 @@ update_script_combo (void)
}
#ifdef FONT_FEATURES_USE_PANGOFT2
if (PANGO_IS_FC_FONT (pango_font)
if (PANGO_IS_FC_FONT (pango_font))
pango_fc_font_unlock_face (PANGO_FC_FONT (pango_font));
#endif
@ -397,7 +401,7 @@ update_features (void)
pango_font = get_pango_font ();
#ifdef FONT_FEATURES_USE_PANGOFT2
if (PANGO_IS_FC_FONT (pango_font)
if (PANGO_IS_FC_FONT (pango_font))
{
ft_face = pango_fc_font_lock_face (PANGO_FC_FONT (pango_font)),
hb_font = hb_ft_font_create (ft_face, NULL);
@ -442,7 +446,7 @@ update_features (void)
}
#ifdef FONT_FEATURES_USE_PANGOFT2
if (PANGO_IS_FC_FONT (pango_font)
if (PANGO_IS_FC_FONT (pango_font))
pango_fc_font_unlock_face (PANGO_FC_FONT (pango_font));
#endif