ImageMagick supports rendering arbitrary fonts and text. Below is a sample script that will iterate over available fonts and render some text. I'm not sure how bash savvy you are, so I'll just and assume that the script makes sense.
I ran this in Cygwin and Gentoo so it's a viable solution for both systems. It's not perfect though, because convert.exe
is unable to handle all fonts (on both systems). I guess they must be TrueType. Check the docs for options to the convert program (antialiasing, cropping). Feel free to update the script if you find some useful options.
File: fonts.sh
#! /bin/bash t=" NAME cowsay/cowthink - configurable speaking/thinking cow (and a bit more) SYNOPSIS cowsay [-e eye_string] [-f cowfile] [-h] [-l] [-n] [-T tongue_string] [-W column] [-bdgpstwy] DESCRIPTION Cowsay generates an ASCII picture of a cow saying something provided by the user. If run with no arguments, it accepts standard input, word- wraps the message given at about 40 columns, and prints the cow saying the given message on standard output. - - - ~ \` ! @ # $ % ^ & * ( ) _ + [ ] { } ; : ' \", . < > / ? \\ / "
# . . .
CONVERT="/cygdrive/c/Program Files (x86)/ImageMagick-6.8.4-Q16/convert.exe" LIM=$ if [ ! -z "$2" ]; then rm -f Fonts/*; fi if [ ! -d Fonts ]; then mkdir Fonts; fi "$CONVERT" -list font| awk '/Font/ ' | head -n$LIM | sort -R | while read f ;do let n=n+1 printf "%4d/%-4d %s\n" $n $LIM "$f" out="Fonts/$f.png" txt="Fonts/txt.z" err="Fonts/$f.err.txt" if [ ! -f "$out" ] && [ ! -f "$err" ]; then echo -e "$f\n" > $txt cat "$0" |sed 's/\t/ /g'>> $txt "$CONVERT" \ -page a3 -font "$f" \ -kerning 0 -density 90 -pointsize 16 -interline-spacing -2 \ -trim +repage -bordercolor white -border 5 \ text:$txt \ "$out" 2> "$err" if [ $? -ne 0 ]; then printf "%9s %s\n" " " ERROR else rm -f "$err" ;fi else printf "%9s %s\n" " " SKIPPING fi done
Sample output
$ time sh fonts.sh 234 clean 1/234 Candara-Italic 2/234 Gabriola 3/234 Candara-Bold SKIPPING 4/234 Lucida-Sans-Unicode 5/234 Corbel-Bold 6/234 LilyUPC-Italic 7/234 FreesiaUPC-Bold-Italic 8/234 Kartika 9/234 FreesiaUPC 10/234 JasmineUPC-Italic ✂ (...) 41/234 Courier-Oblique ERROR 42/234 Helvetica ERROR ✂ (...) real 4m22.149s $ du -h Fonts 361M Fonts
referencess:
http://www.imagemagick.org/Usage/text/#text
http://www.imagemagick.org/script/binary-releases.php#windows