List of glyphs with name and the character

I’m trying to export a list that connects the glyph name to the character itself. So for example:
Aacute Á
Aring Å

I’ve used this simple script from the scripting tutorial for exporting the list with unicode, but when I try to use ‘char’ as a variable, it doesn’t seem to work. I tried this because it lists it as ‘char’ in the Glyph Info window. Is there another variable I can use to get this list?

for myGlyph in Glyphs.font.glyphs:
    print myGlyph.char
1 Like

Perhaps try myGlyph.string per the documentation:

You might try this:

for myGlyph in Glyphs.font.glyphs:
    print, myGlyph.string, myGlyph.unicodeChar()
1 Like

String! Perfect, thanks a lot guys.

Is it possible to find the width of the glyph there as well? Like the one that is exported into a metrics file? Can’t seem to find it in the documentation, but should be there no?

You’ll want to look at individual layers of the glyph. For example, myGlyph.layers[0].width will show the width of the first indexed GSLayer of myGlyph. Keep in mind there may be other layers of the glyph and this doesn’t take into account multiple masters, other layers, interpolated instances, etc.

This should be enough, thanks!