From 745631d16b3d4e08cbeefc74bec6671dbd2e8c81 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 31 Mar 2022 19:52:48 -0600 Subject: [PATCH] [interpolatable] In diff-contour-order, allow for 5% cost difference Reduces false-positives, as in this one in NotoSansArabic: Glyph asteriskArt-ar was not compatible: Contour order differs: [0, 1, 2, 3, 4, 5] in NotoSansArabic-CondensedBold, [0, 3, 2, 1, 4, 5] in NotoSansArabic-CondensedLight --- Lib/fontTools/varLib/interpolatable.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Lib/fontTools/varLib/interpolatable.py b/Lib/fontTools/varLib/interpolatable.py index 174aa33e1..e57ded6f4 100644 --- a/Lib/fontTools/varLib/interpolatable.py +++ b/Lib/fontTools/varLib/interpolatable.py @@ -281,7 +281,9 @@ def test(glyphsets, glyphs=None, names=None): continue costs = [[_vlen(_vdiff(v0, v1)) for v1 in m1] for v0 in m0] matching, matching_cost = min_cost_perfect_bipartite_matching(costs) - if matching != list(range(len(m0))): + identity_matching = list(range(len(m0))) + identity_cost = sum(costs[i][i] for i in range(len(m0))) + if matching != identity_matching and matching_cost < identity_cost * .95: add_problem( glyph_name, {