From c30683648847b49f79f7e90c94571bde49d6000a Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 16 Oct 2023 14:55:10 -0600 Subject: [PATCH] [varLib.interpolatable] Another micro-optimization Don't know why the previous code was written that way! --- Lib/fontTools/varLib/interpolatable.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/Lib/fontTools/varLib/interpolatable.py b/Lib/fontTools/varLib/interpolatable.py index f0b1aa8b0..24a61ed6e 100644 --- a/Lib/fontTools/varLib/interpolatable.py +++ b/Lib/fontTools/varLib/interpolatable.py @@ -245,9 +245,7 @@ def test(glyphsets, glyphs=None, names=None, ignore_missing=False): for i in range(n): b = ((bits << i) & mask) | ((bits >> (n - i))) if b == bits: - isomorphisms.append( - _rot_list(complexPoints, i) - ) + isomorphisms.append(_rot_list(complexPoints, i)) # Add mirrored rotations mirrored = list(reversed(points.value)) reversed_bits = 0 @@ -257,9 +255,7 @@ def test(glyphsets, glyphs=None, names=None, ignore_missing=False): for i in range(n): b = ((reversed_bits << i) & mask) | ((reversed_bits >> (n - i))) if b == bits: - isomorphisms.append( - _rot_list(complexPoints, i) - ) + isomorphisms.append(_rot_list(complexPoints, i)) # m0idx should be the index of the first non-None item in allNodeTypes, # else give it the last item. @@ -368,10 +364,7 @@ def test(glyphsets, glyphs=None, names=None, ignore_missing=False): continue for ix, (contour0, contour1) in enumerate(zip(m0, m1)): c0 = contour0[0] - costs = [ - v - for v in (_vdiff_hypot2_complex(c0, c1) for c1 in contour1) - ] + costs = [_vdiff_hypot2_complex(c0, c1) for c1 in contour1] min_cost = min(costs) first_cost = costs[0] if min_cost < first_cost * 0.95: