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

NAME

Text::WrapProp - proportional line wrapping to form simple paragraphs

SYNOPSIS

        use Text::WrapProp qw(wrap_prop);

        print wrap_prop($text, $width, $ref_width_table);

DESCRIPTION

Text::WrapProp::wrap_prop() is a very simple paragraph formatter for proportional text. It formats a single paragraph at a time by breaking lines at word boundries. You must supply the column width in floating point units which should be set to the full width of your output device. A reference to a character width table must also be supplied. The width units can be any metric you choose, as long as the column width and the width table use the same metric.

Proportional wrapping is most commonly used in the publishing industry. In the HTML age, custom proportional wrapping is less often performed as the browser performs the calculations automatically.

EXAMPLE

        use strict;
        use diagnostics;
        
        use Text::WrapProp qw(wrap_prop);

        my @width_table = 0.05 x 256;
        print wrap_prop("This is a bit of text that forms a normal book-style paragraph. Supercajafrajalisticexpialadocious!", 4.00, \@width_table);

BUGS

It's not clear what the correct behavior should be when WrapProp() is presented with a word that is longer than a line. The previous behavior was to die. Now the word is split at line-length.

AUTHOR

James Briggs <james.briggs@yahoo.com>. Styled after Text::Wrap.