Skip to content

Commit 24ca3c6

Browse files
committed
Decompose components before interpolation
1 parent b902f4c commit 24ca3c6

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

source/lib/interpolationSlider.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import ezui
22
import merz
33
from mojo.events import postEvent
4+
from mojo.pens import DecomposePointPen
45
from mojo.roboFont import AllFonts, CurrentGlyph, RGlyph
56
from mojo.subscriber import Subscriber, registerGlyphEditorSubscriber, registerSubscriberEvent, unregisterGlyphEditorSubscriber
67
from mojo.UI import inDarkMode
@@ -61,16 +62,23 @@ def glyphUpdated(self):
6162
if layer.name == currentGlyph.layer.name:
6263
sourceLayer1 = layer
6364

64-
if currentGlyph.name in sourceLayer0 and currentGlyph.name in sourceLayer1:
65-
glyph0 = sourceLayer0[currentGlyph.name]
66-
glyph1 = sourceLayer1[currentGlyph.name]
65+
if currentGlyph is not None and currentGlyph.name in sourceLayer0 and currentGlyph.name in sourceLayer1:
66+
67+
glyph0 = RGlyph()
68+
dstPen = glyph0.getPointPen()
69+
decomposePen = DecomposePointPen(sourceLayer0, dstPen)
70+
sourceLayer0[currentGlyph.name].drawPoints(decomposePen)
71+
72+
glyph1 = RGlyph()
73+
dstPen = glyph1.getPointPen()
74+
decomposePen = DecomposePointPen(sourceLayer1, dstPen)
75+
sourceLayer1[currentGlyph.name].drawPoints(decomposePen)
6776

6877
# Interpolate
6978
self.interpolatedGlyph = RGlyph()
7079
self.interpolatedGlyph.interpolate(interpValue, glyph0, glyph1)
7180

7281
if glyph0 == glyph1:
73-
print('The same!')
7482
status = "⚪️"
7583
elif len(self.interpolatedGlyph.contours) > 0:
7684
status = "✅"

0 commit comments

Comments
 (0)