[meson] Add an experimental-api option

This commit is contained in:
Ebrahim Byagowi 2020-04-21 01:13:13 +04:30
parent 262eced2ad
commit 750bb73e32
7 changed files with 36 additions and 19 deletions

View File

@ -121,8 +121,6 @@ jobs:
- run: HB_TEST_SHAPE_FUZZER_TIMEOUT=3 HB_TEST_SUBSET_FUZZER_TIMEOUT=30 RUN_VALGRIND=1 make check && make -Ctest/api check-valgrind || .ci/fail.sh - run: HB_TEST_SHAPE_FUZZER_TIMEOUT=3 HB_TEST_SUBSET_FUZZER_TIMEOUT=30 RUN_VALGRIND=1 make check && make -Ctest/api check-valgrind || .ci/fail.sh
# informational for now # informational for now
- run: make -Ctest/api check-symbols || true - run: make -Ctest/api check-symbols || true
# enable and test experimental outline drawing APIs
- run: make clean && HB_EXPERIMENTAL_API=1 make -j9 CPPFLAGS="-DHB_EXPERIMENTAL_API" check
clang-everything: clang-everything:
docker: docker:
@ -236,6 +234,8 @@ jobs:
- run: meson build -Damalgam=true && ninja -Cbuild && rm -rf build - run: meson build -Damalgam=true && ninja -Cbuild && rm -rf build
# test meson's own unity feature also # test meson's own unity feature also
- run: meson build --unity on && ninja -Cbuild && rm -rf build - run: meson build --unity on && ninja -Cbuild && rm -rf build
# test experimental APIs
- run: meson build -Dexperimental-api=true && ninja -Cbuild && rm -rf build
crosscompile-notest-djgpp: crosscompile-notest-djgpp:
docker: docker:

View File

@ -196,6 +196,10 @@ if get_option('icu-builtin')
conf.set('HAVE_ICU_BUILTIN', 1) conf.set('HAVE_ICU_BUILTIN', 1)
endif endif
if get_option('experimental-api')
conf.set('HB_EXPERIMENTAL_API', 1)
endif
if freetype_dep.found() if freetype_dep.found()
conf.set('HAVE_FREETYPE', 1) conf.set('HAVE_FREETYPE', 1)
deps += [freetype_dep] deps += [freetype_dep]

View File

@ -28,5 +28,7 @@ option('introspection', type : 'feature', value : 'disabled', yield : true,
option('icu-builtin', type: 'boolean', value: false, option('icu-builtin', type: 'boolean', value: false,
description: 'Don\'t separate ICU support as harfbuzz-icu module') description: 'Don\'t separate ICU support as harfbuzz-icu module')
option('experimental-api', type: 'boolean', value: false,
description: 'Enable experimental APIs')
option('amalgam', type : 'boolean', value : false, option('amalgam', type : 'boolean', value : false,
description : 'Enable amalgam builds') description : 'Enable amalgam builds')

View File

@ -14,7 +14,7 @@ for h in header_paths:
with io.open (h, encoding='utf-8') as f: headers_content.append (f.read ()) with io.open (h, encoding='utf-8') as f: headers_content.append (f.read ())
symbols = sorted (re.findall (r"^hb_\w+(?= \()", "\n".join (headers_content), re.M)) symbols = sorted (re.findall (r"^hb_\w+(?= \()", "\n".join (headers_content), re.M))
if not os.environ.get('HB_EXPERIMENTAL_API', ''): if '--experimental-api' not in sys.argv:
# Move these to harfbuzz-sections.txt when got stable # Move these to harfbuzz-sections.txt when got stable
experimental_symbols = \ experimental_symbols = \
"""hb_font_draw_glyph """hb_font_draw_glyph

View File

@ -26,6 +26,10 @@
* Red Hat Author(s): Behdad Esfahbod * Red Hat Author(s): Behdad Esfahbod
*/ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "hb.h" #include "hb.h"
#include "hb-ot.h" #include "hb-ot.h"
@ -37,8 +41,7 @@
#define hb_blob_create_from_file(x) hb_blob_get_empty () #define hb_blob_create_from_file(x) hb_blob_get_empty ()
#endif #endif
#if !defined(HB_NO_COLOR) && !defined(HB_NO_DRAW) #if !defined(HB_NO_COLOR) && !defined(HB_NO_DRAW) && defined(HB_EXPERIMENTAL_API)
#ifdef HB_EXPERIMENTAL_API
static void static void
svg_dump (hb_face_t *face, unsigned face_index) svg_dump (hb_face_t *face, unsigned face_index)
{ {
@ -329,7 +332,6 @@ dump_glyphs (hb_blob_t *blob, const char *font_name)
hb_draw_funcs_destroy (funcs); hb_draw_funcs_destroy (funcs);
} }
#endif #endif
#endif
/* Only this part of this mini app uses private API */ /* Only this part of this mini app uses private API */
#include "hb-static.cc" #include "hb-static.cc"
@ -504,10 +506,8 @@ main (int argc, char **argv)
hb_blob_t *blob = hb_blob_create_from_file (argv[1]); hb_blob_t *blob = hb_blob_create_from_file (argv[1]);
printf ("Opened font file %s: %d bytes long\n", argv[1], hb_blob_get_length (blob)); printf ("Opened font file %s: %d bytes long\n", argv[1], hb_blob_get_length (blob));
print_layout_info_using_private_api (blob); print_layout_info_using_private_api (blob);
#if !defined(HB_NO_COLOR) && !defined(HB_NO_DRAW) #if !defined(HB_NO_COLOR) && !defined(HB_NO_DRAW) && defined(HB_EXPERIMENTAL_API)
#ifdef HB_EXPERIMENTAL_API
dump_glyphs (blob, argv[1]); dump_glyphs (blob, argv[1]);
#endif
#endif #endif
hb_blob_destroy (blob); hb_blob_destroy (blob);

View File

@ -336,8 +336,14 @@ endif
# harfbuzz # harfbuzz
gen_def = find_program('gen-def.py') gen_def = find_program('gen-def.py')
harfbuzz_def_command_args = [gen_def, '@OUTPUT@', '@INPUT@']
if get_option('experimental-api')
harfbuzz_def_command_args += '--experimental-api'
endif
harfbuzz_def = custom_target('harfbuzz.def', harfbuzz_def = custom_target('harfbuzz.def',
command: [gen_def, '@OUTPUT@', '@INPUT@'], command: harfbuzz_def_command_args,
input: hb_headers, input: hb_headers,
output: 'harfbuzz.def') output: 'harfbuzz.def')

View File

@ -4,15 +4,15 @@ tests = [
'cff-full-font', 'cff-full-font',
'japanese', 'japanese',
'cff-japanese', 'cff-japanese',
#'layout', 'layout',
#'layout.gpos', 'layout.gpos',
#'layout.gpos2', 'layout.gpos2',
#'layout.gpos3', 'layout.gpos3',
#'layout.gpos4', 'layout.gpos4',
#'layout.gpos6', 'layout.gpos6',
#'layout.gsub3', 'layout.gsub3',
#'layout.gsub6', 'layout.gsub6',
#'layout.gdef', 'layout.gdef',
'cmap', 'cmap',
'cmap14', 'cmap14',
'sbix', 'sbix',
@ -25,6 +25,11 @@ run_test = find_program('run-tests.py')
foreach t : tests foreach t : tests
fname = '@0@.tests'.format(t) fname = '@0@.tests'.format(t)
# layout test are enabled only under experimental API flag for now
if t.contains('layout') and not get_option('experimental-api')
continue
endif
test(t, run_test, test(t, run_test,
args: [ args: [
hb_subset, hb_subset,