For example a script is going through components in every glyph and it gets to ‘Dcroat’ and I only want to unlock the ‘base’ glyph, ‘D’, what’s the best way of going through that. I thought I could maybe look at the GSGlyphInfo but this won’t work for arbitrary glyphs that have base components and attached components?
You might try:
shape = component.componentLayer.shapes[0]
if isinstance(shape, GSComponent):
print("this is a nested component")
(component.componentLayer is the layer the component is linking too.)
I don’t think that’s what he means. I think this is about targeting the base letter component in a glyph, such as D in Dcroat, instead of strokeshortcomb.case.
He wants to find the first component in a glyph. Does Layer.components[0] not work?
1 Like
You can check for GSGlyph.category of the referenced glyph.
@mekkablue Doesn’t work, as I said, there are arbitrary glyphs where I have base glyphs and attached components set up, and I can’t find it through scripting.
@SCarewe I think that is the right solution!
component.doesAlign()
might work. It is true for base glyphs and false for accents. But I’m not sure how reliable it is.