diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2019-01-04 18:14:35 +0000 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gnome.org> | 2019-01-04 18:17:55 +0000 |
commit | 1f6541f93126da92c552aa286e1d0c4c92969be8 (patch) | |
tree | 2577fe348fdffa5857f7a2ec16044d72c603e920 | |
parent | 450cefa8877091ee44a9c6b0d934f97966ddaadb (diff) | |
download | pango-1f6541f93126da92c552aa286e1d0c4c92969be8.tar.gz |
Drop deprecated Harfbuzz API
Harfbuzz deprecated hb_ot_tag_from_language() and
hb_ot_tags_from_script(), and replaced them both with a single call,
hb_ot_tags_from_script_and_language().
Let's move Pango to the new API, and avoid the deprecated calls.
-rw-r--r-- | pango/pango-ot-tag.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/pango/pango-ot-tag.c b/pango/pango-ot-tag.c index 610b59d7..1cb58c88 100644 --- a/pango/pango-ot-tag.c +++ b/pango/pango-ot-tag.c @@ -46,9 +46,18 @@ PangoOTTag pango_ot_tag_from_script (PangoScript script) { - hb_tag_t tag1, tag2; - hb_ot_tags_from_script (hb_glib_script_to_script (script), &tag1, &tag2); - return (PangoOTTag) tag1; + unsigned int count = 1; + hb_tag_t tags[1]; + + hb_ot_tags_from_script_and_language (hb_glib_script_to_script (script), + HB_LANGUAGE_INVALID, + &count, + tags, + NULL, NULL); + if (count > 0) + return (PangoOTTag) tags[0]; + + return PANGO_OT_TAG_DEFAULT_SCRIPT; } /** @@ -94,7 +103,18 @@ pango_ot_tag_to_script (PangoOTTag script_tag) PangoOTTag pango_ot_tag_from_language (PangoLanguage *language) { - return (PangoOTTag) hb_ot_tag_from_language (hb_language_from_string (pango_language_to_string (language), -1)); + unsigned int count = 1; + hb_tag_t tags[1]; + + hb_ot_tags_from_script_and_language (HB_SCRIPT_UNKNOWN, + hb_language_from_string (pango_language_to_string (language), -1), + NULL, NULL, + &count, tags); + + if (count > 0) + return (PangoOTTag) tags[0]; + + return PANGO_OT_TAG_DEFAULT_LANGUAGE; } /** |