Skip to content

Commit

Permalink
[interpolatable] Fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
behdad committed Dec 1, 2023
1 parent 8000927 commit 97d571c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
17 changes: 8 additions & 9 deletions Lib/fontTools/varLib/interpolatable.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,14 +321,13 @@ def grand_parent(i, glyphname):
recording1Normalized = glyph1.recordingsNormalized

# If contour-order is wrong, adjust it
if matchings[m1idx] is not None and m1: # m1 is empty for composite glyphs
m1 = [m1[i] for i in matchings[m1idx]]
m1Vectors = [m1Vectors[i] for i in matchings[m1idx]]
m1VectorsNormalized = [m1VectorsNormalized[i] for i in matchings[m1idx]]
recording1 = [recording1[i] for i in matchings[m1idx]]
recording1Normalized = [
recording1Normalized[i] for i in matchings[m1idx]
]
matching = matchings[m1idx]
if matching is not None and m1: # m1 is empty for composite glyphs
m1 = [m1[i] for i in matching]
m1Vectors = [m1Vectors[i] for i in matching]
m1VectorsNormalized = [m1VectorsNormalized[i] for i in matching]
recording1 = [recording1[i] for i in matching]
recording1Normalized = [recording1Normalized[i] for i in matching]

midRecording = []
for c0, c1 in zip(recording0, recording1):
Expand All @@ -352,7 +351,7 @@ def grand_parent(i, glyphname):
continue

proposed_point, reverse, min_cost, first_cost = test_starting_point(
glyph0, glyph1, ix, tolerance
glyph0, glyph1, ix, tolerance, matching
)

if proposed_point or reverse:
Expand Down
10 changes: 6 additions & 4 deletions Lib/fontTools/varLib/interpolatableTestStartingPoint.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
from .interpolatableHelpers import *


def test_starting_point(glyph0, glyph1, ix, tolerance):
def test_starting_point(glyph0, glyph1, ix, tolerance, matching):
if matching is None:
matching = range(len(glyph0.isomorphisms))
contour0 = glyph0.isomorphisms[ix]
contour1 = glyph1.isomorphisms[ix]
m0Vectors = glyph0.greenVectors
m1Vectors = glyph1.greenVectors
contour1 = glyph1.isomorphisms[matching[ix]]
m0Vectors = glyph0.greenVectors[ix]
m1Vectors = glyph1.greenVectors[matching[ix]]

starting_point = 0
reverse = False
Expand Down

0 comments on commit 97d571c

Please sign in to comment.