[justify] Wrap in HB_EXPERIMENTAL_API

This commit is contained in:
Behdad Esfahbod 2023-03-01 14:16:08 -07:00
parent 96d4ed0931
commit 25c66d633d
3 changed files with 13 additions and 2 deletions

View File

@ -19,7 +19,8 @@ symbols = sorted (re.findall (r"^hb_\w+(?= \()", "\n".join (headers_content), re
if '--experimental-api' not in sys.argv: 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_subset_repack_or_fail """hb_shape_justify
hb_subset_repack_or_fail
hb_subset_input_override_name_table hb_subset_input_override_name_table
""".splitlines () """.splitlines ()
symbols = [x for x in symbols if x not in experimental_symbols] symbols = [x for x in symbols if x not in experimental_symbols]

View File

@ -198,6 +198,8 @@ hb_shape (hb_font_t *font,
} }
#ifdef HB_EXPERIMENTAL_API
static float static float
buffer_advance (hb_buffer_t *buffer) 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 * In addition, justify the shaping results such that the shaping results reach
* the target advance width/height, depending on the buffer direction. * 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 * Return value: false if all shapers failed, true otherwise
* *
* XSince: REPLACEME * XSince: EXPERIMENTAL
**/ **/
hb_bool_t hb_bool_t
hb_shape_justify (hb_font_t *font, hb_shape_justify (hb_font_t *font,
@ -399,5 +403,7 @@ hb_shape_justify (hb_font_t *font,
return true; return true;
} }
#endif
#endif #endif

View File

@ -189,6 +189,7 @@ struct shape_options_t
exit (0); exit (0);
} }
} }
#ifdef HB_EXPERIMENTAL_API
else else
{ {
float unit = (1 << SUBPIXEL_BITS); float unit = (1 << SUBPIXEL_BITS);
@ -205,6 +206,7 @@ struct shape_options_t
goto fail; goto fail;
} }
} }
#endif
} }
if (normalize_glyphs) 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"}, {"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}, {"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}, {"eot", 0, 0, G_OPTION_ARG_NONE, &this->eot, "Treat text as end-of-paragraph", nullptr},
#ifdef HB_EXPERIMENTAL_API
{"width", 'w',0, {"width", 'w',0,
G_OPTION_ARG_INT, &this->width, "Target width to justify to", "WIDTH, or -1"}, 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}, {"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}, {"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}, {"invisible-glyph", 0, 0, G_OPTION_ARG_INT, &this->invisible_glyph, "Glyph value to replace Default-Ignorables with", nullptr},