Accessing Stylistic Set Names in Glyphs 3 with Python Script

Hi Glyphs team,

I am in need to access the Feature Name field in the feature view in Glyphs 3. Documentation for GSFeature does not mention this data point. It seems that Glyphs 3 parses the text of the GSFeature.notes after the Name: . Can it be accessed by Glyphs API?


You can get the full name like it is display in the Feature menu in Edit View with the fullName method:

# "Stylistic Set 1 (Some feature name)"

If you just want the custom name, use the labels method:

# ("<GSFontInfoValue 0x600003bf6b20> dflt:Some feature name")

The labels method returns a list of GSFontInfoValue, one for each language. Use it like so:

for feature in Font.features:
	for label in feature.labels():
		lang = label.languageTag
		isDefaultLang = label.isDefault()
		name = label.value
		print(f"lang={lang} default={isDefaultLang}: {name}")

This would print something like the following:

lang=dflt default=1: Some feature name 
1 Like

Note that in Glyphs 3, the name should be set at the top of the feature code editor, not in the notes field:


Thank you @FlorianPircher, this is what I needed.