I’m sorry, last time I probably didn’t make it clear.
I made a demo animation.This is a dynamic graph, and it may need to be clicked and open to see the effect.
Like this, I choose four glyphs. When I run, only the first can change, and the remaining three doesn’t respond.
I want to change the four selected at once.
from Foundation import NSMidY
myAscender = Font.selectedFontMaster.ascender
myDescender = Font.selectedFontMaster.descender
mycenterY = (myAscender + myDescender) / 2.0
for layer in Glyphs.font.selectedLayers:
bounds = Layer.bounds
centerY = NSMidY(bounds)
shift = mycenterY - centerY
layer.applyTransform([
1, # x scale factor
0.0, # x skew factor
0.0, # y skew factor
1, # y scale factor
0.0, # x position
shift # y position
])