NAME

Document::Writer::TextLayout - Text layout engine

SYNOPSIS

use Document::Writer;

my $doc = Document::Writer->new(default_color => ...);
my $p = $doc->next_page($width, $height);
$p->add_text_to_page($driver, $font, $text);
...

METHODS

font

Set/Get this text layout's font.

height

Get the height of this text layout. Only useful after layout has been called.

lines

Set/Get this text layout's 'lines'. This is an arrayref of hashrefs, where each hashref has the following members:

box

The bounding box for the text in this line. This bounding box does not take rotations into consideration.

cb

The bounding box of required for a container that intends to contain the text in this line.

text

The text in this line.

This data structure is the meat of a TextLayout. The multi-line, unwrapped text is broken down into this datastructure based on the width attribute.

slice ($offset, [$size])

Given an offset and an optional size, returns n lines from this layout that come as close to $size without exceeding it. This method is provided to allow incremental rendering of text. For example, if you have a series of containers 80 units high, you might write code like this:

for(my $i = 0; $i < 3; $i++) {
    $lines = $layout->slice($i * 80, 80);
    # render the text
}
text

Set/Get the text to be laid out.

width

Get/Set the width at which the text in this TextLayout should be wrapped.

AUTHOR

Cory Watson, <gphat@cpan.org>

Infinity Interactive, http://www.iinteractive.com

BUGS

Please report any bugs or feature requests to bug-geometry-primitive at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Geometry-Primitive. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

COPYRIGHT & LICENSE

Copyright 2008 by Infinity Interactive, Inc.

http://www.iinteractive.com

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.