Glyphs suffix script


#1

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?


#2

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


#3

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.


#4

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?


#5

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)

#6

No need for script really.

.ss20 is an example, substitute for anything


#7

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


#8

@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


#9

Yes. That is what he is saying.


#10

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


#11

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.