Path > Transformations, apply to all layers?

Is there an easy way to apply a transformation to all layers in the selected glyph(s)? I thought there used to be a way to do this without writing a script.

1 Like

There is currently no way to do that.

It would be very useful since the API makes it hard to write quick scripts for transformations.

This doesn’t look too terrible:

from AppKit import NSAffineTransform
offsetX = 0
offsetY = 60
transform = NSAffineTransform.new()
transform.translateXBy_yBy_(offsetX, offsetY)
selection = Font.selectedLayers
for selectedLayer in selection:
	for layer in selectedLayer.parent.layers:
		layer.transform(transform)
1 Like

Hi,
I was wondering if you could help with a similar transform snippet. But one that batch transforms on a specificied color layer.

The script above works with all selected layers, so you can use it directly by selecting the specific color layers first.

If you want the script to use a different set of layers, you need to write code that filters for precisely those layers. Could you be more specific about how those color layers might be determined using a script?

The script works great for transforming all layers of selected glyphs. But in Glyphs, in the font view, when you select multiple glyphs, the color layers disappear and only masters are selectable:

I do not know how to script for this. Ideally a script that batch transforms the specific named layers. If I could set the filter in the script to a layer name, Color 1, then all selected glyphs with a Color 1 layer would transform.

Is it possible to modify the above code to add a filter?

I appreciate the help.

Funny that you also do that RGB approach. I did that before but never managed to get a working variable font from it. There where all kind of glitches happening when I used a pixel component, where the components inside the glyphs fly all over the place. Do you have that, too, or does it work well in your setup?

I havent used any componenets for this project all. I thought about it, but its a small character set and the potnential headache wasnt worth it.

Will keep an eye out though for this glitch though!

1 Like