#!/usr/bin/perl # # $Id: figlet-farmer.pl,v 1.1 2005/02/10 21:11:47 thor Exp $ use warnings; use strict; use File::Basename; use IPC::Open2; =head1 NAME figlet-farmer - use FIGlet to "farm" all font renderings for a given string =head1 SYNOPSIS B I | B [I] E I =cut # get and remember the user's figlet args and input string my @fig_args = @ARGV; @ARGV = (); my $str = do { local $/; <> }; chomp $str; # generate a list of fonts from figlet's font directory my $fontdir = `figlet -I2`; chomp $fontdir; my @fonts = map basename($_, ".flf"), glob "$fontdir/*.flf"; # for each font, generate the output for my $font (@fonts) { my ($rfd, $wfd); my @cmd = ( qw( figlet -f ), $font, @fig_args ); print "@cmd\n"; open2($rfd, $wfd, @cmd) or die "can't open2(@cmd): $!"; print $wfd "$str\n"; close $wfd; my $rendering = do { local $/; <$rfd> }; close $rfd; wait; print "\n$rendering\n"; } =head1 DESCRIPTION FIGlet is a nifty program that generates ASCII-art stylings of plain old text. For example: $ echo pxsl | figlet -f big _ | | _ ____ _____| | | '_ \ \/ / __| | | |_) > <\__ \ | | .__/_/\_\___/_| | | |_| In the example above, FIGlet rendered the string "pxsl" in the font called "big". Because there are about a zillion FIGlet fonts, it can be painful to find the best one for any particular need. This program makes that job easy by trying them I out, and showing you the results. To continue our example: $ echo pxsl | figlet-farmer.pl figlet -f banner ##### # # #### # # # # # # # # # ## #### # ##### ## # # # # # # # # # # # #### ###### figlet -f big _ | | _ ____ _____| | | '_ \ \/ / __| | | |_) > <\__ \ | | .__/_/\_\___/_| | | |_| figlet -f block _| _|_|_| _| _| _|_|_| _| _| _| _|_| _|_| _| _| _| _| _| _|_| _| _|_|_| _| _| _|_|_| _| _| _| figlet -f bubble _ _ _ _ / \ / \ / \ / \ ( p | x | s | l ) \_/ \_/ \_/ \_/ (about 4,400 lines omitted) Each rendering is preceded by the figlet command that generated it. That way when you find the one you like, you can save the command line to render other strings in the same way. =head1 SEE ALSO The FIGlet web site: http://www.figlet.org/ =head1 AUTHOR Tom Moertel (tom@moertel.com) =head1 COPYRIGHT and LICENSE Copyright (c) 2005 by Thomas G Moertel. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, or any later version. =cut