Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in the path parsing #185

Open
pwichmann opened this issue Aug 24, 2022 · 1 comment
Open

Error in the path parsing #185

pwichmann opened this issue Aug 24, 2022 · 1 comment

Comments

@pwichmann
Copy link

pwichmann commented Aug 24, 2022

Many thanks for a useful library.

I think the path parsing methods still contain errors:
The following path is a valid SVG path:
M12 22a10 10 0 110-20 10 10 0 010 20z.
It is a minified path with two consecutive a commands. In those cases, the repeated a can be omitted. Furthermore, the binary flags can be written without separating whitespace.

The path can be visualised using this neat tool:
https://svg-path-visualizer.netlify.app/#M12%2022a10%2010%200%20110-20%2010%2010%200%20010%2020z

However, it cannot be parsed by svgpathtools.

File "/Users/pascalwichmann/anaconda3/envs/stg/lib/python3.9/site-packages/svgpathtools/parser.py", line 15, in parse_path
return Path(pathdef, current_pos=current_pos, tree_element=tree_element)
File "/Users/pascalwichmann/anaconda3/envs/stg/lib/python3.9/site-packages/svgpathtools/path.py", line 2439, in init
self._parse_path(segments[0], current_pos)
File "/Users/pascalwichmann/anaconda3/envs/stg/lib/python3.9/site-packages/svgpathtools/path.py", line 3304, in _parse_path
arc = float(elements.pop())
ValueError: could not convert string to float: 'z'

I found various other paths that also do not work (but have not checked if the cause is identical).

@pwichmann
Copy link
Author

Interestingly, the original svg.path is able to parse it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant