avalanche123/Imagine — pull request #199 by salemgolemugoo (2013-02-18 14:58:00+00:00)
Title: Fit text to bounding box

I've added support for fitting text in the box with defined width. String exploding into lines by width of the box.

Example code:
$font = new Font('exljbris - MuseoSlab-500.otf', 20, new Color('fff'));
$text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor.';
$img = $imagine->create(new Box(800, 400), new Color('#acacac'));
$img->draw()->line(new Point(400, 0), new Point(400, 400), new Color(array(255, 0, 0)));
$img->draw()->text($text, $font, new Point(5, 5), 0, 400);
$img->draw()->text($text, $font, new Point(405, 5), 0);

![example](https://f.cloud.github.com/assets/1916111/167557/4db22f56-79db-11e2-9a34-a2547cd00f1a.jpeg)