Bug 26499 - get_text_wrap columns seems to always expect point units
Summary: get_text_wrap columns seems to always expect point units
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Tools (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-21 11:49 UTC by Nick Clemens (kidclamp)
Modified: 2020-09-21 11:50 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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 ."