Jerrad Pierce > Text-FIGlet-2.19.3 > Text::FIGlet::Ransom

Download:
Text-FIGlet-2.19.3.tgz

Dependencies

Annotate this POD

CPAN RT

Open  1
View/Report Bugs
Module Version: 2.17   Source  

NAME ^

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

SYNOPSIS ^

  use Text::FIGlet;

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

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

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

DESCRIPTION ^

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.

TODO

Treat 0x20 specially?
Unicode support...

OPTIONS ^

new

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.

-U=>boolean

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.

-v=>'vertical-align'

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.

top

Align the tops of the glyphs

center

Align the center of the glyphs

baseline

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

bottom

Align the bottom of the glyphs

random

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.

figify

Inherited from Text::FIGlet::Font.

freeze

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.

ENVIRONMENT ^

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

FIGLIB

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

CAVEATS ^

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.

SEE ALSO ^

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

AUTHOR ^

Jerrad Pierce

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