Bug 26499

Summary: get_text_wrap columns seems to always expect point units
Product: Koha Reporter: Nick Clemens (kidclamp) <nick>
Component: ToolsAssignee: Bugs List <koha-bugs>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: andrew, cnighswonger
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:

Description Nick Clemens (kidclamp) 2020-09-21 11:49:47 UTC
I am not sure about this one, and the code seems to be very early code.

See bug 5247 - it adds a default of 13.5 points if no left text margin is set. Otherwise the value is 3 times the margin value?

I suspect this is to not run directly up against the margin, but I don't understand why?

We multiply by 3 no matter what the unit, or the font size, or anything really.

Additionally the comparison here is against the return from C4::Creators::PDF->StrWidth which always returns values in points, so we end up comparing other units times three against points?

Lastly, we use the value returned for wrapping, but if we determine 4 characters fit and we pass that back, Text::Wrap shortens to one less than the columns value, so only 3 characters will fit on a line

https://perldoc.perl.org/Text/Wrap.html
"Lines are wrapped at $Text::Wrap::columns columns (default value: 76). $Text::Wrap::columns should be set to the full width of your output device. In fact, every resulting line will have length of no more than $columns - 1 ."