From e8ed9bd2e7597f7aefdfc7004a308f0e291c3ca7 Mon Sep 17 00:00:00 2001 From: Jonathan McCrohan Date: Tue, 8 May 2012 14:48:01 +0100 Subject: Imported Upstream version 2.2.2 --- showfigfonts | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 showfigfonts (limited to 'showfigfonts') diff --git a/showfigfonts b/showfigfonts new file mode 100644 index 0000000..643c60b --- /dev/null +++ b/showfigfonts @@ -0,0 +1,60 @@ +#!/bin/sh - +# showfigfonts by Glenn Chappell +# figlet release 2.1.1 -- 25 Aug 1994 +# Based on showfigfonts by Greg Galperin , Nov 1993. +# +# Prints a list of available figlet fonts, along with a sample of each +# font. If directory is given, lists fonts in that directory; otherwise +# uses the default font directory. If word is given, prints that word +# in each font; otherwise prints the font name. +# +# Usage: showfigfonts [ -d directory ] [ word ] + +# Set up PATH so figlet can be found +DIRSAVE=`pwd` +cd `dirname "$0"` +PATH="$PATH":`pwd` +cd "$DIRSAVE" + +# Get figlet version +FIGLETVERSION=`figlet -I1 2>/dev/null` +if [ -z "$FIGLETVERSION" ]; then + FIGLETVERSION=20000 +fi + +USAGE="Usage: `basename $0` [ -d directory ] [ word ]" + +if [ "$1" = '-d' ]; then + FONTDIR="$2" + WORD="$3" + if [ $# -gt 3 ] || [ $# -lt 2 ]; then + echo "$USAGE" + exit 1 + fi +else + WORD="$1" + if [ $# -gt 1 ]; then + echo "$USAGE" + exit 1 + fi + if [ "$FIGLETVERSION" -lt 20100 ]; then + # figlet 2.0 + FONTDIR="`figlet -F | sed -e '1d' -e '3,$d' -e 's/Font directory: //'`" + else + # figlet 2.1 or later + FONTDIR="`figlet -I2`" + fi +fi + +cd "$FONTDIR" +FONTLIST=`ls *.flf | sed s/\.flf$//` +cd $DIRSAVE +for F in $FONTLIST ; do + echo "$F" : + if [ -n "$WORD" ]; then + echo "$WORD" | figlet -d "$FONTDIR" -f "$F" + else + echo "$F" | figlet -d "$FONTDIR" -f "$F" + fi + echo "" ; echo "" +done -- cgit v1.2.3