https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41718

--- Comment #1 from Chris Nighswonger 
<[email protected]> ---
Created attachment 202136
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=202136&action=edit
Bug 41718: Fix incorrect PDF method arguments in draw_guide_grid()

The unit-info rendering at the end of draw_guide_grid() had two
argument bugs:

1) $pdf->Font('Courier') passes a font name that matches no entry in
   koha-conf.xml's <ttf> block (the monospace face is configured under
   font code "C"), so the TTF lookup warns and falls through to the
   base-14 fallback instead of the configured font.

2) $pdf->StrWidth($strtop) omits the font and size arguments.
   C4::Creators::PDF::StrWidth() expects ($string, $font, $fontSize)
   and passes the undef font into Font(), producing a stream of
   uninitialized-value warnings and a second failed TTF lookup per
   call.

Use the configured monospace font code "C" for both calls and pass
the font and size through to StrWidth().

Verified in koha-testing-docker with the ktd <ttf> configuration:
before, one draw_guide_grid() call emits 17 warnings (uninitialized
$fontName, missing <font type="Courier"> / <font type="">); after,
zero warnings, and the unit-info text renders with the configured
DejaVuSansMono TTF instead of the silent base-14 fallback.

Test plan:
1) Apply Bug 41719's tests; note t/db_dependent/Patroncards/
   t_Patroncard.t filters known Bug 41718 warnings around
   draw_guide_grid() (see run_allowing_bug_41718_warnings)
2) Apply this patch:
     prove t/db_dependent/Patroncards/t_Patroncard.t
   -- all tests pass; the filtered warnings no longer occur
3) Or manually: enable the guide grid in a patron card batch export
   and check the plack error log -- no font/StrWidth warnings, and
   the corner unit labels render in the configured monospace font

AI Assistance: Claude Fable 5 (Anthropic) implemented the fix from
the bug report's analysis, reproduced the warning behavior before and
after in koha-testing-docker, and verified the Bug 41719 test suite
against the change. Human author reported the underlying defect,
directed the approach, and reviewed the change.

Assisted-by: Claude Fable 5 (Anthropic)

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to