[
https://issues.apache.org/jira/browse/PDFBOX-1689?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14003490#comment-14003490
]
Tilman Hausherr commented on PDFBOX-1689:
-----------------------------------------
I like it!
Result of diff tests:
The file from PDFBOX-1435 isn't rendered properly, the "2011" is missing.
I get a few NPEs on windows, related to the failure of doing certain null
checks:
- namingTable.getPSName() can be null for some barcode fonts I can't share
- fontfinder.getCommonTTFMapping() is null for me (the windows method does
return null)
doing null checks solves the problem with the file from PDFBOX-1435.
Several images have some very slight differences in glyph rendering.
Also weird: some font files have unicodes names, which look like this:
namingTable.getPSName(): *A*r*i*a*l*-*I*t*a*l*i*c*M*T* (the star is zero)
and the normalized name is the same in lowercase.
Solution:
Adding a check for (platform == 0) in NamingTable.java and assigning charset
UTF-16 solves this, see also
https://www.microsoft.com/typography/otspec/name.htm
Same for (platform == 3 && encoding == 0), also assigning charset UTF-16 solves
this.
Re: mappings: you're using the normalized font name when storing what you
found, but not when searching for a font name. Because of that, I get "Font not
found: TimesNewRomanPSMT" although the font is there as "timesnewromanpsmt".
More mappings are needed on Windows. Here are mine:
{code}
addFontMapping("arial", "arialmt", fontMappingTTF);
addFontMapping("arialbold", "arialmtbold", fontMappingTTF);
addFontMapping("arialitalic", "arialmtitalic", fontMappingTTF);
addFontMapping("arialbolditalic", "arialmtbolditalic", fontMappingTTF);
addFontMapping("timesnewroman", "timesnewromanpsmt", fontMappingTTF);
addFontMapping("timesnewromanbold", "timesnewromanpsmtbold", fontMappingTTF);
addFontMapping("timesnewromanbolditalic", "timesnewromanpsmtbolditalic",
fontMappingTTF);
addFontMapping("timesnewromanitalic", "timesnewromanpsmtitalic",
fontMappingTTF);
addFontMapping("couriernew", "couriernewpsmt", fontMappingTTF);
addFontMapping("couriernewbold", "couriernewpsmtbold", fontMappingTTF);
addFontMapping("couriernewitalic", "couriernewpsmtitalic", fontMappingTTF);
addFontMapping("couriernewbolditalic", "couriernewpsmtbolditalic",
fontMappingTTF);
addFontMapping("symbol", "symbolmt", fontMappingTTF);
{code}
After activating this, the slight differences in glyph rendering go away. I
guess the cause was that they were rendered with awt prior to the added mapping.
> Partial failure to render PDF
> -----------------------------
>
> Key: PDFBOX-1689
> URL: https://issues.apache.org/jira/browse/PDFBOX-1689
> Project: PDFBox
> Issue Type: Bug
> Components: Rendering
> Affects Versions: 2.0.0
> Reporter: Tilman Hausherr
> Assignee: Andreas Lehmkühler
> Attachments: ELVIA-Reiserucktritt-Vollschutz-01.png,
> ELVIA-Reiserucktritt-Vollschutz-01.png, ELVIA-Reiserucktritt-Vollschutz.pdf
>
>
> The attached file has several issues when rendering:
> - The long "-" symbol replaced (top right, after "Reiseart: gültig für alle
> Reisearten")
> - The € (euro) symbol replaced (top right, after "maximaler Reisepreis: ")
> - The square (on win7) or bullet (on XP) symbol is replaced with a sum symbol
> - The whole text is not rendered in the same font than in acrobat reader
--
This message was sent by Atlassian JIRA
(v6.2#6252)