NAME

Text::FIGlet::Font - font engine 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 as large glyphs 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 glyphs 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, including support for Unicode (UTF-8) in all three. See "CAVEATS" for details.

OPTIONS

new

-d=>fontdir

Whence to load files.

Defaults to /usr/games/lib/figlet

-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. A compressed font should contain only the font itself, and the archive should be renamed with the flf extension.

-m=>layoutmode

Specifies how Text::FIGlet::Font should "smush" and kern consecutive glyphs together. This parameter is optional, and if not specified the layoutmode defined by the font author is used. Acceptable values are -3 through 63, where positive values are created by adding together the corresponding numbers for each desired smush type.

SUMMARY

Value  Width  Old CLI  Description
 -3     +++            monospace
 -1      ++   -W       full width
  0       +   -k       kern
undef     -   -o       overlap/universal smush

  1       -   -S -m1   smush equal characters
  2       -   -S -m2   smush underscores
  4       -   -S -m4   smush hierarchy
  8       -   -S -m8   smush opposite pairs
 16       -   -S -m16  smush big X
 32       -   -S -m32  smush hardblanks

 Old CLI is the figlet(6) equivalent option.
 Monospace is also available via the previous value of -0.
-3, Monospace

This will pad each glyph in the font such that they are all the same width. The padding is done such that the glyph is centered in it's "box," and any odd padding is on the trailing edge. ____ / ___| ___ __ __ | | / _ \ \ \ /\ / / | |___ | (_) | \ V V / \____| \___/ \_/\_/

|-----------+-----------+-----------| -- equal-sized boxes
-1, Full width

No smushing or kerning, glyphs are simply concatenated together. ____ / ___| ___ __ __ | | / _ \ \ \ /\ / / | |___ | (_) | \ V V / \____| \___/ \_/\_/

0, Kern

Kern only i.e; glyphs are pushed together until they touch. ____ / ___| ___ __ __ | | / _ \\ \ /\ / / | |___| (_) |\ V V / \____|\___/ \_/\_/

undef, Universal smush

Glyphs are kerned, then shifted so that they overlap by column of characters: ____ / ___|_____ __ | | / _ \ \ /\ / / | |__| (_) \ V V / \____\___/ \_/\_/

Other smush modes are not yet implemented, and therefore fall back to universal.

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.)

-m=>layoutmode

Although --m is best thought of as a font instantiation option, it is possible to switch between layout modes greater than zero at figification time. Your mileage may vary.

-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 every character; most useful with -m=>-3

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

Text::FIGlet, figlet(6)

CAVEATS & RESTRICTIONS

$/ 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.05. Unfortunately, the default test suite makes use of code that is not compatable with versions of perl prior to 5.6. t/5005-lib.pm attempts to work around this to provide some basic testing of functionality.

Support for TOIlet fonts

Although the FIGlet font specification is not clear on the matter, convention dictates that there be no trailing whitespace after the end of line marker. Unfortunately some auto-generated TOIlet fonts break with this convention, while also lacking critical hardspaces. To fix these fonts, unzip then run perl -pi~ -e 's/@ $/$\@/' on them.

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{...}" over chr. 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

Negative character codes

There is limited support for negative character codes, at this time only characters -2 through -65_535 are supported.

Memory

The standard font is 4Mb with no optimizations.

Listed below are increasingly severe means of reducing memory use when creating an object.

-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.

AUTHOR

Jerrad Pierce

              **                                    />>
   _         //                         _  _  _    / >>>
  (_)         **  ,adPPYba,  >< ><<<  _(_)(_)(_)  /   >>>
  | |        /** a8P_____88   ><<    (_)         >>    >>>
  | |  |~~\  /** 8PP"""""""   ><<    (_)         >>>>>>>>
 _/ |  |__/  /** "8b,   ,aa   ><<    (_)_  _  _  >>>>>>> @cpan.org
|__/   |     /**  `"Ybbd8"'  ><<<      (_)(_)(_) >>  
             //                                  >>>>    /
                                                  >>>>>>/
                                                   >>>>>