Hi,
I want to increase the width of all my glyphs 27 points extra from the right side,
Please advise ?
font = Glyphs.font
for glyph in font.glyphs:
glyph.weight += 27
Hi,
I want to increase the width of all my glyphs 27 points extra from the right side,
Please advise ?
font = Glyphs.font
for glyph in font.glyphs:
glyph.weight += 27
The glyph itself has no width. The layers in the glyph have.
font = Glyphs.font
for glyph in font.glyphs:
for layer in glyph.layers.values():
layer.width += 27
Do you need the values()
? It should work without, I believe.
well done, thanks, this is my final script:
font = Glyphs.font
for glyph in font.glyphs:
if glyph.selected:
glyph.color = 1 # orange
print glyph.name
for layer in glyph.layers:
if layer.name == 'Bold':
print layer.name
layer.width += 27
If you like to target a specific master I would suggest this:
font = Glyphs.font
for layer in font.selectedLayers:
layer.parent.color = 1 # orange
print layer.parent.name, layer.name
layer.width += 27
or with a bit more control:
font = Glyphs.font
master = font.selectedFontMaster
for layer in font.selectedLayers:
glyph = layer.parent
glyph.color = 1 # orange
masterLayer = glyph.layers[master.id]
print glyph.name, masterLayer.name
masterLayer.width += 27
Thanks again,