Fix conversion of cubic Bézier "curveto" commands into "shorthand/smooth curveto" commands.
When the preceeding path segment is a Bézier curve, too, the first control point of the shorthand defaults to the mirrored version of the second control point of this preceeding path segment. Scour always assumed (0,0) as the control point in this case which could result in modified path data (e.g. #91).
This commit is contained in:
parent
0fac95ee09
commit
2e6d34aa5a
1 changed files with 7 additions and 1 deletions
|
|
@ -2193,7 +2193,13 @@ def cleanPath(element, options) :
|
|||
newPath.append( (cmd, lineTuples) )
|
||||
# convert Bézier curve segments into s where possible
|
||||
elif cmd == 'c':
|
||||
bez_ctl_pt = (0,0)
|
||||
# set up the assumed bezier control point as the current point, i.e. (0,0) since we're using relative coords
|
||||
bez_ctl_pt = (0, 0)
|
||||
# however if the previous command was 's' the assumed control point is a reflection of the previous control point at the current point
|
||||
if len(newPath):
|
||||
(prevCmd, prevData) = newPath[-1]
|
||||
if prevCmd == 's':
|
||||
bez_ctl_pt = (prevData[-2]-prevData[-4], prevData[-1]-prevData[-3])
|
||||
i = 0
|
||||
curveTuples = []
|
||||
while i < len(data):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue