Smart filter suggestion: Number of handles

Hello,

I’m testing ways of sorting my glyphs, and i want to be able to separate the glyphs with curves (or handles) from the glyphs with no curves (straight lines only). Is this already possible to do in smart filters? I am not able to find it.

Maybe ‘Count of Handles’ would be a way of solving that, and maybe some other problems as well? With the same variables as ‘Count of Anchors’: ‘is’, ‘is less than’ and ‘is greater than’.

That would be really helpful, thank you.

I believe this is such a rare case that you are better off with a script. Copy this into Window > Macro Panel and press Run:

def hasCurve(thisGlyph):
	for thisMaster in Font.masters:
		masterID = thisMaster.id
		thisLayer = thisGlyph.layers[masterID]
		for thisPath in thisLayer.paths:
			for thisNode in thisPath.nodes:
				if thisNode.type == OFFCURVE:
					return True
	return False

for thisGlyph in Font.glyphs:
	if hasCurve(thisGlyph):
		print "/%s" % thisGlyph.name,

This will output slash-escaped glyph names in the macro window, which you can paste into an Edit tab.

2 Likes

Thank you!

My idea was to use it for making a slanted roman: I don’t want to slant curves at the same angles as straight lines. That might not be useful to others. This script anyway solves my problem! Thanks again.

1 Like