diff --git a/Lib/fontTools/otlLib/builder.py b/Lib/fontTools/otlLib/builder.py index 94628bff1..3508a7e28 100644 --- a/Lib/fontTools/otlLib/builder.py +++ b/Lib/fontTools/otlLib/builder.py @@ -2674,7 +2674,7 @@ class ClassDefBuilder(object): # class form a contiguous range, the encoding is actually quite # compact, whereas a non-contiguous set might need a lot of bytes # in the output file. We don't get this right with the key below. - result = sorted(self.classes_, key=lambda s: (len(s), s), reverse=True) + result = sorted(self.classes_, key=lambda s: (-len(s), s)) if not self.useClass0_: result.insert(0, frozenset()) return result diff --git a/Tests/feaLib/data/PairPosSubtable.ttx b/Tests/feaLib/data/PairPosSubtable.ttx index 2d78f64fa..d671537e6 100644 --- a/Tests/feaLib/data/PairPosSubtable.ttx +++ b/Tests/feaLib/data/PairPosSubtable.ttx @@ -93,14 +93,14 @@ - - - - - - + + + + + + @@ -112,7 +112,7 @@ - + @@ -120,7 +120,7 @@ - + diff --git a/Tests/feaLib/data/bug633.ttx b/Tests/feaLib/data/bug633.ttx index 075c17779..8be745cd5 100644 --- a/Tests/feaLib/data/bug633.ttx +++ b/Tests/feaLib/data/bug633.ttx @@ -43,10 +43,10 @@ - - - - + + + + @@ -55,10 +55,10 @@ - + - + diff --git a/Tests/feaLib/data/spec5f_ii_3.ttx b/Tests/feaLib/data/spec5f_ii_3.ttx index a94efceab..c03a81fb7 100644 --- a/Tests/feaLib/data/spec5f_ii_3.ttx +++ b/Tests/feaLib/data/spec5f_ii_3.ttx @@ -66,9 +66,9 @@ - + - + @@ -103,18 +103,12 @@ - - - - - - - + @@ -122,7 +116,7 @@ - + @@ -131,7 +125,7 @@ - + @@ -141,6 +135,12 @@ + + + + + + diff --git a/Tests/feaLib/data/variable_bug2772.ttx b/Tests/feaLib/data/variable_bug2772.ttx index 465462099..12fda609b 100644 --- a/Tests/feaLib/data/variable_bug2772.ttx +++ b/Tests/feaLib/data/variable_bug2772.ttx @@ -73,8 +73,8 @@ - - + + @@ -83,6 +83,9 @@ + + + @@ -91,9 +94,6 @@ - - - diff --git a/Tests/otlLib/builder_test.py b/Tests/otlLib/builder_test.py index 548a31e9f..b7a6caa2f 100644 --- a/Tests/otlLib/builder_test.py +++ b/Tests/otlLib/builder_test.py @@ -1080,7 +1080,7 @@ class ClassDefBuilderTest(object): b.add({"e", "f", "g", "h"}) cdef = b.build() assert isinstance(cdef, otTables.ClassDef) - assert cdef.classDefs == {"a": 2, "b": 2, "c": 3, "aa": 1, "bb": 1} + assert cdef.classDefs == {"a": 1, "b": 1, "c": 3, "aa": 2, "bb": 2} def test_build_notUsingClass0(self): b = builder.ClassDefBuilder(useClass0=False)