GSFont.newTab(layers) doesn't accept [GSControlLayer(10)]

According to the docs, GSControlLayer(10) is the recommended way of adding line breaks to the list of layers that forms the text in an Edit View tab. However this only seems to work on existing tabs, not on new tabs.

Test script:

text = [


Traceback (most recent call last):
  File "<macro panel>", line 6
  File "GlyphsApp/GlyphsApp/", line 4369, in __GSFont__addTab__
ValueError: NSInvalidArgumentException - *** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]

Have you tried the “string” property. That might be easier.

What Glyphs version is that?

The GSGlyph.string property only works for encoded glyphs.

I was able to work around the issue by creating an empty tab and then assigning the layers to it. I just wanted to report the bug because it’s tripped me up a few times before. I’m running the latest Glyphs 3.1.2 (3151).

its not.

character = font.characterForGlyph_(glyph)

It uses high plane PUA codes for unencoded glyphs. The string property is what Glyphs uses internally.

This is fixed in the latest cutting edge version.

Right, I think I understand how you’re using PUA codes behind the scenes. But are you suggesting that the value of GSGlyph.string is supposed to be a PUA character if the glyph is unencoded? It is always an empty string '' for unencoded glyphs.

For example,


You get the code from the method I mentioned above. glyph.string is something else.