shithub: freetype+ttf2subf

Download patch

ref: a42f918434ec132737b2107a2d7356d02d4919bc
parent: f45749b05b15062443008344a5c231da311c7b04
author: Werner Lemberg <[email protected]>
date: Fri Jan 3 13:29:41 EST 2014

[autofit] Fix handling of default coverages.

* src/autofit/afglobal.c (af_face_globals_compute_style_coverage):
First handle non-default coverages, then the default coverage of the
default script, and finally the other default coverages.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2014-01-03  Werner Lemberg  <[email protected]>
 
+	[autofit] Fix handling of default coverages.
+
+	* src/autofit/afglobal.c (af_face_globals_compute_style_coverage):
+	First handle non-default coverages, then the default coverage of the
+	default script, and finally the other default coverages.
+
+2014-01-03  Werner Lemberg  <[email protected]>
+
 	[autofit] Fix scaling of HarfBuzz shaping.
 
 	* src/autofit/hbshim.c (af_get_char_index): Scale to units per EM.
--- a/src/autofit/afglobal.c
+++ b/src/autofit/afglobal.c
@@ -127,6 +127,7 @@
     FT_Byte*    gstyles     = globals->glyph_styles;
     FT_UInt     ss;
     FT_UInt     i;
+    FT_UInt     dflt        = -1;
 
 
     /* the value AF_STYLE_UNASSIGNED means `uncovered glyph' */
@@ -164,6 +165,9 @@
        */
       if ( style_class->coverage == AF_COVERAGE_DEFAULT )
       {
+        if ( style_class->script == globals->module->default_script )
+          dflt = ss;
+
         for ( range = script_class->script_uni_ranges;
               range->first != 0;
               range++ )
@@ -192,9 +196,24 @@
           }
         }
       }
+      else
+      {
+        /* get glyphs not directly addressable by cmap */
+        af_get_coverage( globals, style_class, gstyles );
+      }
+    }
 
-      /* get glyphs not directly addressable by cmap */
-      af_get_coverage( globals, style_class, gstyles );
+    /* handle the default OpenType features of the default script ... */
+    af_get_coverage( globals, AF_STYLE_CLASSES_GET[dflt], gstyles );
+
+    /* ... and the remaining default OpenType features */
+    for ( ss = 0; AF_STYLE_CLASSES_GET[ss]; ss++ )
+    {
+      AF_StyleClass  style_class = AF_STYLE_CLASSES_GET[ss];
+
+
+      if ( ss != dflt && style_class->coverage == AF_COVERAGE_DEFAULT )
+        af_get_coverage( globals, style_class, gstyles );
     }
 
     /* mark ASCII digits */