|
|
|
|
|
by jahewson
4890 days ago
|
|
SVG implementations on browsers have historically been poor, though this is certainly improving. You'll hit many bugs and unsupported features. IE < 9 doesn't support SVG at all, and Safari < 6 only does so in XHTML. SVG fonts are sparsely supported. The alternative - rasterising SVG on the server - is a heavyweight task, I've not found any libraries which can do this quickly. The worst problem may be SVG itself - SVG 1.2 which dates from 2004 was abandoned, and most browsers implement SVG 1.1 which is rather lacking in features. This makes it hard if you're a designer to produce SVG documents which a browser can actually render. At a bare minimum any SVG hosting project would have to involve some sort of SVG lint, to make sure that browser-incompatible SVG elements are not present, implement workarounds for browser-specific bugs, and check that there are no <script> tags etc. The sheer size and complexity of even SVG 1.1 makes it non-trivial. One pragmatic approach to sanitize SVG may be to round-trip SVG -> PDF -> SVG via cairosvg and pdftocairo, though it may burn some CPU. |
|
Wikipedia does it using librsvg, fwiw: https://live.gnome.org/LibRsvg