Imagick字体转换很糟糕:svg到png

时间:2015-12-30 14:28:20

标签: php svg imagick

我需要从PHP动态构建一个svg。之后我想将其转换为.png。我正在使用Imagick

$this->pngBinary = new \Imagick();
$this->pngBinary->setBackgroundColor(new \ImagickPixel('transparent'));
$this->pngBinary->setfont(FONTS_PATH . 'courier.ttf');
$this->pngBinary->readImageBlob($this->svgContent);
$this->pngBinary->setImageFormat("png32");
$this->pngBinary->writeimage(BASE_PATH . 'xxx2.png');

当我按$this->pngBinary->queryFonts();列出字体时,列出了Courier。

SVG输出包含:

<text style="font-size: 9px; fill:black; font-family: Courier" x="227" y="94">64</text>

在localhost上,一切正常。 png显示数字。

但在debian框中,它不会转换数字。而是有一些小矩形。

enter image description here

可能是什么问题?

遗憾的是,我无法访问Imagick二进制文件和目录,只有PHP用户才能访问。

0 个答案:

没有答案
相关问题