Problem getting currentTab.text in a nice text format

Hi.

I’m trying extract the current tab’s text with currentTab.text. The problem I have is that some characters will be written out as “/glyphname”, eg. /cacute or /quoteright instead of their respective glyph.

The API docs#GSEditViewController says currentTab.text should output: The text of the tab, either as text, or slash-escaped glyph names, or mixed.

Is there a way to get them as “regular” text?
Or is there a convenient way to replace '/glyphname’s with respective character?

First post, hope it’s clear what I’m trying to achieve.
Thanks!

I changed it that it will give more glyphs as a character instead of the slashed name. But all glyphs without a unicode will still show up like this.

Great! That makes sense I think. When can I expect to able to use it? In the next ‘cutting edge’ update?

Yes.

Ok, Thanks!

Bumping this because I am confused with the way Glyphs.font.currentText returns “text, or slash-escaped glyph names, or mixed”.

How can I tell it to give me all the characters in the same format?

PS: what is the difference between Glyphs.font.currentText and Glyphs.font.currentTab.text?

They are supposed to return the same. I fixed that.

But if I would need to iterate over the text, I always would go through the layer directly: Glyphs.font.currentTab.composedLayers

1 Like

Thanks, I’ll give that a try and report back!

@GeorgSeifert how to access only the nice name?

for glyphs in Glyphs.font.currentTab.composedLayers:
	print(glyphs)

results

<GSLayer "bold" (heh-ar.init)>
<GSLayer "bold" (heh-ar.medi)>
<GSLayer "bold" (heh-ar.fina)>

how to get only the nice name like heh-ar.init in the first glyph
thank you

i found a solution by calling the parent then call the name

for glyphs in Glyphs.font.currentTab.composedLayers:
	print(glyphs.parent.name)
Font.currentTab.text