From 25c66d633d58dcdd1e59095abf673a9ef08a612c Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 1 Mar 2023 14:16:08 -0700 Subject: [PATCH] [justify] Wrap in HB_EXPERIMENTAL_API --- src/gen-def.py | 3 ++- src/hb-shape.cc | 8 +++++++- util/shape-options.hh | 4 ++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/gen-def.py b/src/gen-def.py index 9b4efd4f3..6011817bc 100755 --- a/src/gen-def.py +++ b/src/gen-def.py @@ -19,7 +19,8 @@ symbols = sorted (re.findall (r"^hb_\w+(?= \()", "\n".join (headers_content), re if '--experimental-api' not in sys.argv: # Move these to harfbuzz-sections.txt when got stable experimental_symbols = \ -"""hb_subset_repack_or_fail +"""hb_shape_justify +hb_subset_repack_or_fail hb_subset_input_override_name_table """.splitlines () symbols = [x for x in symbols if x not in experimental_symbols] diff --git a/src/hb-shape.cc b/src/hb-shape.cc index b17699684..13bda36f3 100644 --- a/src/hb-shape.cc +++ b/src/hb-shape.cc @@ -198,6 +198,8 @@ hb_shape (hb_font_t *font, } +#ifdef HB_EXPERIMENTAL_API + static float buffer_advance (hb_buffer_t *buffer) { @@ -246,9 +248,11 @@ reset_buffer (hb_buffer_t *buffer, * In addition, justify the shaping results such that the shaping results reach * the target advance width/height, depending on the buffer direction. * + * This API is currently experimental and will probably change in the future. + * * Return value: false if all shapers failed, true otherwise * - * XSince: REPLACEME + * XSince: EXPERIMENTAL **/ hb_bool_t hb_shape_justify (hb_font_t *font, @@ -399,5 +403,7 @@ hb_shape_justify (hb_font_t *font, return true; } +#endif + #endif diff --git a/util/shape-options.hh b/util/shape-options.hh index 8e38244f0..6096b3696 100644 --- a/util/shape-options.hh +++ b/util/shape-options.hh @@ -189,6 +189,7 @@ struct shape_options_t exit (0); } } +#ifdef HB_EXPERIMENTAL_API else { float unit = (1 << SUBPIXEL_BITS); @@ -205,6 +206,7 @@ struct shape_options_t goto fail; } } +#endif } if (normalize_glyphs) @@ -367,8 +369,10 @@ shape_options_t::add_options (option_parser_t *parser) {"script", 0, 0, G_OPTION_ARG_STRING, &this->script, "Set text script (default: auto)", "ISO-15924 tag"}, {"bot", 0, 0, G_OPTION_ARG_NONE, &this->bot, "Treat text as beginning-of-paragraph", nullptr}, {"eot", 0, 0, G_OPTION_ARG_NONE, &this->eot, "Treat text as end-of-paragraph", nullptr}, +#ifdef HB_EXPERIMENTAL_API {"width", 'w',0, G_OPTION_ARG_INT, &this->width, "Target width to justify to", "WIDTH, or -1"}, +#endif {"preserve-default-ignorables",0, 0, G_OPTION_ARG_NONE, &this->preserve_default_ignorables, "Preserve Default-Ignorable characters", nullptr}, {"remove-default-ignorables",0, 0, G_OPTION_ARG_NONE, &this->remove_default_ignorables, "Remove Default-Ignorable characters", nullptr}, {"invisible-glyph", 0, 0, G_OPTION_ARG_INT, &this->invisible_glyph, "Glyph value to replace Default-Ignorables with", nullptr},