There are two horizontal and vertical lines, but can’t copy it through the following script.
I think NSIntersectsRect can’t distinguish them.
Could you help.
layer = Glyphs.font.glyphs['space'].layers[0]
xPaths = []
checkRect = NSMakeRect(0, 0, 330, 480)
i = 0
for p in layer.shapes:
i = i +1
if NSIntersectsRect(checkRect, p.bounds):
xPaths.append(p.copy())
p1 = Glyphs.font.glyphs['P1'].layers[0]
p1.clear()
p1.shapes.extend(xPaths.copy())
print(i, xPaths)
lineCopy.glyphs (60.7 KB)