diff --git a/meson.build b/meson.build index 2dd408d40..cf09477f7 100644 --- a/meson.build +++ b/meson.build @@ -146,6 +146,27 @@ if host_machine.system() == 'windows' and not get_option('directwrite').disabled endif endif +# CoreText (macOS) - FIXME: untested +if host_machine.system() == 'darwin' and not get_option('coretext').disabled() + app_services_dep = dependency('appleframeworks', modules : ['ApplicationServices'], required: false) + if cpp.has_type('CTFontRef', prefix: '#include ', dependencies: app_services_dep) + deps += [app_services_dep] + conf.set('HAVE_CORETEXT', 1) + # On iOS CoreText and CoreGraphics are stand-alone frameworks + # Check for a different symbol to avoid getting cached result + else + coretext_dep = dependency('appleframeworks', modules : ['CoreText'], required: false) + coregraphics_dep = dependency('appleframeworks', modules : ['CoreGraphics'], required: false) + corefoundation_dep = dependency('appleframeworks', modules : ['CoreFoundation'], required: false) + if cpp.has_type('CTRunRef', prefix: '#include ', dependencies: [coretext_dep, coregraphics_dep, corefoundation_dep]) + deps += [coretext_dep, coregraphics_dep, corefoundation_dep] + conf.set('HAVE_CORETEXT', 1) + elif get_option('coretext').enabled() + error('CoreText was enabled explicitly, but required headers or frameworks are missing.') + endif + endif +endif + # threads if host_machine.system() != 'windows' thread_dep = dependency('threads', required: false) diff --git a/meson_options.txt b/meson_options.txt index 817a438f0..4c46b8e0f 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -19,6 +19,8 @@ option('uniscribe', type: 'feature', value: 'disabled', description: 'Enable Uniscribe shaper backend (Windows only)') option('directwrite', type: 'feature', value: 'disabled', description: 'Enable DirectWrite shaper backend on Windows (experimental)') +option('coretext', type: 'feature', value: 'disabled', + description: 'Enable CoreText shaper backend on macOS') # Common feature options #option('tests', type : 'feature', value : 'auto', yield : true, diff --git a/src/meson.build b/src/meson.build index b7f603877..6c41b72a1 100644 --- a/src/meson.build +++ b/src/meson.build @@ -104,10 +104,6 @@ hb_graphite2_headers = [ 'hb-graphite2.h', ] -hb_coretext_sources = [ - 'hb-coretext.cc', -] - hb_icu_sources = [ 'hb-icu.cc', ] @@ -181,6 +177,11 @@ if conf.get('HAVE_DIRECTWRITE', 0) == 1 hb_headers += ['hb-directwrite.h'] endif +if conf.get('HAVE_CORETEXT', 0) == 1 + hb_sources += ['hb-coretext.cc'] + hb_headers += ['hb-coretext.h'] +endif + version = '0.' + '0'.join(meson.project_version().split('.')) + '.0' libharfbuzz = library('harfbuzz', hb_sources,