New tab with sorted glyphs

Hey there,

I’m writing a script using part of Rainer’s script Report Highest and Lowest Glyphs that generates a list of the tallest glyphs in font until they get to its capHeight and the lowest glyphs until they reach the baseline.

I can access the name of the glyph but I’m not sure how to open a new tab with this. I’ve experienced before that, if I translate these glyphs into strings those glyphs that don’t have a Unicode value wouldn’t be in the new tab’s text. Any idea how to use these data that I already have to open a new tab with these characters?


There are several script in Rainer repo that show how to do that.

You can use one of the snippets from the Python for Glyphs repository, I think it is simply tab (the three letters) followed by a tab (the key on the left side of your keyboard).

Thank you so much, Rainer. I’ve managed to do what I wanted. I forgot about the / trick before the name of the glyph so I could add the slash before the name and then open a new tab with it.

Also, I have another question about something I’m not used to. (I don’t want to bother with a lot of new posts)
I want to get the Glyph object of these glyphs I’ve sorted and, while Font.selection returns this:

    "GSGlyph <0x7fbabdf041c0>: A"

If I append a GSGlyph of each glyph of my sorted list to a new list of GSGlyph objects like this newList.append(GSGlyph('A')) it returns a different kind of object I can’t use as a glyph:

<GSGlyph "A" with 0 layers>

I would appreciate very much help in this sense since I would like to use this data to create proofs.

Thank you so much.

Not sure what you want to do…? But here is some info that may be useful:

  1. Font.selection gives you a tuple, not a list.
  2. GSGlyph('A') creates a new GSGlyph object in memory (not in a font yet).
  3. Font.glyphs['A'] returns the glyph A of Font.

What do you need the list of glyphs for?

1 Like

Oh, thanks! Well what I would like to have is a tuple with these glyphs just like Font.selection has.

Since I have a sorted list of glyphs’ names I thought I could create it using their names.

Thanks for your help @mekkablue. It solved the problem by understanding that what I needed was the glyph of the point 3.

Thanks again.