[
https://issues.apache.org/jira/browse/PDFBOX-6345?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18152450#comment-18152450
]
Tilman Hausherr edited comment on PDFBOX-6345 at 11/28/26, 8:49 PM:
--------------------------------------------------------------------
Thank you. Because the change (or even bigger changes in that line) didn't fail
anything, I added a rendering test based on a string that would fill the field.
The old code would fail both the equality test and the rendering test because
of the effect that you described.
was (Author: tilman):
Thank you. Because the change (or even bigger changes in that line) didn't fail
anything, I added a rendering test based on a string that would fill the field.
The old code would fail both the equality test and the renndering test because
of the effect that you described.
> Auto-sized multiline text fields compute line breaks for a width reduced by
> the padding
> ---------------------------------------------------------------------------------------
>
> Key: PDFBOX-6345
> URL: https://issues.apache.org/jira/browse/PDFBOX-6345
> Project: PDFBox
> Issue Type: Bug
> Components: AcroForm
> Affects Versions: 2.0.37, 3.0.8 PDFBox, 4.0.0
> Reporter: Martin Mirchev
> Assignee: Tilman Hausherr
> Priority: Major
> Fix For: 2.0.38, 3.0.9 PDFBox, 4.0.0
>
>
> In {{AppearanceGeneratorHelper.calculateFontSize}}, the multiline branch uses
> {{float width = contentRect.getWidth() - contentRect.getLowerLeftX();}}.
> {{contentRect}} is already the padded content area, so subtracting its lower
> left x reduces the width a second time. The text is then laid out with
> {{contentRect.getWidth()}} (the {{PlainTextFormatter}} in
> {{insertGeneratedAppearance}}), so the font size is chosen for a narrower
> field than the one the lines are drawn into: auto-sized ({{0 Tf}}) multiline
> fields can get a smaller font than fits. {{contentRect.getWidth()}} would
> make the two agree.
> This issue was found by an LLM-assisted tool and verified manually.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]