Propagate component to all selected glyphs & masters

I’m trying to propagate components to all masters and layers in the selection, and while I can get the component into all the selected glyphs, or into all the masters of a selected glyph, I can’t get it to all masters of all the selected glyphs.

I feel like I’m missing something really obvious.

All selected layers:

for layer in font.selectedLayers:
    layer.components.append(GSComponent(source))

All masters of selected glyph:

for layer in glyph.layers:
    layer.components.append(GSComponent(source))

“source” refers to user input variable that identifies the glyph to use as a component by name.

Cheers

Hi
I think that you need this Mekka script.
Cheers

This isn’t quite what I had in mind, but maybe I’ll be able to scavenge some of that script into my own.

Thanks for the suggestion :slight_smile:

for layer in font.selectedLayers:
    glyph = layer.parent
    for glyphLayer in glyph.layers:
        glyphLayer.components.append(GSComponent(source))

I was going to say I tried it and it didn’t work, but I was using layer.components, instead of glyphLayer.components… like I mentioned, something stupidly obvious. :man_facepalming:

Thanks Georg