From 87b79084654d76502ac49e5a4375511253f0cde5 Mon Sep 17 00:00:00 2001 From: Louis Simard Date: Fri, 16 Jul 2010 22:04:22 -0400 Subject: [PATCH] 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. --- .../Tree_of_life_SVG.svg => fulltests/Tree_of_Life_SVG.svg | 0 scour.py | 7 ++++--- 2 files changed, 4 insertions(+), 3 deletions(-) rename unittests/Tree_of_life_SVG.svg => fulltests/Tree_of_Life_SVG.svg (100%) diff --git a/unittests/Tree_of_life_SVG.svg b/fulltests/Tree_of_Life_SVG.svg similarity index 100% rename from unittests/Tree_of_life_SVG.svg rename to fulltests/Tree_of_Life_SVG.svg diff --git a/scour.py b/scour.py index c7d70db..a8932a5 100755 --- a/scour.py +++ b/scour.py @@ -1672,8 +1672,9 @@ def cleanPath(element, options) : if cmd in ['m','l','t']: if cmd == 'm': # remove m0,0 segments - if data[0] == data[i+1] == 0: - # 'm0,0 x,y' can be replaces with 'lx,y' + if pathIndex > 0 and data[0] == data[i+1] == 0: + # '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:]) numPathSegmentsReduced += 1 else: # else skip move coordinate @@ -1736,7 +1737,7 @@ def cleanPath(element, options) : foundStraightCurve = True else: m = dy/dx - if p1y == m*p1x and p2y == m*p2y: + if p1y == m*p1x and p2y == m*p2x: foundStraightCurve = True if foundStraightCurve: