[pango/pango1-dwrite: 2/3] build: Check for DirectWrite support




commit fafec83b3fe61a5089b735cd1c863f50fe26a112
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Wed Jul 6 16:58:41 2022 +0800

    build: Check for DirectWrite support
    
    ...in Cairo and HarfBuzz.  They must be present before we can try to use
    DirectWrite and its GDI interop features in the code.
    
    Since upstream Cairo gained DirectWrite support very recently, check for
    it only via pkg-config, since Cairo had Meson build support quite a bit before
    that happened.

 meson.build | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
---
diff --git a/meson.build b/meson.build
index fe2f9d47c..d3e69ed9a 100644
--- a/meson.build
+++ b/meson.build
@@ -46,6 +46,7 @@ osx_current = pango_binary_age - pango_interface_age + 1
 pango_osxversion = [osx_current, '@0@.@1@.0'.format(osx_current, pango_interface_age)]
 
 cc = meson.get_compiler('c')
+cpp = meson.get_compiler('cpp')
 host_system = host_machine.system()
 
 # Compiler and linker flags
@@ -393,6 +394,11 @@ cairo_dep = dependency('cairo', version: cairo_req_version, required: cairo_opti
 
 if cairo_dep.found()
   cairo_found_type = cairo_dep.type_name()
+  if host_system == 'windows'
+    cairo_dwrite_dep = dependency('cairo-win32-dwrite-font', version: cairo_req_version, required: false)
+  else
+    cairo_dwrite_dep = disabler()
+  endif
 else
   if cc.get_id() == 'msvc' and cc.has_header('cairo.h')
     cairo_dep = cc.find_library('cairo', required: cairo_option)
@@ -566,6 +572,24 @@ if cairo_dep.found()
   endif
 endif
 
+enable_dwrite_support = false
+if cairo_dwrite_dep.found()
+  if harfbuzz_dep.type_name() != 'internal'
+    enable_dwrite_support = cpp.has_header_symbol(
+      'hb-directwrite.h',
+      'hb_directwrite_face_create',
+      dependencies: harfbuzz_dep,
+      prefix: '#include <dwrite.h>',
+    )
+  else
+    enable_dwrite_support = true
+  endif
+endif
+
+if enable_dwrite_support
+  pango_conf.set('HAVE_DIRECTWRITE', 1)
+endif
+
 # libsysprof-capture support
 libsysprof_capture_dep = dependency('sysprof-capture-4',
   required: get_option('sysprof'),


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