LSB Scripting using the API

2018 goal is to get into Python and I wanted some help/an example to study.

How would one write a basic script to select all glyphs in a font and reset the LSB/RSB of each to 0? Completely academic as I know you can do this in the app quite easily.

currentFont = Glyphs.font
for thisGlyph in currentFont.glyphs:
	for thisLayer in thisGlyph.layers:
		thisLayer.LSB = 0
		thisLayer.RSB = 0

Start here: We have some tutorials for learning Python with Glyphs.

Thank you much appreciated!

I just wanted to follow up regarding the thisLayer, thisGlyph classes - are these documented anywhere? I could not see them in the Glyphs API docs. I mean it is obvious in readable text what they do but how many of these are there?

thisLayer and thisGlyph are variable names for GSLayer and GSGlyph objects. They are documented on

If you do ‘print thisLayer’ it will tell you the class name that you can look up in the docu.

Thanks guys, apologies for the utter beginner questions!

Wrote my first very simple proofing script to take a width and then return a list of glyph names that are not at that width.

1 Like