From 0677c0e70536b603863bd6c51d6dbc2d923c14d4 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 24 May 2023 13:00:59 -0600 Subject: [PATCH] [varStore] Another bugfix in optimize() --- Lib/fontTools/varLib/varStore.py | 2 ++ Tests/varLib/varStore_test.py | 13 +++++++++++++ 2 files changed, 15 insertions(+) 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):