Skip Menu |

This queue is for tickets about the PDF-ReportWriter CPAN distribution.

Report information
The Basics
Id: 42327
Status: open
Priority: 0/
Queue: PDF-ReportWriter

People
Owner: Nobody in particular
Requestors: Thomas.Bartschies [...] cvk.de
Cc:
AdminCc:

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



Subject: Bug in text wrapping function
Date: Mon, 12 Jan 2009 13:37:14 +0100
To: <bug-PDF-ReportWriter [...] rt.cpan.org>
From: "Bartschies, Thomas" <Thomas.Bartschies [...] cvk.de>
Hello, we've found a bug in the wrap_text sub function. It occurs if there's no last space to be found in the rest of a paragraph and the remaining size of the paragraph is more than the allowed width of the column. This is tested with by the advancewidth function. In this case the last_space variable remains 0 and position remains < length (paragraph). We fixed it for ourselves by applying the following changes: @@ -2125,6 +2126,7 @@ my $position = 0; my $last_space = 0; + my $space_found = 0; while ( ( $self->{txt}->advancewidth( substr( $paragraph, 0, $position ) ) < $text_width ) @@ -2142,6 +2144,10 @@ # This bit doesn't need wrapping. Take it all $length = $position; + + } elsif ( $last_space == 0 ) { + + $length = $position - 1; } else { @@ -2149,16 +2155,18 @@ # Go back to the last space $length = $last_space; + $space_found = 1; } if ( $self->{debug} ) { - print "PDF::ReportWriter::wrap_text returning line: " . substr( $paragraph, 0, $length ) . "\n\n"; + print STDERR "PDF::ReportWriter::wrap_text returning line: " . substr( $paragraph, 0, $length ) . "\n\n"; } push @wrapped_text, substr( $paragraph, 0, $length ); - $paragraph = substr( $paragraph, $length + 1, length( $paragraph ) - $length ); + $paragraph = substr( $paragraph, $length + $space_found, + length( $paragraph ) - $length ); } Regards, -- i. A. Thomas Bartschies IT Systeme Cornelsen Verlagskontor GmbH Kammerratsheide 66, 33609 Bielefeld Telefon 0521.9719-310 Telefax 0521.9719-93310 http://www.cvk.de AG Bielefeld HRB 39324 - Geschäftsführer: Horst Keplinger Geschäftsführende Komplementärin: AG Bielefeld HRB 7107 - Cornelsen Verlagskontor Verwaltungs-GmbH Weitere Komplementärin: AG Charlottenburg HRA 20764 - Cornelsen Verlagsholding GmbH & Co., Berlin
Subject: Re: [rt.cpan.org #42327] Bug in text wrapping function
Date: Tue, 13 Jan 2009 16:10:57 +1100
To: bug-PDF-ReportWriter [...] rt.cpan.org, Thomas.Bartschies [...] cvk.de
From: Daniel Kasak <dan [...] entropy.homelinux.org>
On Mon, 2009-01-12 at 07:37 -0500, Bartschies, Thomas via RT wrote: Show quoted text
> Hello, > > we've found a bug in the wrap_text sub function. It occurs if there's no last space to be found > in the rest of a paragraph and the remaining size of the paragraph is more than the allowed > width of the column. This is tested with by the advancewidth function. > > In this case the last_space variable remains 0 and position remains < length (paragraph). > We fixed it for ourselves by applying the following changes:
Hi. Thanks for using my software. Thanks a LOT for the patch :) I will try to get this out in a release in the next couple of days. Development has stalled a little recently, as I have a new baby. Also I received a patch which adds some very cool functionality, but also broke barcode support ( which I didn't add and don't use, so it's hard to debug ). I've been meaning to look into this and figure out what to do, but have lacked time. Anyway, I'll probably roll these changes back, release a new version with your patch and some other small things ( again, time permitting ), and then get back to figuring out what happened to barcode support since the big patch. Thanks again for your contribution. Do you mind if I mention you by name in the credits at the top of the source? Dan
Subject: AW: [rt.cpan.org #42327] Bug in text wrapping function
Date: Tue, 13 Jan 2009 11:48:16 +0100
To: <bug-PDF-ReportWriter [...] rt.cpan.org>
From: "Bartschies, Thomas" <Thomas.Bartschies [...] cvk.de>
Hi. I don't mind being mentioned in the credits. Thank you. Mit freundlichen Grüßen, -- Thomas Bartschies CVK IT Systeme Show quoted text
-----Ursprüngliche Nachricht----- Von: Daniel Kasak via RT [mailto:bug-PDF-ReportWriter@rt.cpan.org] Gesendet: Dienstag, 13. Januar 2009 11:10 An: Bartschies, Thomas Betreff: Re: [rt.cpan.org #42327] Bug in text wrapping function <URL: http://rt.cpan.org/Ticket/Display.html?id=42327 > On Mon, 2009-01-12 at 07:37 -0500, Bartschies, Thomas via RT wrote:
> Hello, > > we've found a bug in the wrap_text sub function. It occurs if there's no last space to be found > in the rest of a paragraph and the remaining size of the paragraph is more than the allowed > width of the column. This is tested with by the advancewidth function. > > In this case the last_space variable remains 0 and position remains < length (paragraph). > We fixed it for ourselves by applying the following changes:
Hi. Thanks for using my software. Thanks a LOT for the patch :) I will try to get this out in a release in the next couple of days. Development has stalled a little recently, as I have a new baby. Also I received a patch which adds some very cool functionality, but also broke barcode support ( which I didn't add and don't use, so it's hard to debug ). I've been meaning to look into this and figure out what to do, but have lacked time. Anyway, I'll probably roll these changes back, release a new version with your patch and some other small things ( again, time permitting ), and then get back to figuring out what happened to barcode support since the big patch. Thanks again for your contribution. Do you mind if I mention you by name in the credits at the top of the source? Dan