Select Glyphs with paths

Hi everyone!

Since I am new at scripting but I want to start doing my own scrips in order to know how to code I have a question of a simple script (I think).

When I am starting a design of a typeface I have just few characters with paths that I’m using frequently. Since I don’t want to go and click each of them separately I would like to have some hints about how to write a script that selects only glyphs with paths in them. Can anyone help me in this way? I read Glyphs’ API and some similar scripts from Rainer but maybe someone can bring me some help in this way.

Thank you so much in advance,
Ricard.

1 Like

Hi Ricard.

You have a good idea of what you want to do, so break this down in relation to the scripting API documentation. Once you’ve got the hang of how things are accessed, it should come quite quickly (so: GSPath objects are under GSLayer objects, GSLayer objects are under GSGlyph objects etc).

In short: loop through all the glyphs in the font, then check if the count of the number of paths is not zero. If this returns true (i.e.: there are paths), then you’ll likely want to put that glyph (possibly retrieving its glyph name) into a type of python container.

Hopefully thats helpful but suitably vague - figuring it out is half of the fun.

2 Likes

Thank you so much Rob! I’ll try to do it this way, I prefer to code in order to learn about it. I think it will be “simple”.