使用ImageMagick,您如何看到所有可用的字体?

问题描述 投票:64回答:6

ImageMagick可以将文本绘制成给定字体的图片,如何查看系统的所有可用字体?

image-manipulation imagemagick text2image
6个回答
103
投票

取决于你的imagemagick版本:

convert -list type       # for IM older than v6.3.5-7
convert -list font       # for newer versions

输出格式也改变了......

- 如果上面的命令没有产生任何结果,请更新OsX(来自Charles Merriam的答案):

有关描述的完整教程,请参阅http://gothick.org.uk/2008/03/14/using-os-x-fonts-in-imagemagick/ for rest&tldr:

# use fondu to convert fonts and update locatedb
sudo port install fondu 
cd /usr/local/share/fonts/
fondu /Library/Fonts/*.dfont
/etc/periodic/weekly/310.locate

# generate imagemagick type.xml 
cd ~
mkdir ~/.magick
wget http://www.imagemagick.org/Usage/scripts/imagick_type_gen
perl imagick_type_gen > ~/.magick/type.xml

8
投票

字体有点棘手。 ImageMagick通常不会“看到”您的系统字体。在OS / X上,字体以非标准格式存储。

使用convert -list font查看ImageMagick目前所知道的字体。它可能是空白的。

ImageMagick在字体列表中查找$HOME/.magick/type.xml。如果您使用的是OS / X,请访问http://gothick.org.uk/2008/03/14/using-os-x-fonts-in-imagemagick/上的精心编写的教程。


8
投票

要仅列出字体名称,请执行convert -list font | grep Font


1
投票

如果您最近安装了使用时未显示的字体:

convert -list font

您可以使用以下命令刷新字体缓存:

fc-cache -f -v


1
投票

您的操作系统文件系统将列出您的所有字体。

但是,如果您询问Imagemagick知道的名称使用的字体,那么使用convert -list font查看其type.xml文件中列出的所有字体。

如果没有显示任何内容,那么如果您使用的是类似unix的平台,则可以使用Anthony Thyssen的perl脚本将字体安装到type.xml文件中,而不是手动执行。见https://www.imagemagick.org/Usage/scripts/imagick_type_gen

然后做convert -list font应该列出Imagemagick识别的那些,然后你可以使用名称-font fontname。否则,您需要提供字体文件-font path/to/font.suffx的完整路径。


-1
投票

我发现gnome-font-viewer与命令行返回的名称列表相比,在视觉上看到所有字体更有用。

© www.soinside.com 2019 - 2024. All rights reserved.