我有一个svg图形,需要使用服务器上安装的自定义字体将其呈现为png。
这是SVG文件:
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="850mm" height="300mm" version="1.1" xmlns="http://www.w3.org/2000/svg">
<rect width="100%" height="100%" fill="#ffffff"/>
<g fill="none" stroke="#000000" stroke-width="7mm">
<line x1="0mm" y1="0mm" x2="850mm" y2="0mm" />
<line x1="0mm" y1="0mm" x2="0mm" y2="300mm" />
<line x1="850mm" y1="0mm" x2="850mm" y2="300mm" />
<line x1="0mm" y1="300mm" x2="850mm" y2="300mm" />
</g>
<text class="text" x="100mm" y="185mm" font-family="Fibel Nord" font-size="138" fill="#333333"> Frosch </text>
<text class="text" x="550mm" y="185mm" font-family="Helvetica" font-size="138" fill="#333333"> Quark </text>
<image x="0mm" y="126.5mm" width="47mm" height="47mm" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC8AAAAvCAYAAABzJ5OsAAAAAklEQVR4AewaftIAAATqSURBVNXBTWhTBwDA8X/6Xr76MVcJBbEHPbnhwM4VPYh4KELZLKPWpouNLl3THvSiYyAyKG8HkdFtdVtHGXNlIOjBi3jTU9raNsWKYhEb0XZLWb5Mk7R97yVpk7y9wQ4im+tHkqa/n2Cz2SKqqpqBUUBjCykbHBzcXltb+4Uoig+Ad9hChOvXr3/lcrksT548sc7Pz59KJpNmYAzQKHGCpLNarTgcDsvu3bvNY2Nj9Yqi2DVNGwKilDBB0vGPvXv3ljmdTsujR48s8Xi8PZVKmYBxQKMECZKOV1RUVOB0Oi07d+40e73eekVRWoFhIEqJESQdrzEYDOzbt09wOBzW+/fvWxYWFhypVMoEjAMaJUKQdPyHqqoqXC6X1WazmScnJ+tlWT4BjABRSoAg6XgDg8HA/v37xdbW1nKv12tdWlpqS6fTJsALaGwiQdKxCtu2baOzs9NaWVlpevjwYb0syy3APSDKJhEkHatkMBg4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mXL19uHxsbm79z545sb29XzGYz2SZZmQRwTtM0871796ojkQibNm2yVVZWCrJIsnI6MJVMJsdfvHixfXR0dPH+/fuG1tZWq8lkIhskq5cAzmmaZrp79+5HkUiErVu32ioqKsg0SXrowOTi4uI/z58/3z4yMpKanp42tLS0WIxGI5kiSa8EcFbTNHn79u2a8+fPEwwGbV6vl0yQpJ8OTC4uLv6dSCQar1y5wrNnzwzNzc0WKSXpJMmcBHBW0zTDrVu3AtFoVG9qarK53W7SRZJZOjC5sLAw9vTp0x2XL1+WmqaJxsZGs8FgYLUk2ZEAwpqmcfPmzY9jsZje0tKiuFwuVkOSPTow+fr167+ePHmy4+LFi6ZkMimCwaBZCMFKSLIvAYQ1TePGjRt1ly5dSrW1tSlOp5PlkuSGDkzOz8+PPn78uCkWi1nMZrNhy5YtJiEESyXJrQRwZnZ2lqmpqbqrV6+mOjo6FIfDwVJIck8Hrs/Pz/85PT392dDQkNXhcMiGhgajEIIPkeSPBHB6dnaWeDz+yejoaLKzs1MpLCzkfST5RQeuz83N/fHo0aPPo9GotaysTNbX10shBO+S5KcEcGpmZoZr167VT0xMJDs7O60FBQW8TZK/dODfubm53x8+fNg6ODio+P1+WVtbK3lDkv8Suq6fnJmZEePj45/G4/GFrq4uq6IoSNYGHYi/evVq5MGDB22RSETZsGGDUbD2SOCAy+X66X/Nu2HsnktehwAAAABJRU5ErkJggg==" />
</svg>
图像不包括在内。...好吧,这只是一个测试,因为我以后想使用GraphicsMagick。
我测试了底层的rsvg-convert并获得与convert相同的结果:
再次,字体很好,缺少嵌入的图像。
哇,包含了嵌入式图像。但是字体坏了!
如何在GraphicsMagick中修复字体? 我迷路了。几天以来一直坚持该错误。
到目前为止,我已经建立了一个类型图:
perl /opt/imagick_type_gen.pl > /root/.magick/type.xml
并将其链接到/usr/lib/GraphicsMagick-1.4/config/type.mgk
<?xml version="1.0"?>
<typemap>
<include file="type-ghostscript.mgk" />
<include file="/root/.magick/type.xml" />
</typemap>
但自gm convert -list type
起出现错误:
gm convert: Unable to access configuration file (type.xml) [No such file or directory].
感谢您的帮助。
答案 0 :(得分:0)
我在/usr/lib/GraphicsMagick-1.4/config
中运行了地图,并将文件链接到该文件夹中。
perl /opt/imagick_type_gen.pl > ./my.mgk
并且没有路径:
<typemap>
<include file="type-ghostscript.mgk" />
<include file="my.mgk" />
</typemap>
现在可以了!