ImageMagick使用我的真字体(Magick++)转换SVG



我正在使用ImageMagickMagick++ API。我找不到如何设置渲染svg到光栅与我的字体。这是我的svg。

目标是实现的模拟

convert.exe -font C:FontsRoadSymbols.ttf C:ua_03.svg C:1.png

但使用CCD_ 3 API。

我试着设置这样的字体:

Magick::Image svgImage("C:\ua_03.svg");
svgImage.magick("png");
svgImage.font("@C:\Fonts\RoadSymbols.ttf");
svgImage.write("C:\1.png");

但我并没有得到要求的结果。

有什么想法吗?

首先使用命令行列出ImageMagick:已知的所有字体

 convert.exe -list font

你会看到这样的东西:

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
[...]

然后,当要从该列表中选择供ImageMagick阅读的字体时,您可以选择:

  • (a) 。。。要么使用出现在Font:标签后面的字体名称,

  • (b) 。。。或者使用实际字体文件的完整路径(出现在glyphs:标签后面。

不要试图在ImageMagick中只使用family:名称。。。

如果字体名称或路径包含空格,请务必在其周围使用引号

最新更新