3227: "Correct Path Direction" messes with corner components

(again? Wasn’t that fixed ages ago?)
see here → 1

Anyhow, the corner components move onto nodes where they don’t belong.

I’ve noticed this too, it’s a bit of a pain.

Mekkablue has a great script: ‘Propogate Corner Components to Other Masters’

can you send me a sample font?

I will fetch it. I also learned that it was not about the command itself, but when running a script like below:

for l in Font.selectedLayers:
	for g_layer in l.parent.layers:
		g_layer.background.shapes = g_layer.shapes.copy() # <- with or without `copy()`
		g_layer.background.anchors = g_layer.anchors.copy() # <- with or without `copy()`
		g_layer.correctPathDirection()

When you comment out line 3 & 4 (the background assignment), all works fine, but any of these 2 lines cause the issue.

So may claim was wrong that the correctPathDirection() per se is misbehaving, but apparently in combination it is unexpected.
Now with this script, it doesnt even matter which font, it also happens in a quickly made one from scratch:
corners.glyphs (9.9 KB)

When you do a shapes.copy(), only the container is copied. Then you add the content to the background. Now those shapes are in the two places and the .parent property is pointing to the background layer.

Do this and it should work:

import copy 
for l in Font.selectedLayers:
	for g_layer in l.parent.layers:
		g_layer.background.shapes = copy.deepcopy(g_layer.shapes)
		g_layer.background.anchors = copy.deepcopy(g_layer.anchors)
		g_layer.correctPathDirection()

without copy would be really bad as explained above.