Fix loading numbers in form 'Xe-Y'

This commit is contained in:
2023-03-09 15:04:29 +02:00
parent a301851980
commit fe1a40cbc2

View File

@@ -118,16 +118,19 @@ class SVGProcessor():
# Numbers # Numbers
if c == '+' or c == '-' or c.isdecimal(): if c == '+' or c == '-' or c.isdecimal():
s = c s = c
isdelim = lambda x: x.isspace() or x.isalpha() or x in [',', '+'] isdelim = lambda x: x.isspace() or (x.isalpha() and c != 'e') or x in [',', '+']
while i < len(pathstr) and not isdelim(c): while i < len(pathstr) and not isdelim(c):
c = pathstr[i] c = pathstr[i]
if not isdelim(c): if not isdelim(c):
s = s + c s = s + c
if c.isalpha(): if c.isalpha() and c != 'e':
break break
i += 1 i += 1
path.append(s) path.append(s)
#print(path)
#input()
# Parser # Parser
self.logger.info("Parsing path :'{}...' with {} tokens".format(path[:20], len(path))) self.logger.info("Parsing path :'{}...' with {} tokens".format(path[:20], len(path)))
x = 0.0 x = 0.0
@@ -431,7 +434,7 @@ class SVGProcessor():
Simplify line with https://pypi.org/project/simplification/ Simplify line with https://pypi.org/project/simplification/
""" """
# For RDP, Try an epsilon of 1.0 to start with. Other sensible values include 0.01, 0.001 # For RDP, Try an epsilon of 1.0 to start with. Other sensible values include 0.01, 0.001
epsilon = 0.0001 epsilon = 0.001
tmp = [] tmp = []
out = [] out = []