小编cha*_*suf的帖子

使用ImageMagick指定具有字体系列的字体

是否可以使用ImageMagick中的字体系列渲染字体?

我已经尝试了我能想到的一切,但似乎没有任何效果.我做了很多搜索,似乎无法找到解决这个特定问题的任何内容.

我最终使用PHP,但我也尝试在命令行上使用ImageMagick但没有成功.我在linux上使用ImageMagick 6.7.6.这是我到目前为止所做的.

  • 我已经使用该identify -list font命令测试了ImageMagick重新识别的字体
  • 我已根据系统上安装的xml文件手动创建了一个type.xml文件
  • 我使用这个脚本创建了一个type.xml文件: imagick_type_gen
  • 我已经测试了多种字体类型:ttf,otf,pfb,ttc

以下是identify -list font我测试过的一些字体的示例输出:

Font: DejaVu-Sans-Book
  family: DejaVu Sans
  style: Normal
  stretch: Normal
  weight: 400
  glyphs: /usr/share/fonts/dejavu/DejaVuSans.ttf

Font: Baskerville-Regular
  family: Baskerville
  style: Normal
  stretch: Normal
  weight: 400
  glyphs: /usr/share/fonts/custom/Baskerville.ttc

Font: Palatino-Roman
  family: Palatino
  style: Normal
  stretch: Normal
  weight: 400
  glyphs: /usr/share/fonts/urw-fonts/p052003l.pfb

Font: Honey-Script-Light
  family: Honey Script
  style: Normal
  stretch: Normal
  weight: 300
  glyphs: /usr/share/fonts/custom/HoneyScript-Light.ttf
Run Code Online (Sandbox Code Playgroud)


如果我指定完整的字体名称,一切都按预期工作:

convert -pointsize 32 -font "Honey-Script-Light" label:'Testing' testing.png
Run Code Online (Sandbox Code Playgroud)

工作


但是,当我尝试使用字体系列(由identify -list font …

php fonts imagemagick font-family

8
推荐指数
1
解决办法
7818
查看次数

标签 统计

font-family ×1

fonts ×1

imagemagick ×1

php ×1