[pango/replace-deprecated-hb-api: 2/2] Drop deprecated Harfbuzz API



commit 1f6541f93126da92c552aa286e1d0c4c92969be8
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Fri Jan 4 18:14:35 2019 +0000

    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.

 pango/pango-ot-tag.c | 28 ++++++++++++++++++++++++----
 1 file 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;
 }
 
 /**


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]