This code works fine in browsers and inkscape.
Code: Select all
<svg …>
<line x1="-60" y1="0" x2="60" y2="0" transform="translate(100,160)" style="…"/>
<circle r="5" transform="translate(100,160)" style="…"/>
<text x="100" y="160" dy="-30" style="… text-anchor:middle; …">
X
<tspan dy="20" style="…">
Y
</tspan>
</text>
</svg>
Is it a bug? If it is, then in what version of imagemagick it is fixed?
If anybody has version older then in my question, please check this problem.
php script and svg file are attached.
source svg file
Code: Select all
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 200 200" version="1.1">
<line x1="-60" y1="0" x2="60" y2="0" transform="translate(100,160)" style="stroke:#000000"/>
<circle r="5" transform="translate(100,160)" style="fill:#000000"/>
<text x="100" y="160" dy="-30" style="font-size:100px; font-family: Times New Roman; text-anchor:middle; fill:#000000;stroke:none"
>X<tspan dy="20" style="font-size:60px">Y</tspan></text>
</svg>
Code: Select all
<?php
$fileName = 'tspan.svg';
$svg = file_get_contents($fileName);
$image = new Imagick();
$image->readImageBlob($svg);
$image->setImageFormat('png');
$image->setImageType(Imagick::IMGTYPE_GRAYSCALE);
header('Content-type: image/png');
echo $image;
$image->clear();
$image->destroy();
exit;