[cairo] Cairo and SVG

Alan W. Irwin irwin at beluga.phys.uvic.ca
Sun Dec 23 15:23:04 PST 2007


On 2007-12-23 11:05+0100 Emmanuel Pacaud wrote:

> The text output of the cairo SVG backend uses the <symbol> element. And
> it looks the imagemagick display command doesn't support it correctly. I
> guess that's also the case for the OSX SVG viewer.

Could you expand on the above remarks?  For example, it is not clear whether
you have confirmed the dropped text problem I found when using the
ImageMagick "display" command to view results from the cairo SVG backend.
Furthermore, have you found a bug report or some additional concrete
evidence that the "display" command does not support the symbol tag
correctly?

Note, your hypothesis that the problem is due to ImageMagick is supported by
SVG validation results I just obtained.  I have attached compressed svgcairo
results from our example 10 (the corresponding pngcairo results can be found
at http://plplot.sourceforge.net/examples-data/demo10/x10.01.png). The
uncompressed version of that file
validates at http://validator.w3.org/.  There are further more interesting
validation results using the file validator at
http://jiggles.w3.org/svgvalidator/.  The file upload to that validation
site does not work properly.  However, I downloaded that validator, and it
reported the following results:

irwin at raven> java -jar svgvalidator.jar /tmp/examples/c/testcairo.svg
1 file was validated:
/tmp/examples/c/testcairo.svg validation report:
2 errors were found.
error #1: line: 2
The 'version' attribute of the <svg> element has a fixed value: it can not
be changed.

error #2: line: 15
The 'd' attribute of the <path> element is required: a value must be
specified.

The second line is

<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" width="720pt" height="540pt"
viewBox="0 0 720 540" version="1.1">

If the validator is correct, then the cairo SVG backend should remove that
version attribute.

The 14-16 lines are

<symbol overflow="visible" id="glyph0-3">
<path style="stroke: none;" d=""/>
</symbol>

That empty "d" attribute may have been an artifact of the particular simple
example I am doing.  In any case, if I get rid of that second-line version
attribute, and also get rid of the above glyph0-3 xml stanza and all other
references to glyph0-3 in the document, then the result validates without
errors or warnings.  However, "display" still drops all the remaining text
while konqueror shows it.

Thus, from this evidence I strongly lean toward the hypothesis that
ImageMagick is at fault here, but it is not an absolutely conclusive result
(validators and browsers can be lax) so any additional concrete evidence or
an actual ImageMagick bug report that you can point to would be most
helpful.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testcairo.svg.gz
Type: application/octet-stream
Size: 3734 bytes
Desc: gzip compressed testcairo.svg
Url : http://lists.cairographics.org/archives/cairo/attachments/20071223/37c78ee1/attachment.obj 


More information about the cairo mailing list