[
https://issues.apache.org/jira/browse/PDFBOX-5784?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17825925#comment-17825925
]
Andreas Lehmkühler commented on PDFBOX-5784:
--------------------------------------------
IMHO there are two possible solutions. Either we add something like the
following to AppearanceGeneratorHelper
{code}
private static int getFontScale(PDFont font) throws IOException
{
if (font instanceof PDTrueTypeFont)
{
return ((PDTrueTypeFont) font).getTrueTypeFont().getUnitsPerEm();
}
else if (font instanceof PDType0Font)
{
PDCIDFont cidFont = ((PDType0Font) font).getDescendantFont();
if (cidFont instanceof PDCIDFontType2)
{
return ((PDCIDFontType2)
cidFont).getTrueTypeFont().getUnitsPerEm();
}
}
return DEFAULT_FONTSCALE;
}
{code}
Or we are extending PDFont with a similar implementation
> 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: [email protected]
For additional commands, e-mail: [email protected]