Sort order of given glyphs?

Anyway to use Glyphs to input a list of glyphs and get a sorted list back? Like the order used in the default Font tab (without a glyphorder parameter)

What do you need at the end? A list of glyph names or do you like to sort a list of glyphs objects?

Just a list of glyphs names :slight_smile: it’s for my compare fonts script which ends up returning a bit of a nonsense order

So glyphList = [g.name for g in Glyphs.font.glyphs] is not what you want?

1 Like

Not exactly! But it gave me this idea :smiley:

ListOfSelectedGlyphs = [ l.parent.name for l in Font.selectedLayers ]
sortedList = [g.name for g in Glyphs.font.glyphs if g.name in ListOfSelectedGlyphs]

So you just want the glyphNames of the selected Glyphs?
Why not use this: selectedGlyphs = [x.parent.name for x in Glyphs.font.selectedLayers]

Anyway, you might know where to go :smile:

No that was just an example.

That’ doesn’t work for what I need as it doesn’t sort it. I want a list of glyph names to be sorted according to the order in the Font tab. I have a solution now :sweat_smile:

OK, good to hear :slight_smile: