Refactor the selection of script and language tags

System Internals / HarfBuzz - David Corbett [] - 11 October 2018 17:54 EDT

The old functions, `hb_ot_tags_from_script` and `hb_ot_tag_from_language`, are now wrappers around a new function: `hb_ot_tags`. It converts a script and a language to arrays of script tags and language tags. This will make it easier to add new script tags to scripts, like 'dev3'. It also allows for language fallback chains; nothing produces more than one language yet though.

Where the old functions return the default tags 'DFLT' and 'dflt', `hb_ot_tags` returns an empty array. The caller is responsible for using the default tag in that case.

The new function also adds a new private use subtag syntax for script overrides: "x-hbscabcd" requests a script tag of 'abcd'.

The old functions,`hb_ot_layout_table_choose_script` and `hb_ot_layout_script_find_language` are now wrappers around the new functions `hb_ot_layout_table_select_script` and `hb_ot_layout_script_select_language`. They are essentially the same as the old ones plus a tag count parameter.

Closes #495.

91067716 Refactor the selection of script and language tags
docs/harfbuzz-sections.txt | 5 +
src/ | 43 +-
src/hb-ot-layout.h | 16 +
src/ | 13 +-
src/ | 1639 ++++++++++++++++++++++++--------------------
src/hb-ot-tag.h | 11 +
test/api/test-ot-tag.c | 107 +++
7 files changed, 1070 insertions(+), 764 deletions(-)


  • Share