2

我有一个 svg 文件,其中包含在浏览器中工作的自定义字体系列。当我将 svg 转换为任何图像类型(我尝试过 png jpg pdf)时,字体会恢复为 Arial。我在服务器上有字体,当我使用时它显示在字体列表中:

convert -list font

这是 SVG 代码:

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="720" height="288" viewport-fill="white" xml:space="preserve">
<style>
@font-face {
    font-family: 'ubuntubold';
    src: url('fonts/ubuntu/ubuntu-b-webfont.eot');
    src: url('fonts/ubuntu/ubuntu-b-webfont.eot?#iefix') format('embedded-opentype'),
         url('fonts/ubuntu/ubuntu-b-webfont.woff') format('woff'),
         url('fonts/ubuntu/ubuntu-b-webfont.ttf') format('truetype'),
         url('fonts/ubuntu/ubuntu-b-webfont.svg#ubuntubold') format('svg');
    font-weight: normal;
    font-style: normal;

}
</style>
</defs>
<g transform="translate(450 149) rotate(0)">
<text font-family="'ubuntubold'" font-size="40" style="stroke: none; stroke-width: 1; stroke-dasharray: ; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: #0038ff; opacity: 1;" transform="translate(-240.54 39)">
<tspan x="0" y="-26" fill="#0038ff">
Bluemoon Entertainment</tspan>
</text>
</g>
</svg>

要转换为我正在使用的图像:

convert -verbose -density 300 test.svg test_density.png

我知道还有其他图像转换程序,但我的客户非常坚持我使用 imagemagick。

4

0 回答 0