NAME
Text::FIGlet::Font - text generation for Text::FIGlet
SYNOPSIS
use Text::FIGlet;
my $font = Text::FIGlet->new(-f=>"doh");
print ~~$font->figify(-A=>"Hello World");
DESCRIPTION
Text::FIGlet::Font reproduces its input using large characters made up of other characters; usually ASCII, but not necessarily. The output is similar to that of many banner programs--although it is not oriented sideways--and reminiscent of the sort of signatures many people like to put at the end of e-mail and UseNet messages.
Text::FIGlet::Font can print in a variety of fonts, both left-to-right and right-to-left, with adjacent characters kerned and smushed together in various ways. FIGlet fonts are stored in separate files, which can be identified by the suffix .flf. Most FIGlet font files will be stored in FIGlet's default font directory /usr/games/lib/figlet. Support for TOIlet fonts *.tlf, which are typically in the same location, has also been added.
This implementation is known to work with perl 5.005, 5.6 and 5.8, with support for Unicode characters in each. See "CAVEATS" for details.
OPTIONS
new
- -D=>boolean
-
-D switches to the German (ISO 646-DE) character set. Turns [, \ and ] into umlauted A, O and U, respectively. {, | and } turn into the respective lower case versions of these. ~ turns into s-z.
This option is deprecated, which means it may soon be removed from Text::FIGlet::Font. The modern way to achieve this effect is with Text::FIGlet::Control.
- -U=>boolean
-
A true value, the default, is necessary to load Unicode font data; regardless of your version of perl
Note that you must explicitly specify 1 if you are mapping in negative characters with a control file. See "CAVEATS" for more details.
- -f=>fontfile
-
The font to load; defaults to standard.
The fontfile may be zipped if IO::Uncompress::Unzip is available.
- -m=>smushmode
-
Specifies how Text::FIGlet::Font should ``smush'' and kern consecutive characters together. On the command line, -m0 can be useful, as it tells FIGlet to kern characters without smushing them together. Otherwise, this option is rarely needed, as a Text::FIGlet::Font font file specifies the best smushmode to use with the font. -m is, therefore, most useful to font designers testing the various smushmodes with their font. smushmode can be -2 through 63.
- -2
-
Get mode from font file (default).
Every FIGlet font file specifies the best smushmode to use with the font. This will be one of the smushmodes (-1 through 63) described in the following paragraphs.
- -1
-
No smushing or kerning.
Characters are simply concatenated together.
- -0
-
Fixed width.
This will pad each character in the font such that they are all a consistent width. The padding is done such that the character is centered in it's "cell", and any odd padding is the trailing edge.
- 0
-
Kern only.
Characters are pushed together until they touch.
figify
Returns a a string or list of lines, depending on context.
- -A=>text
-
The text to transmogrify.
- -U=>boolean
-
Process input as Unicode (UTF-8).
Note that this applies regardless of your version of perl, and is necessary if you are mapping in negative characters with a control file.
- -X=>[LR]
-
These options control whether FIGlet prints left-to-right or right-to-left. L selects left-to-right printing. R selects right-to-left printing. The default is to use whatever is specified in the font file.
- -x=>[lrc]
-
These options handle the justification of Text::FIGlet::Font output. c centers the output horizontally. l makes the output flush-left. r makes it flush-right. The default sets the justification according to whether left-to-right or right-to-left text is selected. Left-to-right text will be flush-left, while right-to-left text will be flush-right. (Left-to-rigt versus right-to-left text is controlled by -X.)
- -w=>outputwidth
-
The output width, output text is wrapped to this value by breaking the input on whitspace where possible. There are two special width values
-1 the text is not wrapped. 1 the text is wrapped after very character.
Defaults to 80
ENVIRONMENT
Text::FIGlet::Font will make use of these environment variables if present
- FIGFONT
-
The default font to load. If undefined the default is standard.flf. It should reside in the directory specified by FIGLIB.
- FIGLIB
-
The default location of fonts. If undefined the default is /usr/games/lib/figlet
FILES
FIGlet font files are available at
ftp://ftp.figlet.org/pub/figlet/
SEE ALSO
CAVEATS
- $/ is used to create the output string in scalar context
-
Consequently, make sure it is set appropriately i.e.; Don't mess with it, perl sets it correctly for you.
- -m=>'-0'
-
This mode is peculiar to Text::FIGlet, and as such, results will vary amongst fonts.
- Support for pre-5.6 perl
-
This codebase was originally developed to be compatible with 5.005.03, and has recently been manually checked against 5.005.04. Unfortunately, the default test suite makes use of code that is not compatable with versions of perl prior to 5.6. test.pl attempts to work around this to provide some basic testing of functionality.
Unicode
- Pre-5.8
-
Perl 5.6 Unicode support was notoriously sketchy. Best efforts have been made to work around this, and things should work fine. If you have problems, favor
"\x{...}"
overchr
. See also "NOTES" in Text::FIGlet - Pre-5.6
-
Text::FIGlet does provide limited support for Unicode in perl 5.005. It understands "literal Unicode characters" (UTF-8 sequences), and will emit the correct output if the loaded font supports it. It does not support negative character mapping at this time. See also "NOTES" in Text::FIGlet
Memory
The standard font is 4Mb with no optimizations.
Listed below are increasingly severe means of reducing memory use.
- -U=>-1
-
This loads Unicode fonts, but skips negative characters. It's the default.
The standard font is 68kb with this optimization.
- -U=>0
-
This only loads ASCII characters; plus the Deutsch characters if -D is true.
The standard font is 14kb with this optimization.
BUGS
Inclusion of wide characters (UTF8) as glyph fragments, as in many TOIlet fonts, may cause premature wrapping. You should not see this if your perl supports UTF-8 natively, and you do not have IO::Uncompress::Unzip installed for zip font support; I'm not convinced it's worth sniffing to see if the file's uncompressed if you do have the module installed.
A work-around is to pass a -w 3 times the width needed; an approximation, since the most likely Unicode characters to be used in font are the block elements and line drawing characters.
RESTRICTIONS
There is support for negative characters -1 through -65,536.
AUTHOR
Jerrad Pierce
** />>
_ // _ _ _ / >>>
(_) ** ,adPPYba, >< ><<< _(_)(_)(_) / >>>
| | /** a8P_____88 ><< (_) >> >>>
| | |~~\ /** 8PP""""""" ><< (_) >>>>>>>>
_/ | |__/ /** "8b, ,aa ><< (_)_ _ _ >>>>>>> @cpan.org
|__/ | /** `"Ybbd8"' ><<< (_)(_)(_) >>
// >>>> /
>>>>>>/
>>>>>