[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
# informational for now
- 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:
docker:
@ -236,6 +234,8 @@ jobs:
- run: meson build -Damalgam=true && ninja -Cbuild && rm -rf build
# test meson's own unity feature also
- 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:
docker:

View File

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

View File

@ -28,5 +28,7 @@ option('introspection', type : 'feature', value : 'disabled', yield : true,
option('icu-builtin', type: 'boolean', value: false,
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,
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 ())
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
experimental_symbols = \
"""hb_font_draw_glyph

View File

@ -26,6 +26,10 @@
* Red Hat Author(s): Behdad Esfahbod
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "hb.h"
#include "hb-ot.h"
@ -37,8 +41,7 @@
#define hb_blob_create_from_file(x) hb_blob_get_empty ()
#endif
#if !defined(HB_NO_COLOR) && !defined(HB_NO_DRAW)
#ifdef HB_EXPERIMENTAL_API
#if !defined(HB_NO_COLOR) && !defined(HB_NO_DRAW) && defined(HB_EXPERIMENTAL_API)
static void
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);
}
#endif
#endif
/* Only this part of this mini app uses private API */
#include "hb-static.cc"
@ -504,10 +506,8 @@ main (int argc, char **argv)
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));
print_layout_info_using_private_api (blob);
#if !defined(HB_NO_COLOR) && !defined(HB_NO_DRAW)
#ifdef HB_EXPERIMENTAL_API
#if !defined(HB_NO_COLOR) && !defined(HB_NO_DRAW) && defined(HB_EXPERIMENTAL_API)
dump_glyphs (blob, argv[1]);
#endif
#endif
hb_blob_destroy (blob);

View File

@ -336,8 +336,14 @@ endif
# harfbuzz
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',
command: [gen_def, '@OUTPUT@', '@INPUT@'],
command: harfbuzz_def_command_args,
input: hb_headers,
output: 'harfbuzz.def')

View File

@ -4,15 +4,15 @@ tests = [
'cff-full-font',
'japanese',
'cff-japanese',
#'layout',
#'layout.gpos',
#'layout.gpos2',
#'layout.gpos3',
#'layout.gpos4',
#'layout.gpos6',
#'layout.gsub3',
#'layout.gsub6',
#'layout.gdef',
'layout',
'layout.gpos',
'layout.gpos2',
'layout.gpos3',
'layout.gpos4',
'layout.gpos6',
'layout.gsub3',
'layout.gsub6',
'layout.gdef',
'cmap',
'cmap14',
'sbix',
@ -25,6 +25,11 @@ run_test = find_program('run-tests.py')
foreach t : tests
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,
args: [
hb_subset,