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 = [
Font.glyphs['A'].layers[0],
GSControlLayer(10),
Font.glyphs['B'].layers[0],
]
Font.newTab(text)
Error:
Traceback (most recent call last):
File "<macro panel>", line 6
File "GlyphsApp/GlyphsApp/__init__.py", line 4369, in __GSFont__addTab__
ValueError: NSInvalidArgumentException - *** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]
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).
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.
@GeorgSeifert I noticed this is still broken in cutting edge 3251. Font.newTab([Layer,GSControlLayer(10),Layer]) no longer throws an error, but it doesn’t put any line breaks in the new tab either. It just ignores them.