Convert multiple layers to alternate layers

I have a font with 13 masters and I’m creating an alternate layer for all the glyphs at [64<EXPO]. When I select all the layers to convert them to alternate layer, only one layer changes its name, so I have to go one by one. Copying and pasting the name of the alternate layer doesn’t work. Is there a way to script this action?

You can script this:

axis = Font.axes[0]
axisRules = {axis.axisId: {'max': 64}}
Layer.attributes['axisRules'] = axisRules

… but it applies to only one layer. I will see what can be done about batch editing layers.

Exactly, something like that but being able to apply it to all layers at once would help me a lot! :pray:t2:

You could filter layers by name and apply the axis rules there:

axis = Font.axes[0]
axisRules = {axis.axisId: {'max': 64}}

for layer in Layer.parent.layers:
	if layer.name == "Jul 29 21, 18:18":
		layer.attributes['axisRules'] = axisRules
1 Like

Thank you! Since I didn’t create all the layers the same day I modified it:

axis = Font.axes[0]
axisRules = {axis.axisId: {'max': 64}}

for layer in Layer.parent.layers:
	if "21," in layer.name:
		layer.attributes['axisRules'] = axisRules

And it works perfectly.

I have fixed the editing of more than one layer.

2 Likes