Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to choose a font (technically, a typeface or font-family) out the numerous ones I have on my (Windows) system, for use in some (non-TeX) application, e.g. LO Writer.

To do this, I want to be able to see some text ("Quick brown fox" or some such) rendered with all the fonts I have installed. Of course, non-Latin fonts need text which showcases the relevant glyphs and glyph combinations (e.g. continued forms in Arabic, punctuation and cantilation marks in Hebrew).

What's a good way to get this done?

Bonus questions for 1337 users:

  • Linux, not just Windows
  • Limit this to only the Hebrew fonts, only the Arabic fonts, only the Latin fonts etc.
share|improve this question
    
Do we assume that you do not already have nirsofts FontView? nirsoft.net/utils/windows_fonts_viewer.html Like what would you want that you cannot accomplish with that? –  Psycogeek Apr 4 '13 at 21:53
    
@Psycogeek: Will try that. –  einpoklum Apr 4 '13 at 22:10

1 Answer 1

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=${1:-23}

if [ ! -z "$2" ]; then rm -f Fonts/*; fi
if [ ! -d Fonts ]; then mkdir Fonts; fi

"$CONVERT" -list font| awk '/Font/ {print $2}' | 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

Terminus


ProFont

referencess:
http://www.imagemagick.org/Usage/text/#text
http://www.imagemagick.org/script/binary-releases.php#windows

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.