Robofab: why does removeOverlap() not work on a copy made with copy()?

blank's picture

I am working on a python script that find glyphs containing overlaps by making a copy, removing its overlaps, and checking for a difference in anchor points between the copy and the original. I make my copy like this:

copy = glyph.copy()

But when I try to remove overlaps in the copy:

copy.removeOverlap()

Fontlab give this error:

AttributeError: 'RGlyph' object has no attribute 'removeOverlap'

What am I doing wrong?

pvanderlaan's picture

As far as I can see you are trying to apply a FontLab-specific method (‘removeOverlap()’) on a glyph object that is not in FontLab itself. The copy() constructor gives you an RF Glyph object but as long as it doesn’t have a place in your FontLab file you cannot apply FontLab-specific methods. See: http://robofab.org/objects/glyph.html

Use f['some_glyph_name'].appendGlyph(copy) to create a copy of the glyph in your FontLab file. Then you can remove the overlap and start comparing coordinates.

HTH.

Syndicate content Syndicate content