Remove non-extremes

I can swear there was a function to delete every node except the extreme nodes (and keep the shape) but can not find it in either the normal menus or a script. Anyone?

There’s one of Toshi’s scripts called Delete Diagonal Nodes Between Extremes.

One can think that it has that purpose but it only removes certain nodes, not all of them.

(Works like a charm in FontLab, the Simplify-option, but feels so wrong to use FontLab, haha)

I would love to see Glyphs do this more easily out of the box, as it would be especially useful when designing italics using the 1/2 rotate 1/2 slant method, and probably for other things like script fonts. I guess a plugin would be a good place for it, too, but I haven’t found one that does this. The ItalicExtremes plugin is sort of similar, but it still takes far too many clicks to do similar tasks.

This should remove non-extreme nodes from selection:

leftmost = rightmost = topmost = bottommost = None

for node in Layer.selection:
	if node.type == "curve":
		if leftmost is None:
			leftmost = rightmost = topmost = bottommost = node
			if node.x < leftmost.x: leftmost = node
			if node.x > rightmost.x: rightmost = node
			if node.y < bottommost.y: bottommost = node
			if node.y > topmost.y: topmost = node

boundary_nodes = {leftmost, rightmost, topmost, bottommost}
nodes_to_check = selection.copy()

for node in nodes_to_check:
	if node not in boundary_nodes and node.type == "curve":
		node.parentPath().removeNodeCheckKeepShape_normalizeHandles_(node, True)

They have the Simplify Code from the old Fontographer. Someone much more clever than me wrote that algorithm many years ago.