Setting sortName from python

Is there a way to set sortName from Python, I tried glyph.glyphInfo.sortName = "foo" but got:

AttributeError: can't set attribute

I tried also glyph.sortName = "foo" but got

AttributeError: 'NSKVONotifying_GSGlyph' object attribute 'sortName' is read-only

Set it directly on the glyph. It is not in the wrapper, yet.

glyph.setStoreSortName_(True)
glyph.setSortName_("Hallo")
print(glyph.sortName())
1 Like

Thanks!

You can try dir(glyph) if you don’t find what you are looking for. Rainer has a script that helps with that.

Thanks, I already did that but didn’t occur to me to look for set functions (I also try to avoid using what looks like private functions).

Some of those functions are documented in the Core section of the docs. Omission doesn’t necessarily mean it is supposed to be private, just that I didn’t manage to finalize the documentation.

If you find a function with dir() that would be useful for you, you can report it so that I can add it to the wrapper and/or document it properly.

2 Likes

I’ll keep that in mind, thanks!

Try Script > mekkablue > App > Method Reporter:

image

1 Like