Skip Menu |

This queue is for tickets about the Imager CPAN distribution.

Report information
The Basics
Id: 87338
Status: resolved
Priority: 0/
Queue: Imager

People
Owner: Nobody in particular
Requestors: jt [...] plainblack.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Imager::Font::Wrap
Date: Thu, 25 Jul 2013 23:40:44 -0500
To: bug-Imager [...] rt.cpan.org
From: JT Smith <jt [...] plainblack.com>
I'm not sure if the documentation is wrong, or the code is wrong, but they are out of sync. If you call wrap_text() without an image reference it returns nothing. So you have to create a temporary image in order to actually precalc the left, top, right, bottom params. However, the docs indicate you can do the precalc without passing an image reference: You can use this to calculate the space required to format the text before doing it: my ($left, $top, $right, $bottom) = Imager::Font::Wrap->wrap_text(string => $string, font => $font, width => $xsize);
On Fri Jul 26 00:40:58 2013, jt@plainblack.com wrote: Show quoted text
> I'm not sure if the documentation is wrong, or the code is wrong, but > they are out of sync. > > If you call wrap_text() without an image reference it returns nothing. > So you have to create a temporary image in order to actually precalc > the left, top, right, bottom params. > > However, the docs indicate you can do the precalc without passing an > image reference: > > > You can use this to calculate the space required to format the text > before doing it: > > my ($left, $top, $right, $bottom) = > Imager::Font::Wrap->wrap_text(string => $string, > font => $font, > width => $xsize);
You're right, the documentation and code don't match. You can do the calculation without an image by supplying an explicit image => undef. For the next release I'm removing that requirement, since I don't see the point of requiring an image parameter when I don't require an image, Tony
On Fri Jul 26 00:40:58 2013, jt@plainblack.com wrote: Show quoted text
> I'm not sure if the documentation is wrong, or the code is wrong, but > they are out of sync. > > If you call wrap_text() without an image reference it returns nothing. > So you have to create a temporary image in order to actually precalc > the left, top, right, bottom params. > > However, the docs indicate you can do the precalc without passing an > image reference: > > > You can use this to calculate the space required to format the text > before doing it: > > my ($left, $top, $right, $bottom) = > Imager::Font::Wrap->wrap_text(string => $string, > font => $font, > width => $xsize);
Fixed in Imager 0.98, thanks for the report. Tony