[afshaper] Fix hb_ot_tags_from_script deprecation warning.

* autofit/afshaper.c (af_shaper_get_coverage): Copy the source code
of the function as suggested in
https://github.com/harfbuzz/harfbuzz/issues/2737 and adjust to handle
at most three tags.
This commit is contained in:
Nikolaus Waxweiler 2021-01-15 23:52:04 +00:00
parent d35c7f7cba
commit f1f9705f93
2 changed files with 26 additions and 9 deletions

View File

@ -1,3 +1,12 @@
2021-01-15 Nikolaus Waxweiler <madigens@gmail.com>
[afshaper] Fix hb_ot_tags_from_script deprecation warning.
* autofit/afshaper.c (af_shaper_get_coverage): Copy the source code
of the function as suggested in
https://github.com/harfbuzz/harfbuzz/issues/2737 and adjust to handle
at most three tags.
2021-01-17 Werner Lemberg <wl@gnu.org>
* src/tools/update-copyright-year: Fix single-year entry handling.

View File

@ -132,13 +132,24 @@
/* Convert a HarfBuzz script tag into the corresponding OpenType */
/* tag or tags -- some Indic scripts like Devanagari have an old */
/* and a new set of features. */
hb_ot_tags_from_script( script,
&script_tags[0],
&script_tags[1] );
{
unsigned int tags_count = 3;
hb_tag_t tags[3];
/* `hb_ot_tags_from_script' usually returns HB_OT_TAG_DEFAULT_SCRIPT */
/* as the second tag. We change that to HB_TAG_NONE except for the */
/* default script. */
hb_ot_tags_from_script_and_language( script,
HB_LANGUAGE_INVALID,
&tags_count,
tags,
NULL,
NULL );
script_tags[0] = tags_count > 0 ? tags[0] : HB_TAG_NONE;
script_tags[1] = tags_count > 1 ? tags[1] : HB_TAG_NONE;
script_tags[2] = tags_count > 2 ? tags[2] : HB_TAG_NONE;
}
/* If the second tag is HB_OT_TAG_DEFAULT_SCRIPT, change that to */
/* HB_TAG_NONE except for the default script. */
if ( default_script )
{
if ( script_tags[0] == HB_TAG_NONE )
@ -157,9 +168,6 @@
/* HarfBuzz maps them to `DFLT', which we don't want to handle here */
if ( script_tags[0] == HB_OT_TAG_DEFAULT_SCRIPT )
goto Exit;
if ( script_tags[1] == HB_OT_TAG_DEFAULT_SCRIPT )
script_tags[1] = HB_TAG_NONE;
}
gsub_lookups = hb_set_create();