I’m on my way to write and test a script.
I have to know wether a Glyph has a Unicode or not.
By accident I discovered that my branch does not catch every option:
Let me say there are two Glyphs:
One is the infamous ‘.notdef’ and
the other is just a non-standard Glyph (f.e. with a name ‘Test’ (so got no unicode)).
for thisLayer in Glyphs.font.selectedLayers:
thisGlyph = thisLayer.parent
if thisGlyph.unicode != None: print 'some unicode: |',thisGlyph.unicode,'| in ',thisGlyph.name else: print 'no unicode: |',thisGlyph.unicode,'| in ',thisGlyph.name if thisGlyph.unicode == '': print "seems to be a string?\n"
some unicode: | | in .notdef
seems to be a string?
no unicode: | None | in Test
There seems to be a difference between unicode -> None and Unicode -> ‘’?
But why? it is sufficient to add ‘if no string’ to the branch or is there a better way?