Fix parsing for integer numbers
This commit is contained in:
parent
8be789b134
commit
1c0ec91fe1
|
@ -19,7 +19,7 @@ import re
|
||||||
|
|
||||||
class SVGFile(object):
|
class SVGFile(object):
|
||||||
|
|
||||||
pathre = re.compile(r"[MCL]? *((-?\d+\.\d+) (-?\d+\.\d+) *)+")
|
pathre = re.compile(r"[MCL]? *((-?\d+(\.\d+)?) (-?\d+(\.\d+)?) *)+")
|
||||||
transformre = re.compile(r"matrix\(" + ",".join([r"(-?\d+(\.\d+)?)"] * 6) + "\)")
|
transformre = re.compile(r"matrix\(" + ",".join([r"(-?\d+(\.\d+)?)"] * 6) + "\)")
|
||||||
|
|
||||||
def __init__(self, filename):
|
def __init__(self, filename):
|
||||||
|
@ -38,7 +38,7 @@ class SVGFile(object):
|
||||||
0,1,0]
|
0,1,0]
|
||||||
for m in self.pathre.findall(attrs.get("d", "")):
|
for m in self.pathre.findall(attrs.get("d", "")):
|
||||||
x = float(m[1])
|
x = float(m[1])
|
||||||
y = float(m[2])
|
y = float(m[3])
|
||||||
tx = matrix[0]*x+matrix[2]*y+matrix[4]
|
tx = matrix[0]*x+matrix[2]*y+matrix[4]
|
||||||
ty = matrix[1]*x+matrix[3]*y+matrix[5]
|
ty = matrix[1]*x+matrix[3]*y+matrix[5]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue