Hacker News new | ask | show | jobs
by michaelt 697 days ago
I've just re-tested, and you're right. This SVG won't display properly with chrome, firefox, inkscape or imagemagick

  <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  <svg width="84000000000mm" height="84000000000mm"
     viewBox="0 0 84000000000mm 84000000000mm"
     version="1.1" id="svg5"
     xmlns="http://www.w3.org/2000/svg"
     xmlns:svg="http://www.w3.org/2000/svg">
    <ellipse
       style="fill:none;stroke:#000000;stroke-width:0.812697;stroke-opacity:1"
       id="path111" cx="42000000000mm" cy="42000000000mm"
       rx="42000000000mm" ry="42000000000mm" />
  </svg>
However the browsers don't crash or run out of memory, so they've got that going for them. And if you embed the image in a web page with <img src='84km.svg' width=1000 height=1000> chromium almost manages to display it.

SVG lets you specify sizes in a bunch of different units, but there's actually a fixed ratio between them - in SVG, 1mm means is 3.78px regardless of your display or printer's DPI.

So I didn't scale mm to SVG's arbitrary length units - but the standard did.

1 comments

So at this point we don't know about any viewer capable of handling Earths orbit sized SVG? That's sad.

> However the browsers don't crash or run out of memory

Good news for your sample. Yet in some browsers there prevail some open issues, just the limits are now farther. For example feeding this SVG to my Firefox almost instantly exhausts my RAM and makes the browser window unusable for a while:

    data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg"
     viewBox="-1e11,-1e11,2e11,2e11"><circle r="1e11"/></svg>
I guess for more beefed machines would be necessary to bump exponents slightly higher. It's a known issue [1].

[1] https://bugzilla.mozilla.org/show_bug.cgi?id=1864374