Bug 5247 - Text does not wrap properly on labels
authorChris Nighswonger <cnighswonger@foundations.edu>
Fri, 24 Sep 2010 14:48:24 +0000 (10:48 -0400)
committerChris Nighswonger <cnighswonger@foundations.edu>
Fri, 24 Sep 2010 14:48:24 +0000 (10:48 -0400)
The apparent fix is to have the text wrap alogrithm to calculate based
on a label width reduced by approx. 3/16" when there is no left text margin.

This is probably not the proper fix as it appears that this algorithm is being
affected by adjustments in the label width for label creep and perhaps offset
as well. But this does fix the symptom and is all the time available for this
problem at present.

Documentation Changes:

It might be good to add a note to the effect that if the user does not supply
a left text margin in the layout, a 3/16" (13.5 point) left text margin will
apply by default.

C4/Creators/Layout.pm

index a38f347..1a912fe 100644 (file)
@@ -95,8 +95,6 @@ sub retrieve {
     my %opts = @_;
     my $type = ref($invocant) || $invocant;
     my $query = "SELECT * FROM creator_layouts WHERE layout_id = ? AND creator = ?";
-    #warn "QUERY: $query\n";    #XXX Remove
-    #warn "PARAMS: layout_id=" . $opts{'layout_id'} . " creator=" . $opts{'creator'} . "\n";    #XXX Remove
     my $sth = C4::Context->dbh->prepare($query);
     $sth->execute($opts{'layout_id'}, $opts{'creator'});
     if ($sth->err) {
@@ -221,7 +219,7 @@ sub get_text_wrap_cols {
     my $string = '';
     my $strwidth = 0;
     my $col_count = 0;
-    my $textlimit = $params{'label_width'} - ( 3 * $params{'left_text_margin'});
+    my $textlimit = $params{'label_width'} - (( 3 * $params{'left_text_margin'} ) || 13.5 );
 
     while ($strwidth < $textlimit) {
         $string .= '0';