diff --git a/docs/depend-api.md b/docs/depend-api.md index 46e693a39..fd52579f1 100644 --- a/docs/depend-api.md +++ b/docs/depend-api.md @@ -21,6 +21,44 @@ The dependency graph enables finding the transitive closure of all glyphs reachable from a given input set, which is useful for font subsetting, analyzing glyph coverage, and optimizing font delivery. +# Building with the Depend API + +The dependency API is optional and controlled by the `depend_api` build option. +**This is a highly experimental feature and disabled by default.** + +## Enabling the depend_api option + +```bash +meson setup build -Ddepend_api=true +meson compile -C build +``` + +In code, check for availability: + +```c +#ifdef HB_DEPEND_API + // Use dependency API +#endif +``` + +## Discovering available options + +To see all available HarfBuzz build options, including `depend_api`: + +```bash +# After setting up a build directory +meson configure build + +# Or to see just the option values +meson introspect build --buildoptions | jq '.[] | select(.section == "user")' +``` + +You can also view all available options in the source file `meson_options.txt`. + +**Important:** This API is experimental and may change without notice. Do not +use in production applications without being prepared for breaking changes in +future HarfBuzz releases. + # Usage ## Basic Example @@ -324,28 +362,6 @@ Each dependency entry returned by `hb_depend_get_glyph_entry()` contains: over-approximation (a known limitation of the static dependency analysis). Closure implementations can use these flags to report which type of over-approximation occurred. -## Compilation - -The dependency API is optional and controlled by the `depend_api` build option. -**This is a highly experimental feature and disabled by default.** - -```bash -meson setup build -Ddepend_api=true -meson compile -C build -``` - -In code, check for availability: - -```c -#ifdef HB_DEPEND_API - // Use dependency API -#endif -``` - -**Important:** This API is experimental and may change without notice. Do not -use in production applications without being prepared for breaking changes in -future HarfBuzz releases. - # Implementation Notes **⚠️ Warning: Graph Cycles in Invalid Fonts** diff --git a/src/gen-def.py b/src/gen-def.py index be4e68881..29f31ec11 100755 --- a/src/gen-def.py +++ b/src/gen-def.py @@ -27,6 +27,17 @@ hb_subset_cff2_get_charstring_data hb_subset_cff2_get_charstrings_index """.splitlines () symbols = [x for x in symbols if x not in experimental_symbols] + +if '--depend-api' not in sys.argv: + # Depend API symbols - only included when depend_api=true + depend_symbols = \ +"""hb_depend_from_face_or_fail +hb_depend_get_glyph_entry +hb_depend_get_set_from_index +hb_depend_print +hb_depend_destroy +""".splitlines () + symbols = [x for x in symbols if x not in depend_symbols] symbols = "\n".join (symbols) result = symbols if os.getenv ('PLAIN_LIST', '') else """EXPORTS diff --git a/src/meson.build b/src/meson.build index 3237368b9..e30febdf1 100644 --- a/src/meson.build +++ b/src/meson.build @@ -630,6 +630,9 @@ gen_def_cmd = [gen_def, '@OUTPUT@', '@INPUT@'] if get_option('experimental_api') gen_def_cmd += '--experimental-api' endif +if get_option('depend_api') + gen_def_cmd += '--depend-api' +endif # harfbuzz harfbuzz_def = custom_target('harfbuzz.def',