How to turn on Localized Form and Language(i.e. Polish) on new tab?

I’'ve successfully turned on locl feature on the current tab. Is there a way to turn on a specific language with python?

I only know you can query it with:

print Font.currentTab.selectedScript()

Ok.

What I’m trying to do is opening a new tab with a string of specific language and if that language exist in locl feature I’ll turn it on locl and latn MOL, for example, in the edit view. Would be nice to be able to set it though python.

You can set the script/language like this:

Tab.setSelectedScript_("latin ROM") # for Romanian 

I tried

font = Glyphs.font
currentTab = font.currentTab
currentTab.setSelectedScript_("Latin ROM")

but get en error:

Traceback (most recent call last):
  File "<string>", line 24, in <module>
AttributeError: 'NSKVONotifying_GSEditViewController' object has no attribute 'setSelectedScript_'

Am I doing something wrong?

Probably in an upcoming beta version. I am afraid you will have to be a little patient on that one.

Ok, thanks for the help. I understand it might not be the main priority.

I tried it and this works:

Font.currentTab.setValue_forKey_("latn ROM", "selectedScript")

Note the abbreviated script tag. To get the proper syntax, set the value manually and then run this:

print currentTab.selectedScript()
2 Likes

Thanks Georg, that worked!
I’ll get all the abbreviation and script name in Glyphs.languageData list.