Musings on why some files don't load, a dream I had

Continuing the discussion from Papyrus Font SVG issue details - nailed it:

For what it’s worth (and I feel pretty worthless at the moment), I went through the unusable SVG path command-by-command to find the culprit. Here it may be:

a.08.08,0,0,0,0,0

Removing that allegedly allows the file to upload successfully. But why?

a” is for arc, with parameters “rx ry x-axis-rotation large-arc-flag sweep-flag x y”. Specifically (but not too factually), it’s those last two 0s, for x and y, that could be causing the crash (for example, changing it to a.08.08,0,0,0,0-.07 also supposedly allows the file to upload successfully). An arc with a length of 0 is, at best, meaningless. At worst, it leads to dividing by zero somewhere and the universe collapses into a black hole.

I am, theoretically, unable to generate such a “bad” file with the version of Illustrator CC 22.0.0 on my computer. In fact, just opening the SVG provided by @henryhbk at he beginning of the topic and re-exporting it, regardless of the options I select, appears to generate a different path that might not have any dodgy arcs, and potentially loads successfully. So my guess is that there may have been a change to Illustrator at some point that fixed this seeming behavior.

I’m providing these opinions here in case Glowforge wishes to update their own software to be more tolerant of this hypothetical edge case, and this post should not be interpreted as a recommendation to perform any actions not officially endorsed by Glowforge or the forum elites.

18 Likes

Here’s an interesting tool for cleaning up SVG files: svgo. One interesting thing about it is that running this file through it also fixes the issue. This appears to be due to the convertPathData module doing some “smart rounding”, and not a specific rule for this problem. In any case, when people have problems with their SVG files, they may want to try running it through svgo (which can be done online at SVGOMG) just for fun.

9 Likes

Interesting. It now works on my CC 22.0.1 that was CC 2017 (no idea what version that was) which must have been a bug in the outline fonts routine in AI. So the original advice may have been completely correct to use save as since it could generate unsliceable files. And hopefully the GF devs can look for a 0-length arc and not crash the slicing operation; seems like if you encounter one you can simply ignore it since it is 0-length means it doesn’t show visually or change your x,y coordinates.

The next thing to check @chris1 is whether embedded images work via export. They were always a bit tweaky (they still are either way)

5 Likes

Just ran my 12 MB “Save As” SVG through SVGOMG and it compressed down to 1.7 MB. It took the 2.3 MB “Export” SVG down to 1.7 MB as well. Awesome tool. Perfect to wire up into a Folder Action so it runs automatically every time I export an SVG file, to generate the even more compact version. Thanks!

8 Likes

Nice work @chris1. Regardless of what may be the current officially recommended solution, I know that I would be more comfortable understanding why one solution works over the other. If nothing else, so that we can help the GF team protect against these edge cases, and, if necessary, submit bugs to Adobe (or other software providers) to fix their systems.

I’m also more comfortable with the fact that the Export As solution provides correct units of measure. My impression is that the Save As solution is offered only because it seems to have been more consistent in the past; but, I don’t have any level of comfort that anyone understands why.

7 Likes

Even though I rarely use Illustrator (because my copy is freakin’ ancient), I appreciate you putting the time in to troubleshoot this, @chris1.

100% agree.

2 Likes

Be careful, I was officially reprimanded for stating facts and not opinions. You fly close to the sun, my friend.

4 Likes

I can’t check this since I never experienced a problem and don’t have any samples of such tweaky files. If someone else does and posts their files, I may study them (for academic curiosity, not to give advice).

2 Likes

Officially? Or were you just buffeted by some of the forum’s more argumentative individuals! :wink:

2 Likes

Was this in response to you pointing out that it wasn’t necessary to make the Artboard dimension 12x20?

Under SVGO installation they reference npm. What is that? It isn’t part of my base OSX or FreeBSD systems. The makefile refers to it too so I can’t just make install.

I noticed that the Folder Action resources on github are years old, but under releases there is current activity. If I install the Folder Action does it magically get latest?

LOL, no, we shan’t do that here.

LOL2

1 Like

npm is a very widely used JavaScript package manager. SVGO is a node application, which means it’s written in JavaScript, and it’s packaged as an npm package.

To install node, there are instructions at https://nodejs.org/en/ . If you’re on a Mac, I’d recommend using homebrew - just run “brew install node” and it’ll set everything up, including npm (which is a part of nodejs).

1 Like

That’s just what I needed to know, thanks!

1 Like

I had one, I think, from before I realized there was a difference between the two methods of saving; and when I had trouble loading in the GFUI. At the time, I didn’t make the connection that the method you use to save would influence the stability of the GFUI. If I can figure out which file it was, I will post it.

Just installed the svgo Folder Action (https://github.com/svg/svgo-osx-folder-action) and while it’s ancient, it worked fine. The way it’s written is to overwrite the file put in the folder, which makes me a little nervous - you have to make a copy and drop the copy in, or risk losing the source file.

1 Like

Thanks for the suggestions everyone! I’ll make sure the team gets them.