This is my first script so excuse my derp. This is what I tried:
for thisGlyph in Glyphs.font.selectedLayers:
thisGlyph.RSB = 30
thisGlyph.LSB = 30
And that works, but how can I make it do all the layers in the glyph?
This is my first script so excuse my derp. This is what I tried:
for thisGlyph in Glyphs.font.selectedLayers:
thisGlyph.RSB = 30
thisGlyph.LSB = 30
And that works, but how can I make it do all the layers in the glyph?
Actually you only set new RSB and LSB for selected layers.
If you want to this for all layer of a glyph you need :
for layer in Glyphs.font.selectedLayers:
# Access to the glyph
glyph = layer.parent
# Access to all layer of the glyph
for layer in glyph.layers:
layer.RSB = 30
layer.LSB = 30
I know, hence the reason for my question. But thank you, your code is exactly what I needed.
Or set the metrics keys:
for sl in Font.selectedLayers:
g = sl.parent
g.leftMetricsKey = "=30"
g.rightMetricsKey = "=30"
for l in g.layers:
l.syncMetrics()
Or set the =30
on one glyph and add =glyphname
to all other glyphs (replace glyphname
with the name of the first glyph).
Also a good idea.