Glyphs suffix script

Hello! is there any script to select a bunch of glyphs (lets say a.001, b.003, h.006) and rename all of them with same suffix like a.ornm, b.orn, etc?

You can search and replace. In this case you would need a regular expression, or just run it a few times.

Maybe you can filter the glyphs using a regular expression like .*\d. Then select all glyphs and do a find and replace with regex, using \d+ in “find” textbox and orn in “replace” textbox.

it doesnt work that way because there are some .001 that I dont want to replace. Basically my instruct is "all this glyphs I selected replace suffix by .xxx), is difficult?

Running this should work for selected glyphs. Just change newSuffix to what you want.

newSuffix = 'ornm'
for l in Glyphs.font.selectedLayers:
    if '.' in l.parent.name:
	    baseName = l.parent.name.partition('.')[0]
    else:
	    baseName = l.parent.name
    l.parent.name = '{0}.{1}'.format(baseName, newSuffix)

No need for script really.

.ss20 is an example, substitute for anything

2 Likes

This is how Find and Replace works. It uses your selection.

@mekkablue But I dont want to find any glyph, I want to change all the glyphs I selected that uses any kind of suffix and want to change them for .ornm

Yes. That is what he is saying.

Yes, the @RobPratley one is working! cool, thanks

That’s what I have been saying, man. Find and replace means: find and replace in glyph names. select the Glyphs you want to rename, then press Cmd-Shift-F.