I might be missing something obvious, but is there a simple way to show all unused components (to do a cleanup of a font before production)? I am sure it has been discussed before, but I cannot find a script that would do that.
A component that is part of a font and is not present in any glyphs, i.e. doesn’t have the “Show all glyphs that use this glyph as a component” option when right clicking.
Well in that case only those “components” that follow the general idea of a component, i.e. named with a preceding underscore and set to Not Export.
This will give you all glyphs that are not used as components in other glyphs:
usedComponents = []
for g in Font.glyphs:
for l in g.layers:
if l.isMasterLayer or l.isSpecialLayer:
for c in l.components:
usedComponents.append(c.componentName)
unusedComponents = [g.name for g in Font.glyphs if not g.name in usedComponents]
tabString = "/"+"/".join(unusedComponents)
Font.newTab(tabString)
If you want only glyphs that start with an underscore, change the unusedComponents line to this:
unusedComponents = [g.name for g in Font.glyphs if g.name.startswith("_") and not g.name in usedComponents]