Bug 39295: Prevent infinite loop on line wrapping
This change checks that the string width is larger than 0 before
attempting to perform line wrapping on the line.
Test plan:
0. Apply the patch and koha-plack --restart kohadev
1. Follow instructions at end of this message[1]
2. Note that the infinite loop does not happen and that a blank
card is created
3. Export the batch using the test layout and template that come
with koha-testing-docker
4. Note that the patron card is correctly created
[1]
To reproduce:
0. Change Koha test user's firstnameto "Firstname" and surname to "Lastname"
1. Create a template:
Units: PostScript Points
Page height: 60pt
Page width: 60pt
Card height: 60pt
Card with: 60pt
Top page margin: 10pt
Left page margin: 10pt
Number of columns: 1
Number of rows: 1
Gap between columns: 10pt
Gap between rows: 10pt
2. Create a layout:
Units: US inches
Field 1:
Text: Library Name
Font: Times-Roman
Font size: 12 pt
Text alignment: Left
Lower left X coordinate: 100in
Lower left Y coordinate: 100in
Field 2:
Text: <firstname> <surname>
Font: Times-Roman
Font size: 10pt
Text alignment: Left
Lower left X coordinate: 5in
Lower left Y coordinate: 5in
3. Create a batch for borrowernumber 51 (if using "koha" test user in ktd)
4. Export using the above template and layout
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit e223b17d68)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
42294d2ad0
commit
bda71423bf
|
|
@ -286,7 +286,7 @@ sub draw_text {
|
|||
|
||||
# $font_units_width = $m->string_width($line);
|
||||
# $string_width = ($font_units_width * $text_attribs->{'font_size'}) / $units_per_em;
|
||||
if ( ( $string_width + $text_attribs->{'llx'} ) < $self->{'width'} ) {
|
||||
if ( $string_width && ( ( $string_width + $text_attribs->{'llx'} ) < $self->{'width'} ) ) {
|
||||
( $Tx, $Tw ) = text_alignment(
|
||||
$origin_llx, $self->{'width'}, $text_attribs->{'llx'}, $string_width, $line,
|
||||
$text_attribs->{'text_alignment'}
|
||||
|
|
|
|||
Loading…
Reference in New Issue