Access content of Smart Filters

I want to access the content of List and Smart filters in a script. When checking the content of Font.fontView.glyphsGroupViewController().glyphGroups()[2]['subGroup'], list filters do have a list key with the content of the list as value, but smart filters only have the filtering conditions, not the actual filter output. Is there a way to access that?

You need to compute he actual glyph list yourself.

filter = NSPredicate.predicateWithFormat_(Item["predicate"])
if filter is not None:
	result = font.glyphs.values().filteredArrayUsingPredicate_(filter)

but also for the “list” items, you need to check if those glyphs are actually in the font.

nameList = Item["list"]
result = Font.filterGlyphs_(nameList)
2 Likes

Very cool, thanks Georg!