RemoveOverlap() error on glyph copy



  • I am trying to perform remove overlap on a copy of a glyph, and get an error. Remove overlap works fine on normal glyphs, though.

    Is this a bug, or is there a reason that parentless glyph copies can't remove overlap?

    For example:

    g = CurrentGlyph()
    gCopy = g.copy()
    print g, gCopy           # to show these are not None
    g.removeOverlap()        # works okay
    gCopy.removeOverlap()
    

    Output:

    Traceback (most recent call last):
      File "", line 5, in 
      File "lib/fontObjects/robofabWrapper.pyc", line 2128, in removeOverlap
      File "lib/tools/removeOverlap.pyc", line 35, in removeOverlap
      File "lib/fontObjects/doodleBaseGlyph.pyc", line 141, in _get_segmentType
    AttributeError: 'NoneType' object has no attribute 'segmentType'
    

    Thanks!


  • admin

    ah typo bug, thanks for posting

    a temporarily workaround could be could be

    g = CurrentGlyph()
    
    # create a copy layer and copy the glyph to that layer 
    gCopy = g.copyToLayer("copyLayer")
    
    print g, gCopy # to show these are not None
    print gCopy.getParent()
    
    g.removeOverlap() # works okay
    gCopy.removeOverlap()
    

    (edited your post a bit)



  • thanks frederik! that workaround will certainly do for now...


Log in to reply