[英]ImageMagick convert SVG using my true type font (Magick++)
I am using Magick++
API of ImageMagick
. 我正在使用
ImageMagick
Magick++
API。 I cannot find out how to set up rendering svg to raster with my font. 我找不到如何使用我的字体将svg渲染为光栅的方法。 this is my svg .
这是我的SVG 。
The goal is to achieve analog of 目标是实现
convert.exe -font C:\Fonts\RoadSymbols.ttf C:\ua_03.svg C:\1.png
but using Magick++
API. 但使用
Magick++
API。
I tried to set up font like this: 我试图这样设置字体:
Magick::Image svgImage("C:\\ua_03.svg");
svgImage.magick("png");
svgImage.font("@C:\\Fonts\\RoadSymbols.ttf");
svgImage.write("C:\\1.png");
But I had't got required result. 但是我没有得到要求的结果。
Any ideas? 有任何想法吗?
First use a commandline to list all fonts which are known to ImageMagick: 首先使用命令行列出ImageMagick已知的所有字体:
convert.exe -list font
You'll see something like this: 您会看到以下内容:
Path: /opt/local/etc/ImageMagick/type-ghostscript.xml
Font: AvantGarde-Book
family: AvantGarde
style: Normal
stretch: Normal
weight: 400
glyphs: /opt/local/share/fonts/urw-fonts/a010013l.pfb
Font: AvantGarde-BookOblique
family: AvantGarde
style: Oblique
stretch: Normal
weight: 400
glyphs: /opt/local/share/fonts/urw-fonts/a010033l.pfb
Font: AvantGarde-Demi
family: AvantGarde
style: Normal
stretch: Normal
weight: 600
glyphs: /opt/local/share/fonts/urw-fonts/a010015l.pfb
Font: AvantGarde-DemiOblique
family: AvantGarde
style: Oblique
stretch: Normal
weight: 600
glyphs: /opt/local/share/fonts/urw-fonts/a010035l.pfb
[...]
Then, when it comes to picking a font for ImageMagick's peruse from that list, you can choose: 然后,从该列表中为ImageMagick的细读挑选字体时,您可以选择:
(a) ...either use the font name that appears behind the Font:
tag, (a)...要么使用显示在
Font:
标记后面的Font:
名称,
(b) ...or use the full path to the actual font file (which appears behind the glyphs:
tag. (b)...或使用实际字体文件的完整路径(该路径出现在
glyphs:
标记后面。
And do not try to use just the family:
name with ImageMagick... 并且不要尝试仅使用
family:
使用ImageMagick命名...
Be sure to use quotes around any the fontname or the path should they contain any blanks! 请务必在所有字体名称或路径周围使用引号,如果它们包含任何空格!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.