Layers with no text


I don’t know exactly why (since different people worked on this file) but I have a lot of glyphs with layers that contain nothing.

Does anyone know why this is happening and if there is any way to remove them?



This are layers without a name. I don’t know how that happens.


I know they are layers without a name. The thing is that I have them (always two layers) on the entire font and I don’t understand why. I have some glyphs with outlines on them, but most of the characters have nothing inside those layers.

Well it’s not a major problem. I’m removing them one by one while I’m drawing. I just would like to know why that happened and if there was a faster way to remove them.


You can select all glyphs and run my Masters > Delete all non-master layers script from my repo.


It is not exactly what I need, since I just want to delete the layers that contain nothing inside.
Thanks anyway @mekkablue


You mean empty layers, as in ‘containing no paths and no components’? Try this snippet in the Macro Window, it will clean out empty layers of selected glyphs:

thisFont = Glyphs.font # frontmost font
selectedLayers = thisFont.selectedLayers # active layers of selected glyphs
for thisGlyph in [l.parent for l in selectedLayers]:
	# step backwards through indexes of glyph layers,
	# so you can delete layers without messing up indexes:
	for i in range(len(thisGlyph.layers))[::-1]:
		thisLayer = thisGlyph.layers[i]
		# must not be a master or special layer:
		if (thisLayer.associatedMasterId != thisLayer.layerId) and (not thisLayer.isSpecialLayer):
			# must be empty:
			if len(thisLayer.paths) == 0 and len(thisLayer.components) == 0:
				del thisGlyph.layers[i]


@mekkablue :raised_hands: