(solved) Convert unicode to glyph names in script

Hello, is there some way of taking unicode glyph names (such as uni041B) and turning them into nice glyph names – within a script? Essentially, I would like to open a new tab with Font.newTab("/uni041B"), but this doesn’t work.


Edit: a simple "\u041B"does the trick.

Edit 2: Almost. I got this to work:

if glyph_name.startswith("uni"):
    glyph_name = chr(int(glyph_name.replace("uni", ""), 16))

Note that glyphs with code points above 0xFFFF are typically named u#####.

Thank you. So far, I have not encountered any. Does fontbakery do the same?

Not sure, but probably.

You can get a glyph by code point like so:

glyph = font.glyphs['01AF']
1 Like

Gosh, thanks, I should have tried that. I only, stupidly, tried Font.glyphs["uni041B"].

You can also use: