Text::FIGlet::Ransom - blended/composite font support for Text:FIGlet


  use Text::FIGlet;

  my $ransom = Text::FIGlet->new(-f=>[ qw/big block banner/ ]);

  print $ransom->figify("Hi mom");

  _|    _|  (_) #    #        #    #
  _|    _|   _  ##  ##   ___  ##  ##
  _|_|_|_|  | | # ## #  / _ \ # ## #
  _|    _|  | | #    # | (_) |#    #
  _|    _|  |_| #    #  \___/ #    #
                #    #        #    #


This class creates a new FIGlet font using glyphs from user-specified fonts. Output from the resulting hybrid font is suitable for basic textual CAPTCHA, but also has artistic merit. As the output is automatically generated though, some manual adjustment may be necessary; particularly since Text::FIGlet still does not support smushing.


Treat 0x20 specially?
Unicode support...



Loads the specified set of fonts, and assembles glyphs from them to create the new font.

Except where otherwise noted below, options are inherited from Text::FIGlet::Font.

-f=>\@fonts | \%fonts

The array reference form accepts a reference to a list of fonts to use in constructing the new font. When the object is instantiated Ransom iterates over all of the codepoints, randomly copying the glyph for that index from one of the specified fonts.

The hash form accepts a reference to a hash with fonts as keys, and regular expressions as values. If a character matches the supplied regular expression, the glyph for that character is copied from the corresponding font. In addition, a default font to pull glyphs from must be included, but it is specified in reverse, with a key of undef and the font as the value.

  Text::FIGlet->new(-f=>{block=E<gt>qr/[ A-Z]/, undef=>'lean'})

  _|_|_|_|_|                          __
      _|         _____  ____  ____   / /
      _|        / ___/ / __ \/_  /  / /
      _|       / /    / /_/ / / /_ /_/
      _|      /_/     \____/ /___/(_)

In the text above, font means any value accepted by the -f parameter of Text::FIGlet::new.

In either form, an error occurs if less than 2 fonts are given.


Not yet implemented.

A true value is necessary to load Unicode font data, regardless of your version of perl. The default is false.

Note that you must explicitly specify 1 if you are mapping in negative characters with a control file. Otherwise, -1 is more appropriate. See "CAVEATS" in Text::FIGlet::Font for more details.


Because fonts vary in size, it is necessary to provide vertical padding around smaller glyphs, and this option controls how the padding is added. The default is to center the glyphs.


Align the tops of the glyphs


Align the center of the glyphs


Align the the base of the glyphs i.e; align characters such as "q" and "p" as if they had no descenders, thusly having their loops in line with "o".


Align the bottom of the glyphs


Randomly select an alignment for each character when assembling the font.

For code simplicity baseline is not one of the random alignments used, and instead center is twice as likely for an overall distribution of 25% top, 50% center and 25% bottom.


Inherited from Text::FIGlet::Font.


Returns a string containing the current font. This allows for the preservation of the current (random) font for reuse, and to avoid the performance penalty incurred upon Ransom-ization.

To cope with the vagaries of input font formatting, a frozen Ransom font has hardblank & endmark characters converted to DEL (x7F) and US (x1F) respectively.

The frozen font also includes as comments the parameters used to create it. The comments for random ARRAYREF fonts, a map of which characters are pulled from which source font.


Text::FIGlet::Ransom will make use of these environment variables if present


The default location of fonts. If undefined the default is /usr/games/lib/figlet


Ransom does not work well with -m modes other than -1 & 0 at this time.

As noted above, though it is easy to overlook, Ransom only supports ASCII input.

Very few so-called "monospace" display fonts are fixed-width across all codepoints, and the results of mixing FIGlet and TOIlet fonts may be mangled in such a font. Some true monspace fonts include Bitstream Monospace and GNU FreeFont FreeMono. OCR A Std and OCR B MT also work at 9, 11 and 12 points, but not 10.


Text::FIGlet::Font, Text::FIGlet, figlet(6)


Jerrad Pierce

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