You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Andreas Lehmkühler (Jira)" <ji...@apache.org> on 2024/03/12 17:00:00 UTC
[jira] [Commented] (PDFBOX-5784) AppearanceGeneratorHelper assumes fontscale 1000
[ https://issues.apache.org/jira/browse/PDFBOX-5784?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17825738#comment-17825738 ]
Andreas Lehmkühler commented on PDFBOX-5784:
--------------------------------------------
At least for TrueType fonts we have to take the value of unitsPerEM into account. In most cases it is 1000 but there are fonts using 2048.
{{org.apache.fontbox.ttf.TrueTypeFont.getUnitsPerEm()}} can be used to get that value
> AppearanceGeneratorHelper assumes fontscale 1000
> ------------------------------------------------
>
> Key: PDFBOX-5784
> URL: https://issues.apache.org/jira/browse/PDFBOX-5784
> Project: PDFBox
> Issue Type: Bug
> Components: AcroForm
> Reporter: Tilman Hausherr
> Priority: Major
> Attachments: screenshot-1.png, with_dividing_by_2.pdf, without_dividing.pdf
>
>
> The user in the attached SO question noticed that the comb adjustment needed a factor of 2 to work correctly. A look at the font shows UnitsPerEm = 2048.
> Sample code:
> {code:java}
> doc.getDocumentCatalog().getAcroForm().getField("field1").setValue("WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW");
> doc.getDocumentCatalog().getAcroForm().getField("field2").setValue("MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM");
> {code}
> !screenshot-1.png!
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org