Did some heavy SVG parsing during the last week. Found a couple of bugs in the juce SVG parser method parsePathString().
Fix 1: Many SVGs seems to implicitly expect a path close when the next path command is an ‘M’ or ‘m’.
Fix 2: The ‘S’ and ‘s’ command has a special case according the SVG spec: “(If there is no previous command or if the previous command was not an C, c, S or s, assume the first control point is coincident with the current point.)”. This was not correctly implemented in the parser.
Fix 3: The ‘T’ and ‘t’ command suffered from the same error as an fix 2.
Fix 4: Many times there is no explicit close of the sub path if it is the last thing. Making the path.closeSubPath() statement unconditional in the parser seemed to fix the last issue I could see.
After having parsed 10’s of thousands of SVGs from the web, the parser seems to work really well now.
edit: Here is a good site with SVGs that I tested: https://icongr.am/