Page 1 of 1

ImageMagick SVG reading doesn't like styles in CDATA markup

Posted: 2020-11-09T07:01:12-07:00
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.