The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

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 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 specified by the font author is used. Acceptable values are -3 through 63, where positive values are created by 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 I<-0>.
-3

Fixed width.

This will pad each glyph in the font such that they are all a consistent width. The padding is done such that the glyph is centered in it's "box," and any odd padding is on the trailing edge.

-1

No smushing or kerning, glyphs are simply concatenated together.

0

Kern only i.e; glyphs are pushed together until they touch.

Note that this module does not properly kern at this time, as it kerns glyph containers rather than the glyphs proper. The difference is most pronounced in slanted fonts:

  Kerned glyph   Kerned box
      __  __ _       __  __    _        
     / / / /(_)     / / / /   (_)
    / /_/ // /     / /_/ /   / /        
   / __  // /     / __  /   / / 
  /_/ /_//_/     /_/ /_/   /_/   
undef

Overlap glyphs by one column: _ _ _ _ _ _ _ _ | | | | ___| | | ___ | | | | ___ | || | ___ | |_| |/ _ | | |/ _ \ | |_| | / _ \| || | / _ \ | _ | __| | | (_) | vs. | _ || __/| || || (_) | |_| |_|\___|_|_|\___/ |_| |_| \___||_||_| \___/

Note that for the reasons described above, overlap does not yet work for slanted fonts.

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

Text::FIGlet, figlet(6)

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

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

RESTRICTIONS

There is support for negative characters -1 through -65,536.

AUTHOR

Jerrad Pierce

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