Source code

Revision control

Copy as Markdown

Other Tools

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Timothy Nikkel <tnikkel@gmail.com>
Date: Fri, 23 Oct 2026 12:00:00 -0700
Subject: [PATCH] Detect IDWriteFactory8 from the SDK headers.
dwrite-extra.hpp declares IDWriteFactory8 and DWRITE_PAINT_FEATURE_LEVEL
itself unless HAVE_IDWRITEFACTORY8 is defined, which upstream's Meson
build does after a compile test. The Gecko build doesn't, so with
headers that already declare them we'd redefine them.
---
diff --git a/src/win32/dwrite-extra.hpp b/src/win32/dwrite-extra.hpp
index f87fdec..a0eb497 100644
--- a/src/win32/dwrite-extra.hpp
+++ b/src/win32/dwrite-extra.hpp
@@ -5,6 +5,17 @@
#include <dwrite_3.h>
+/* Upstream's Meson build probes for IDWriteFactory8. Instead, detect it from
+ * the marker that SDK and mingw-w64 headers define along with it, under the
+ * same NTDDI_VERSION guard that the SDK puts around the declarations. */
+#if !defined(HAVE_IDWRITEFACTORY8) && \
+ defined(DWRITE_GLYPH_IMAGE_FORMATS_COLR_PAINT_TREE_DEFINED) && \
+ (defined(__MINGW32__) || \
+ (defined(NTDDI_WIN10_CU) ? NTDDI_VERSION >= NTDDI_WIN10_CU \
+ : NTDDI_VERSION >= NTDDI_WIN10_NI))
+#define HAVE_IDWRITEFACTORY8 1
+#endif
+
typedef enum DWRITE_GLYPH_IMAGE_FORMATS_ {
DWRITE_GLYPH_IMAGE_FORMATS_NONE_ = 0,
DWRITE_GLYPH_IMAGE_FORMATS_TRUETYPE_ = 1 << 0,
--
2.53.0