SVG not rendering properly (I need it for a school project)
I am trying to create a flag for illustration purposes for my school project, and Illustrator doesn’t seem to parse the SVG code properly.
In a modified version of the UK flag, Saint Patrick’s saltire (the red diagonals) are supposed be thin, and when W3Schools’ Tryit Editor renders it as expected, but Illustrator doesn’t. I am attaching the screenshots, you can see the SVG code in the screenshot itself, and the buggy rendering in another.
It turns out that Illustrator does not follow the spec which implicitly forces a new starting point to be placed at the position of the last point of the previous sub-path.
The team is now aware of the issue.
As it turns out, the namespace is case sensitive and the OCR produced 'W3' instead of 'w3', resulting an incorrect XML code. Illustrator was just more strict with it than others.
Also I’ve got the reply from the SVG team about this bug:
The issue is the following path string: "M30,15 v15 h-30 z v-15 h30 z". The string uses a trick where at the end of a sub-path, the new starting point (moveTo) is implicitly defined by the last point of the previous sub-path. A new sub-path gets created after a closePath (z) or a moveTo (m) operation.
To make things short: Illustrator does not follow the spec and uses a different point (the last point actually defined by the path data w/o taking implicit points into account).
Add M30,15 after the first z and the import should be correct.
This bug is logged and will be fixed intentionally.
Thanks for the report and your time spent to investigate this!
UV does not allow to attach SVGs directly, because they 'can be potentially harmful'.
I had to OCR the code you posted:
<svg xmlns="http://www.W3.org/2000/svg" viewBox="0 0 60 30" width="1200" height="600">
<path d="M0,0 v30 h60 v-30 z"/>
<path d="M30,15 v15 h-30 z v-15 h30 z"/>
<path d="M0,0 v30 h60 v-30 z" fill="#012169"/>
<path d="M60,0 L0, 30" stroke="#fff" stroke-width="6"/>
<path d="M60,0 L0,30" clip-path="url(#t)" stroke="#C8102E"
<path d="M30,0 v30 M0,15 h60" stroke="#fff" stroke-width="10"/>
<path d="M30,0 v10 M30,20 v10" stroke="#C8102E" stroke-width="6"/>
<path d="M0,15 h25" stroke="#169862" stroke-width="6"/>
<path d="M35,15 h25" stroke="#FF883E" stroke-width="6"/>
While it passes the W3C validation, and OS (I use Windows) generates the thumb for the file I stored this code within, it can’t be read by Ai for Desktop or Inkscape were able to read it. Tryit is able to, as well as Affinity Designer. Corel Draws gets frozen in the process of reading.
Something is strangely wrong. Perhaps it can be figured out.
Thanks for the report.