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

Added support for elliptical arc commands sequence after a single "a" #143

Merged
merged 2 commits into from
Jan 14, 2019

Conversation

elisar4
Copy link
Contributor

@elisar4 elisar4 commented Dec 25, 2018

Current behaviour:
print "*** Error: Invalid number of parameters for A command"
and abort parsing SVG file

for example this svg -
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50"><path d="M32.48,36.73c-2.22,2.64-2,5.9-2.21,9.28-.74-.14-1.33-.19-1.89-.36a17.79,17.79,0,0,1-10-7.67c-5.85-8.91-8.71-18.52-6.31-29.23.07-.3.12-.61.21-.91C13,5.2,13.28,5,16,5s5.6,0,8.4-.14a31.76,31.76,0,0,0,4.84-.64,4.22,4.22,0,0,1,3.57.53c2.49,1.92,4.26,4.37,4.1,7.67A27,27,0,0,0,38.4,23.13c.75,2,.43,2.77-1.5,3.72a13.74,13.74,0,0,1-16.42-3c-3.15-3.54-2.2-11.32,3.19-13A8.15,8.15,0,0,1,31.21,12c2,1.41,1.71,3.57,1.19,5.53s-1.33,4.11-3.88,4.43A3.54,3.54,0,0,1,25,20.61a4.29,4.29,0,0,1-.5-4.22,3.18,3.18,0,0,1,1-1.23c.89-.69,2.33-.67,2.74.06.55,1,0,1.59-.77,2.14a2.67,2.67,0,0,0-.42.52c.3.85.85.87,1.46.51a3,3,0,0,0,1.28-3,2.47,2.47,0,0,0-2-2,4.14,4.14,0,0,0-4.86,3.26q0,.19-.06.39a9.89,9.89,0,0,0,.64,3.64c1.1,2.76,5.41,3.37,7.77,1.2s3.24-7.17,1.72-10a4.26,4.26,0,0,0-1.24-1.35,9,9,0,0,0-14,5.48c-.77,4.39.33,7.69,3.9,10.43A33.59,33.59,0,0,1,29,33.54,21.8,21.8,0,0,0,32.48,36.73Z"/></svg>

contains a31.76,31.76,0,0,0,4.84-.64,4.22,4.22,0,0,1,3.57.53c
"a" command with 14 arguments
this will give error because _operands.size() != 7

New behaviour:
After fix this example will correctly finish parsing

This svg is exported from Adobe Illustrator, so it is a common syntax

I've done this loop-arguments fix in the same way as implemented other commands in PocketSVG

@elisar4 elisar4 changed the title Added support for elliptical arc commands sequence of after a single "a" Added support for elliptical arc commands sequence after a single "a" Dec 25, 2018
@arielelkin
Copy link
Collaborator

Thanks @elisar4 !

LGTM

@fjolnir, any comments?

Copy link
Member

@fjolnir fjolnir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks!

@arielelkin arielelkin merged commit eb7cd42 into pocketsvg:master Jan 14, 2019
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

Successfully merging this pull request may close these issues.

3 participants