With ImageMagick, how can you see all available fonts?

家住魔仙堡 提交于 2019-12-03 04:42:38

问题


ImageMagick can draw text into a picture in a given font, how can I see all available fonts for my system?


回答1:


depending on your imagemagick version:

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

also the output format changed...

-- update For OsX (Answer from Charles Merriam) if the command above does not produce any results:

For a full tutorial with description see http://gothick.org.uk/2008/03/14/using-os-x-fonts-in-imagemagick/ for the 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



回答2:


To list only the font names, do convert -list font | grep Font




回答3:


The fonts are a bit tricky. ImageMagick will not usually 'see' your system fonts. On OS/X, fonts are stored in a non-standard format.

Use convert -list font to see the fonts ImageMagick currently knows about. It may be blank.

ImageMagick looks for $HOME/.magick/type.xml for the list of fonts. If you are on OS/X, go see the well written tutorial at http://gothick.org.uk/2008/03/14/using-os-x-fonts-in-imagemagick/.




回答4:


If you have recently installed a font which is not appearing when using:

convert -list font

You can flush your font cache with:

fc-cache -f -v




回答5:


Your OS file system will list all your fonts.

But if you are asking about fonts that Imagemagick knows about for use by name, then use convert -list font to see all those fonts listed in its type.xml file.

If that shows nothing, then if you are on a unix-like platform, you can use the perl script by Anthony Thyssen to install your fonts into the type.xml file rather than doing them by hand. See https://www.imagemagick.org/Usage/scripts/imagick_type_gen.

Then doing convert -list font should list the ones that Imagemagick recognizes and you can then use them by name -font fontname . Otherwise, you need to provide the full path to the font file -font path/to/font.suffx.




回答6:


I find the gnome-font-viewer more useful to see all the fonts visually compared to a list of names returned on the command line.



来源:https://stackoverflow.com/questions/1392858/with-imagemagick-how-can-you-see-all-available-fonts

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!