With ImageMagick, how can you see all available fonts?

后端 未结 6 1550
清歌不尽
清歌不尽 2021-01-31 13:20

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

相关标签:
6条回答
  • 2021-01-31 13:42

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

    0 讨论(0)
  • 2021-01-31 13:42

    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.

    0 讨论(0)
  • 2021-01-31 13:43

    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
    
    0 讨论(0)
  • 2021-01-31 13:44

    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

    0 讨论(0)
  • 2021-01-31 13:52

    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/.

    0 讨论(0)
  • 2021-01-31 13:53

    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.

    0 讨论(0)
提交回复
热议问题