summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChun-wei Fan <fanchunwei@src.gnome.org>2023-05-10 12:33:14 +0800
committerChun-wei Fan <fanchunwei@src.gnome.org>2023-05-10 23:02:51 +0800
commita31602144ff6fc05ff2a26e3c78d618896dc45e5 (patch)
tree7700365960363cd409e2b4caf2403851f135755e
parentda18d4197338d349b113330cf6208cc41f8ccf0e (diff)
downloadpango-a31602144ff6fc05ff2a26e3c78d618896dc45e5.tar.gz
pangocairo-win32font.c: Work around Cairo API becoming C++
Without adding a small C++ source file in order to include cairo-dwrite.h, where cairo_dwrite_font_face_create_for_dwrite_fontface() now resides and have thus become a C++ API, work around this by adding a wrapper prototype for our own purposes so that we can continue to call that function directly from C.
-rw-r--r--pango/pangocairo-win32font.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/pango/pangocairo-win32font.c b/pango/pangocairo-win32font.c
index 9d52dbcf..74dfeab1 100644
--- a/pango/pangocairo-win32font.c
+++ b/pango/pangocairo-win32font.c
@@ -32,6 +32,19 @@
#include <cairo-win32.h>
+#if defined (HAVE_CAIRO_WIN32_DIRECTWRITE) && \
+ ((CAIRO_VERSION_MAJOR > 1) || \
+ (CAIRO_VERSION_MAJOR == 1 && CAIRO_VERSION_MINOR > 17) || \
+ (CAIRO_VERSION_MAJOR == 1 && CAIRO_VERSION_MINOR == 17 && CAIRO_VERSION_MICRO > 6))
+/*
+ * We are using C here, so use a workaround as cairo-dwrite.h from 1.17.8
+ * can only be used in C++, which replaces the C-friendly version of
+ * cairo_dwrite_font_face_create_for_dwrite_fontface()
+ */
+extern cairo_font_face_t *
+cairo_dwrite_font_face_create_for_dwrite_fontface (void *dwrite_font_face);
+#endif
+
#define PANGO_TYPE_CAIRO_WIN32_FONT (pango_cairo_win32_font_get_type ())
#define PANGO_CAIRO_WIN32_FONT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_CAIRO_WIN32_FONT, PangoCairoWin32Font))
#define PANGO_CAIRO_WIN32_FONT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_CAIRO_WIN32_FONT, PangoCairoWin32FontClass))