SVG compliance issue on svg tag's x and y attributes

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
bsycsb8
Posts: 1
Joined: 2014-01-12T10:26:51-07:00
Authentication code: 6789

SVG compliance issue on svg tag's x and y attributes

Post by bsycsb8 »

Hi.

SVG specs (http://www.w3.org/TR/SVG11/struct.html# ... XAttribute) states that:
[SVG tag's x attribute] (Has no meaning or effect on outermost svg elements.)
and the same for y attribute

However, the following SVG renders weird (beyond being ugly) depending on inkscape use (IM 6.7.8.7 is known good, IM 6.8.6.8 with inkscape in path is known bad, IM 6.8.6.8 without inkscape and others in path is known good [see below]).

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
  "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" x="50px" y="50px" width="100px" height="100px" viewBox="50 50 100 100">
    <rect fill="#cccccc" x="50px" y="50px" width="100px" height="100px" />
    <path fill="none" stroke="#000000" stroke-width="3" d="M25,25h50" />
    <path fill="none" stroke="#0000ff" stroke-width="3" d="M50,50h50" />
    <path fill="none" stroke="#00ff00" stroke-width="3" d="M75,75h50" />
    <path fill="none" stroke="#ff0000" stroke-width="3" d="M100,100h50" />
</svg>
No special settings to render: convert file.svg file.png

If you remove x and y attributes from svg tag, you get expected rendering with all setups.
After reading another thread viewtopic.php?f=1&t=23916#p101767, i tried convert 6.8.6.8 with PATH="", and it was rendered ok.
This SVG looks ok in inkscape (grey rect is the same as viewport), despite coordinates look weird to me (viewport spanning from (0,100) to (100,0), expected (50,50) to (150,150)).

My issue is solved now, this thread is just to report what look like to be a bug.
Post Reply