Hello,
I am trying to clear all contour data from a glyph’s layer (‘mask’).
Because I could not find a removeGlyph() method, I am using removeSegment().
I parse the glyph’s contours and the contours’s segments and delete the first segment.
g = CurrentGlyph()
print g
g.prepareUndo()
mask = g.getLayer("mask")
mask.prepareUndo()
for c_index in range(len(mask)):
print 'contour:', c_index
for s_index in range(len(mask[c_index])):
print '--segment:', s_index
print mask[c_index][0].type
print len(mask[c_index])
mask[0].removeSegment(0)
mask.update()
g.update()
But all I manage to do is to remove the first contour (contour 0), then I got an error:
“list index out of range”
Any help would be greatly appreciated :)