Remove empty m0,0 segments

This commit is contained in:
Jeff Schiller 2010-07-13 09:14:17 -07:00
parent 5f8139a6e3
commit b68f8483c7
3 changed files with 19 additions and 1 deletions

View file

@ -1670,7 +1670,14 @@ def cleanPath(element, options) :
cmd, data = path[pathIndex]
i = 0
if cmd in ['m','l','t']:
if cmd == 'm': i = 2
if cmd == 'm':
# remove m0,0 segments
if data[0] == data[i+1] == 0:
# 'm0,0 x,y' can be replaces with 'lx,y'
path[pathIndex] = ('l', data[2:])
numPathSegmentsReduced += 1
else: # else skip move coordinate
i = 2
while i < len(data):
if data[i] == data[i+1] == 0:
del data[i:i+2]