使用ImageMagick 在图片上绘制粗斜体的中文也许是一个错误。

测试发现:

ImageMagick使用中文字体,在图片上绘制带粗或斜体的中文,看不到效果。

如果使用英文字体,绘制粗或斜体的英文,99%都有效果。

今天无意看到一篇文章提到:

convert -list font 获得系统目前拥有的字体的列表,其中glyphs一项是字体的文件。
 
试了一下,果然能列出所有的字体。
 
但和windows的字体选择对话框一对比,郁闷了。
 
比如windows的字体选择对话框里显示“宋体”和“新宋体”。
 
但在 convert -list font 列出来的是:
 
  Font: 宋体-&-新宋体
  family: 宋体 & 新宋体
  style: Normal
  stretch: Normal
  weight: 400
  glyphs: c:windowsfontssimsun.ttc
 
 ----------------------------------------------------------------------------------------
 
从下面的字体列表中也能看出来,为什么用中文字体看,设置了粗斜体也没有效果了。 
 

 Font: Arial
  family: Arial
  style: Normal
  stretch: Normal
  weight: 400
  glyphs: c:windowsfontsarial.ttf
Font: Arial-Black
  family: Arial
  style: Normal
  stretch: Normal
  weight: 900
  glyphs: c:windowsfontsariblk.ttf
Font: Arial-Bold
  family: Arial
  style: Normal
  stretch: Normal
  weight: 700
  glyphs: c:windowsfontsarialbd.ttf
Font: Arial-Bold-Italic
  family: Arial
  style: Italic
  stretch: Normal
  weight: 700
  glyphs: c:windowsfontsarialbi.ttf
Font: Arial-Italic
  family: Arial
  style: Italic
  stretch: Normal
  weight: 400
  glyphs: c:windowsfontsariali.ttf
Font: Arial-Narrow
  family: Arial Narrow
  style: Normal
  stretch: Normal
  weight: 400
  glyphs: c:windowsfontsarialn.ttf
Font: Arial-Narrow-Bold
  family: Arial Narrow
  style: Normal
  stretch: Normal
  weight: 700
  glyphs: c:windowsfontsarialnb.ttf
Font: Arial-Narrow-Bold-Italic
  family: Arial Narrow
  style: Italic
  stretch: Normal
  weight: 700
  glyphs: c:windowsfontsarialnbi.ttf
Font: Arial-Narrow-Italic
  family: Arial Narrow
  style: Italic
  stretch: Normal
  weight: 400
  glyphs: c:windowsfontsarialni.ttf

Font: 華康正顏楷體W7-&-華康正顏楷體W7(P)
  family: 華康正顏楷體W7 & 華康正顏楷體W7(P)
  style: Normal
  stretch: Normal
  weight: 400
  glyphs: c:windowsfonts萢康正顏楷體w7.ttc
Font: 宋体-&-新宋体
  family: 宋体 & 新宋体
  style: Normal
  stretch: Normal
  weight: 400
  glyphs: c:windowsfontssimsun.ttc
Font: 苏新诗卵石体
  family: 苏新诗卵石体
  style: Normal
  stretch: Normal
  weight: 400
  glyphs: c:windowsfonts苏新诗卵石体.ttf

2012-10-08

原文地址:https://www.cnblogs.com/personnel/p/4584823.html