Fixed crash in line2pathd() (#101)

* Fixed crash in line2pathd().

* Further fixed to support implicit attributes
pull/114/head
Antoine Beyeler 2020-06-20 03:58:25 +02:00 committed by GitHub
parent 538b8777e1
commit b117f85811
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -90,8 +90,13 @@ def rect2pathd(rect):
"".format(x0, y0, x1, y1, x2, y2, x3, y3))
return d
def line2pathd(l):
return 'M' + l['x1'] + ' ' + l['y1'] + 'L' + l['x2'] + ' ' + l['y2']
return (
'M' + l.attrib.get('x1', '0') + ' ' + l.attrib.get('y1', '0')
+ 'L' + l.attrib.get('x2', '0') + ' ' + l.attrib.get('y2', '0')
)
def svg2paths(svg_file_location,
return_svg_attributes=False,