No unicode != no unicode

Hi all,

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 ',
	print 'no unicode: |',thisGlyph.unicode,'| in ',
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?



for sure, the .notdef has not really a unicode!?

You always have to check for the length of the unicode string. just checking .unicode is not nil is not enough.

ok I will use more ‘len’ to check and take care of this. thank you