[Magick-bugs] SVG text translation in rotation

Thomas.Stegemann at materna.de Thomas.Stegemann at materna.de
Tue Apr 3 12:08:28 PDT 2007


When I rotate a text in SVG, ImageMagick6.3.3-5 translates the text, too.

For example, with the following svg Text2 overlapps Text1:

<?xml version="1.0"?>
<svg  width="640pt" height="256pt">
  <text x="0pt" y="80pt">Text1</text>
  <g transform="rotate(0)">
    <text x="0pt" y="0pt">Text2</text>
  </g>
</svg>



V 6.2.9 has the same Problem
V 6.2.4 draws Text2 at position (0,0).

I assume the following lines cause the problem:
  affine.tx=svg_info->bounds.x;  
  affine.ty=svg_info->bounds.y;

in svg.c in the function
static void SVGStartElement(void *context,const xmlChar *name,  const xmlChar **attributes)
for the attribute transform:
if (LocaleCompare(keyword,"rotate") == 0)
{
  double angle;

  angle=GetUserSpaceCoordinateValue(svg_info,0,value);
  affine.sx=cos(DegreesToRadians(fmod(angle,360.0)));
  affine.rx=sin(DegreesToRadians(fmod(angle,360.0)));
  affine.ry=(-sin(DegreesToRadians(fmod(angle,360.0))));
  affine.sy=cos(DegreesToRadians(fmod(angle,360.0)));
  affine.tx=svg_info->bounds.x;  
  affine.ty=svg_info->bounds.y;
  break;
}



More information about the Magick-bugs mailing list