Move Tree_of_Life_SVG.svg (revision 188) from unittests to fulltests. Whoops!
Partial fix for bug 603987: Allow curves representing straight lines to become LineTo commands (and possibly HorizontalLineTo and VerticalLineTo afterwards). Fix a bug whereby an initial M0,0 in path data is lost, making the path unrenderable.
This commit is contained in:
parent
939c7e1b97
commit
87b7908465
2 changed files with 4 additions and 3 deletions
|
Before Width: | Height: | Size: 2.6 MiB After Width: | Height: | Size: 2.6 MiB |
7
scour.py
7
scour.py
|
|
@ -1672,8 +1672,9 @@ def cleanPath(element, options) :
|
||||||
if cmd in ['m','l','t']:
|
if cmd in ['m','l','t']:
|
||||||
if cmd == 'm':
|
if cmd == 'm':
|
||||||
# remove m0,0 segments
|
# remove m0,0 segments
|
||||||
if data[0] == data[i+1] == 0:
|
if pathIndex > 0 and data[0] == data[i+1] == 0:
|
||||||
# 'm0,0 x,y' can be replaces with 'lx,y'
|
# 'm0,0 x,y' can be replaces with 'lx,y',
|
||||||
|
# except the first m which is a required absolute moveto
|
||||||
path[pathIndex] = ('l', data[2:])
|
path[pathIndex] = ('l', data[2:])
|
||||||
numPathSegmentsReduced += 1
|
numPathSegmentsReduced += 1
|
||||||
else: # else skip move coordinate
|
else: # else skip move coordinate
|
||||||
|
|
@ -1736,7 +1737,7 @@ def cleanPath(element, options) :
|
||||||
foundStraightCurve = True
|
foundStraightCurve = True
|
||||||
else:
|
else:
|
||||||
m = dy/dx
|
m = dy/dx
|
||||||
if p1y == m*p1x and p2y == m*p2y:
|
if p1y == m*p1x and p2y == m*p2x:
|
||||||
foundStraightCurve = True
|
foundStraightCurve = True
|
||||||
|
|
||||||
if foundStraightCurve:
|
if foundStraightCurve:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue