diff --git a/Lib/fontTools/varLib/varStore.py b/Lib/fontTools/varLib/varStore.py index b06a1d2e0..251805e3f 100644 --- a/Lib/fontTools/varLib/varStore.py +++ b/Lib/fontTools/varLib/varStore.py @@ -422,6 +422,8 @@ class _Encoding(object): else: new_encoding = None self.best_new_encoding = new_encoding + if new_encoding: + break class _EncodingDict(dict): diff --git a/Tests/varLib/varStore_test.py b/Tests/varLib/varStore_test.py index d8be142b8..b06ae0215 100644 --- a/Tests/varLib/varStore_test.py +++ b/Tests/varLib/varStore_test.py @@ -108,6 +108,19 @@ def buildAxis(axisTag): 2, 186, ), + ( + 5, + [ + [10, 11, 0, 0, 20], + [10, 300, 0, 0, 20], + [10, 301, 0, 0, 20], + [10, 302, 0, 0, 20], + [10, 303, 0, 0, 20], + [10, 304, 0, 0, 20], + ], + 1, + 180, + ), ], ) def test_optimize(numRegions, varData, expectedNumVarData, expectedBytes):