freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] master f1f9705 19/68: [afshaper] Fix hb_ot_tags_from_script


From: Werner Lemberg
Subject: [freetype2] master f1f9705 19/68: [afshaper] Fix hb_ot_tags_from_script deprecation warning.
Date: Fri, 5 Mar 2021 09:29:36 -0500 (EST)

branch: master
commit f1f9705f93f67d3cb1e2c4cb370dfedecac33513
Author: Nikolaus Waxweiler <madigens@gmail.com>
Commit: 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.
---
 ChangeLog              |  9 +++++++++
 src/autofit/afshaper.c | 26 +++++++++++++++++---------
 2 files changed, 26 insertions(+), 9 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6d49a9f..6faa683 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/src/autofit/afshaper.c b/src/autofit/afshaper.c
index 5625a8b..5d07893 100644
--- a/src/autofit/afshaper.c
+++ b/src/autofit/afshaper.c
@@ -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_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;
+    }
 
-    /* `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.                                                   */
+    /* 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();



reply via email to

[Prev in Thread] Current Thread [Next in Thread]