MM-aware remove overlap?

For work on variable fonts, or really any multiple master project, it would be handy to have a remove overlap function that works on all layers, but keeps them compatible if possible.

I tried to write a script that simply tries to remove overlaps on a copy of the glyphs, and keeps the changes only if the glyphs are still compatible. But this doesn’t seem to work, the temporary glyph is always reported as compatible after remove overlap, even if it really isn’t.

You can find the script on my GitHub repo.

Any ideas?

3 Likes

Without looking at the code: what might happen is that the glyph needs to have a set parent. It will look for instances to calculate what masters are actually interpolated. There are two methods on GSGlyph that can help: mastersCompatibleForLayerIds_() and mastersCompatibleForLayers_(). If you have brace or bracket layers, you would need to calculate the layers/grouping yourself.

Thank you! It worked.