site  contact  subhomenews

SVG mystery

October 13, 2009 — BarryK
4.3x testers have reported that some SVG images do not display in ROX or Viewnior.

Those in /usr/local/lib/X11/themes/FlatOrange do.

Newer ones, such as created in Inkscape, do not.

I wondered if perhaps 'librsvg', which is the package that provides SVG support for GTK, needed to be compiled with its optional dependency 'libcroco' (provides support for SVG images that have CSS formating).

So, I compiled libcroco 0.6.2 and recompiled librsvg 2.22.3. Nup, same problem.

So, I grabbed the latest librsvg, 2.26.0, but still no good.

Then I tried this ('rsvg-view' is a utility in the librsvg pkg):

# rsvg-view <svg file>

...hey, it displays!

So, librsvg itself is okay, GTK is somehow the problem.
If I try to open one of the newer SVG files in Viewnior, it reports an "unrecognised file format". C**p.

So, I wondered, just what is different between the SVG files that do display, and those that don't?

I have one that doesn't, 'brasero.svg', the first few lines of the file:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
version="1.0"
width="48"
height="48">
<defs
id="defs3">
<linearGradient
id="linearGradient5349">


/usr/local/lib/X11/themes/FlatOrange/camera.svg works, here are the first few lines:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<!-- Created with Inkscape ("http://www.inkscape.org/") -->
<svg
version="1.0"
x="0.0000000"
y="0.0000000"
width="162.50000"
height="162.50000"
id="svg183"
sodipodi:version="0.32"
inkscape:version="0.36"
sodipodi:docname="/usr/local/lib/X11/themes/Outline-svg/camera.svg"
sodipodi:docbase="/usr/local/lib/X11/themes/Outline-svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink">
<sodipodi:namedview


So guess what? I copied that "DOCTYPE" declaration from camera.svg, pasted it into brasero.svg -- now brasero.svg displays!

My memory of the SVG standard is that it needs that DOCTYPE declaration. So how come all the recent SVG images I have downloaded, created by Inkscape, don't have it? I just checked something, compiled GTK 2.16.6, still the same problem.

So, I am stuck with a mystery. I have a workaround, but really when we download SVG images we want them to display as-is, not have to edit them. Anyone got a solution? As things stand, I will have to go to 431-final with this not properly resolved.

Comments

fbpanel' svg images....
Username: magerlab
i use fbpanel with openbox,pekwm or xfwm4 it has some images inside the packages and some of them ( e.g. for rox-filer) are seen but some do not and guess :) the images that are shown in rox or fbpanel have DOCTYPE lines also maybe it's possible to write a script to add these line to svg images:)?

Inkscape
Username: BarryK
"Here are the release notes for Inkscape 0.41: http://wiki.inkscape.org/wiki/index.php/ReleaseNotes041 They state, under "Important bugfixes": [i]Inkscape SVG documents no longer include DOCTYPE declaration with an URI of an SVG DTD; this DTD would not be able to validate our documents anyway (due to extension elements), and was just useless.[/i]

SVG and SeaMonkey
Username: BarryK
"SVG images display ok in SeaMonkey. I had compiled SeaMonkey to use the librsvg plugin rather than its own native SVG module. So the problem is for apps that use gdk_pixbuf in GTK (such as Rox and Viewnior). GTK wants that DOCTYPE line. The Inkscape people took it out. Maybe the latest GTK has sorted it out, but I have to leave it at that.

Minimum DOCTYPE
Username: BarryK
"I found inserting just this is enough: <!DOCTYPE svg PUBLIC "" "">

shared-mime info
Username: ljfr
"it may be solved by updating shared-mime-info, see post in: http://www.murga-linux.com/puppy/viewtopic.php?p=350768#350768

Inkscape and SVG images
Username: ICPUG
"Barry, If your memory is correct and the SVG spec demands a DOCTYPE declaration then the Inkscape project should be told they have solved their bug in the wrong way. They should simply remove the URI rather than the whole DOCTYPE declaration - like your post above.

Solution
Username: BarryK
"Solution posted here: http://bkhome.org/archive/blog2/200910/svg-solution.html


Tags: woof