[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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
diff --git a/ChangeLog b/ChangeLog
index b5352e6..0dcd4a7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2014-01-03 Werner Lemberg <wl@gnu.org>
+ [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 <wl@gnu.org>
+
[autofit] Fix scaling of HarfBuzz shaping.
* src/autofit/hbshim.c (af_get_char_index): Scale to units per EM.
diff --git a/src/autofit/afglobal.c b/src/autofit/afglobal.c
index d92c6ad..7682c14 100644
--- 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 );
+ }
+ }
+
+ /* 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];
+
- /* get glyphs not directly addressable by cmap */
- af_get_coverage( globals, style_class, gstyles );
+ if ( ss != dflt && style_class->coverage == AF_COVERAGE_DEFAULT )
+ af_get_coverage( globals, style_class, gstyles );
}
/* mark ASCII digits */