Decompose components without adding anchors

I frequently use the Add Component function to bring in pieces of glyphs into another glyph as a starting point. I then want to decompose these components to modify the outlines. However, if the component had anchors they are added to the glyph I’m working on and in some cases this is not desired. For instance if the added anchors make the current master incompatible with another master.
Is there a way to decompose a component without adding anchors?

If you have no anchors on your base glyph, it wouldn’t add any anchors when decomposing.

Other than that you can add a shortcut(bind F10 for example) to a script from Mekka/Anchors/Delete All Anchors and Voila.

Yes, but part I’m adding as a component has anchors that need to be kept and the glyph I’m adding it to has anchors that are needed. I feel like there should be a way to just add the outlines from another glyph other than copying and pasting. Maybe a solution could be to hold down a modifier key while choosing “Decompose Components”.

1 Like

I see what I can do.

edit: I added an option to the decompose method in the python wrapper. That way you can write a small script that does what you need.

Thanks Georg. How do I access that option?
I have:

layer = Glyphs.font.selectedLayers[0] #curret layer 
for thisComponent in layer.components:
	if thisComponent.selected:

I assume something needs to go in the parentheses… I just couln’t find what. I tried print help(thisComponent.decompose()).

You would be changing what you are iterating over while you are iterating over it. And you cannot do that. One solution is to count down the range(len(layer.components))[::-1] and use the index number for accessing the component.

or just copy the list:

for thisComponent in list(layer.components):
	# do stuff

The .decompose() method has two arguments: doAnchors = True and doHints = True.