I just wanted to have that type of a preview they have on some font websites, where you type a phrase and it gets rendered in different fonts ... So here is a small bash script (tested on Ubuntu 9.10) which will loop through a directory where .ttf or .otf fonts are places, and will generate a .tex file with a phrase in all those fonts - and will finally call xelatex to generate a pdf based on the tex file.
Excuse the messy comments - and hope some may find it useful,
Cheers!
quickfonttest.sh:
Code: Select all
# to be used with xetex - xelatex# for texlive:# tlmgr install xetex xunicode xltxtra fontspec xkeyval euenc metalogo xetex-def# Must NOT have spaces in font names !!# Note - some fonts (those with commas in their names? can cause Segmentation fault).# the script will loop through a directory (assuming it has only .ttf or .otf font files) and will generate a xetex file, which will display a phrase in all the fonts found in that directory; and then it will compile the file with xelatex. (something similar to http://fontforge.sourceforge.net/fontimage.html)# sudo apt-get install fontforge # for showttf# bugs - Verbatim doesn't wrap (break lines) and doesn't show footnotesizeOFN=fonttester # output file name (base)TEXF=$OFN.texfunction becho(){echo "$*" | tee -a $TEXF}PHRASE="My Test Phrase"FONTDIR=/home/USERNAME/.openoffice.org/3/user/fontsecho "" > "$TEXF" # erasebecho "\documentclass{article}\usepackage{fontspec}\usepackage{xunicode}%\usepackage{xltxtra}\usepackage{graphicx} % for scalebox\usepackage{fancyvrb} % for Verbatim\usepackage{fancybox} % for fbox?% from fancybox.pdf:\newenvironment{fminipage}%{\begin{Sbox}\begin{minipage}}%{\end{minipage}\end{Sbox}\fbox{\TheSbox}}