GSGlyphsInfo for setting glyph category

Hi, how should I do for setting the subCategory of a glyph? I didn’t manage with the documentation. Thanks!

font = Glyphs.font
for glyph in font.selection:
    thisGlyphInfo = font.glyphsInfo().glyphInfoForName_(glyph.name)
    How should I set the subCategory?
    thisGlyphInfo.subCategory = "Conjunct"
font = Glyphs.font
for layer in font.selectedLayers:
    glyph = layer.parent
    glyph.subCategory = "Conjunct"

Technically, you cannot select glyphs in Glyphs, only layers. But once you have the glyph, you can access its subCategory directly.

The glyphInfo objects are only there to store the default value for that glyph(name). You can change it by setting up your own glyphData: Roll your own glyph data | Glyphs

Cool, thank you both!

I noticed this doesn’t set explicitly the “Info for selection”, is there a way to do that?

So you have the custom GlyphData? And the subcategory is set to “Conjunct”? What else do you expect to happen. The gray entry means it is value from the GlyphData (either default or the custom file).

Not using custom GlyphData. We’re building the fonts with fontmake (maybe it’s a fontmake bug, no problem). When set/checked explicitly in the dialog the marks work, otherwise they don’t. I just expect to find a workaround that makes my life easier.
I just realized that I can set the subcategory for all selected glyphs with one click, so I guess that will make it. We’ll see…

Default glyphs work but not the alternates which have the same default values in the dialog (we have alternates for some conjunts).

The you need to run this script:

font = Glyphs.font
for layer in font.selectedLayers:
    glyph = layer.parent
    glyph.storeCategory = True
    glyph.storeSubCategory = True

Great. Thanks.