ImageMagick SVG reading doesn't like styles in CDATA markup

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
hyanwong
Posts: 5
Joined: 2013-07-02T14:06:45-07:00
Authentication code: 6789

ImageMagick SVG reading doesn't like styles in CDATA markup

Post by hyanwong »

According to the SVG specs at https://www.w3.org/TR/SVG11/styling.html#StylingWithCSS,"it is highly recommended that internal style sheets be placed inside CDATA blocks.". But when I do this, the styles are then ignored by ImageMagick when converting to e.g. PNG. For example, here's a basic file:

Code: Select all

<svg baseProfile="full" height="200" version="1.1" width="200" xmlns="http://www.w3.org/2000/svg" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xlink="http://www.w3.org/1999/xlink">
 <defs>
  <style type="text/css">
   <![CDATA[
   	.edge {fill: none}
   ]]>
   </style>
  </defs>
 <path class="edge" d="M 20 20 V 100 H 100" />
</svg>
This display with no diagonal fill in most SVG renderers, but not when I do "convert tmp.svg tmp.png". If I remove the "<![CDATA[" string and its closing "]]>", then ImageMagick does the right thing.
Post Reply