Bug 41255 - Text fields center / right align on patron card is wonky
Summary: Text fields center / right align on patron card is wonky
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Label/patron card printing (show other bugs)
Version: 24.11
Hardware: All All
: P5 - low normal
Assignee: Chris Nighswonger
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-11-16 21:14 UTC by Indranil Das Gupta
Modified: 2025-11-16 21:31 UTC (History)
1 user (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: ---
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
UX screenshot (96.13 KB, image/png)
2025-11-16 21:14 UTC, Indranil Das Gupta
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Indranil Das Gupta 2025-11-16 21:14:14 UTC
Created attachment 189625 [details]
UX screenshot

Version: 24.11.10 (LTS)

layout_xml (left aligned text field)

<opt guide_box="1" guide_grid="0" page_side="F" units="POINT">
  <barcode height_scale="0.008" llx="35" lly="10" print="1" type="CODE39" width_scale="0.8" />
  <text>☐ Year 1   ☐ Year 2   ☐ Year 3   ☐ Year 4</text>
  <text font="H" font_size="10" llx="0" lly="75" text_alignment="L" />
</opt>

When text_alignment="L" - output is OK (Screenshot #1)

When text_alignment="C" - output is wonky (Screenshot #2)

When text_alignment="R" - output is wonky (Screenshot #3)

NOTE: all other settings being same for L, C and R

This seems to fix the issue (I may have missed outlier / edge cases)

diff /usr/share/koha/lib/C4/Patroncards/Patroncard.pm /usr/share/koha/lib/C4/Patroncards/Patroncard.pm.new
325c325
<             ($Tx, $Tw) = text_alignment($origin_llx, $self->{'width'}, $lly_text_attr * $self->{'unitvalue'}, $string_width, $line, $text_attribs->{'text_alignment'});
---
>             ($Tx, $Tw) = text_alignment($origin_llx, $self->{'width'}, $llx_text_attr * $self->{'unitvalue'}, $string_width, $line, $text_attribs->{'text_alignment'});

diff /usr/share/koha/lib/C4/Patroncards/Lib.pm /usr/share/koha/lib/C4/Patroncards/Lib.pm.new
62c62
<         $Tx = ($text_box_width - $string_width) + (($origin_llx - $text_llx) / 2);
---
>         $Tx = ($text_box_width - $string_width) + ($origin_llx - $text_llx);

Can someone pls verify this?