Hello,
I was reading the Glyphs documentation looking for a method I could apply to a layer with several layers. I would like to center all components in a layer using a script like the following button does:
Thank you so much,
Ricard.
Hello,
I was reading the Glyphs documentation looking for a method I could apply to a layer with several layers. I would like to center all components in a layer using a script like the following button does:
Thank you so much,
Ricard.
The button centers the selected elements in the bounding box of the selection. You mean how to center in the width of the layer?
from Foundation import NSMidX
for c in Layer.shapes:
pos = c.position
pos.x += Layer.width / 2.0 - NSMidX(c.bounds)
c.position = pos
True, I forgot to say I would like to center them in the middle of the layer just like your script does. I ended up with the same result but with much more code.
Thank you so much,
Ricard.