diff --git a/docs/harfbuzz-docs.xml b/docs/harfbuzz-docs.xml index 738356b8c..cc6c989a1 100644 --- a/docs/harfbuzz-docs.xml +++ b/docs/harfbuzz-docs.xml @@ -56,6 +56,7 @@ + diff --git a/docs/harfbuzz-sections.txt b/docs/harfbuzz-sections.txt index 930cf5479..254e809b7 100644 --- a/docs/harfbuzz-sections.txt +++ b/docs/harfbuzz-sections.txt @@ -166,16 +166,6 @@ HB_TAG_MAX_SIGNED HB_LANGUAGE_INVALID HB_FEATURE_GLOBAL_END HB_FEATURE_GLOBAL_START -HB_HAS_CAIRO -HB_HAS_CORETEXT -HB_HAS_DIRECTWRITE -HB_HAS_FREETYPE -HB_HAS_GDI -HB_HAS_GLIB -HB_HAS_GOBJECT -HB_HAS_GRAPHITE -HB_HAS_ICU -HB_HAS_UNISCRIBE HB_BEGIN_DECLS HB_END_DECLS @@ -194,6 +184,20 @@ HB_DEPRECATED HB_DEPRECATED_FOR +
+hb-features +HB_HAS_CAIRO +HB_HAS_CORETEXT +HB_HAS_DIRECTWRITE +HB_HAS_FREETYPE +HB_HAS_GDI +HB_HAS_GLIB +HB_HAS_GOBJECT +HB_HAS_GRAPHITE +HB_HAS_ICU +HB_HAS_UNISCRIBE +
+
hb-draw hb_draw_funcs_create diff --git a/docs/meson.build b/docs/meson.build index 1fd75cf56..e0b0e36ec 100644 --- a/docs/meson.build +++ b/docs/meson.build @@ -36,6 +36,7 @@ html_images = [ ] ignore_headers = [ + 'hb-features.h', 'hb-gobject.h', 'hb-gobject-enums.h', 'hb-gobject-enums-tmp.h', diff --git a/src/hb-features.h.in b/src/hb-features.h.in index da67f772f..d85749ca9 100644 --- a/src/hb-features.h.in +++ b/src/hb-features.h.in @@ -27,6 +27,14 @@ HB_BEGIN_DECLS +/** + * SECTION: hb-features + * @title: hb-features + * @short_description: Feature detection + * @include: hb-features.h + * + * Macros for detecting optional HarfBuzz features at build time. + **/ /** * HB_HAS_CAIRO: diff --git a/src/meson.build b/src/meson.build index 6b87601c8..a32b21e73 100644 --- a/src/meson.build +++ b/src/meson.build @@ -422,24 +422,16 @@ harfbuzz_deps = [thread_dep, m_dep] + harfbuzz_extra_deps libharfbuzz_link_language = 'c' -hb_features = configuration_data() - if conf.get('HAVE_FREETYPE', 0) == 1 hb_sources += hb_ft_sources hb_headers += hb_ft_headers harfbuzz_deps += [freetype_dep] - hb_features.set('HB_HAS_FREETYPE', 1) endif if conf.get('HAVE_GLIB', 0) == 1 hb_sources += hb_glib_sources hb_headers += hb_glib_headers harfbuzz_deps += [glib_dep] - hb_features.set('HB_HAS_GLIB', 1) -endif - -if conf.get('HAVE_GOBJECT', 0) == 1 - hb_features.set('HB_HAS_GOBJECT', 1) endif # We set those here to not include the sources below that are of no use to @@ -451,20 +443,17 @@ if conf.get('HAVE_GDI', 0) == 1 hb_sources += hb_gdi_sources hb_headers += hb_gdi_headers harfbuzz_deps += gdi_uniscribe_deps - hb_features.set('HB_HAS_GDI', 1) endif if conf.get('HAVE_GRAPHITE2', 0) == 1 hb_sources += hb_graphite2_sources hb_headers += hb_graphite2_headers harfbuzz_deps += [graphite2_dep, graphite_dep] - hb_features.set('HB_HAS_GRAPHITE', 1) endif if conf.get('HAVE_UNISCRIBE', 0) == 1 hb_sources += hb_uniscribe_sources hb_headers += hb_uniscribe_headers - hb_features.set('HB_HAS_UNISCRIBE', 1) endif if conf.get('HAVE_DIRECTWRITE', 0) == 1 @@ -472,36 +461,58 @@ if conf.get('HAVE_DIRECTWRITE', 0) == 1 hb_headers += hb_directwrite_headers # hb-directwrite needs a C++ linker libharfbuzz_link_language = 'cpp' - hb_features.set('HB_HAS_DIRECTWRITE', 1) endif if conf.get('HAVE_CORETEXT', 0) == 1 hb_sources += hb_coretext_sources hb_headers += hb_coretext_headers harfbuzz_deps += coretext_deps - hb_features.set('HB_HAS_CORETEXT', 1) endif have_icu = conf.get('HAVE_ICU', 0) == 1 have_icu_builtin = conf.get('HAVE_ICU_BUILTIN', 0) == 1 - if have_icu and have_icu_builtin hb_sources += hb_icu_sources hb_headers += hb_icu_headers harfbuzz_deps += [icu_dep] - hb_features.set('HB_HAS_ICU', 1) endif -if conf.get('HAVE_CAIRO', 0) == 1 - hb_features.set('HB_HAS_CAIRO', 1) -endif +features = [ + 'CAIRO', + 'CORETEXT', + 'DIRECTWRITE', + 'FREETYPE', + 'GDI', + 'GLIB', + 'GOBJECT', + 'GRAPHITE', + 'ICU', + 'UNISCRIBE', +] +hb_enabled_features = configuration_data() +hb_supported_features = configuration_data() +foreach feature : features + key = 'HB_HAS_@0@'.format(feature) + hb_enabled_features.set(key, conf.get('HAVE_@0@'.format(feature), false)) + hb_supported_features.set(key, 1) +endforeach + +# The enabled features. This file is installed. hb_features_h = configure_file(input: 'hb-features.h.in', output: 'hb-features.h', - configuration: hb_features, + configuration: hb_enabled_features, install: true, install_dir: get_option('includedir') / meson.project_name()) +# This file is generated to convince gtk-doc to generate documentation for all +# HB_HAS_* macros, whether they are enabled for the current build or not. +# This file should not be installed. +hb_supported_features_h = configure_file(input: 'hb-features.h.in', + output: 'hb-supported-features.h', + configuration: hb_supported_features, + install: false) + # Base and default-included sources and headers # harfbuzz