[
https://issues.apache.org/jira/browse/PDFBOX-1689?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14008293#comment-14008293
]
Tilman Hausherr commented on PDFBOX-1689:
-----------------------------------------
I replaced analyzeTTF with this:
{code}
private static void analyzeTTF(String ttfFilename) throws IOException
{
LOG.debug("analyzeTTF: " + ttfFilename);
try
{
Font font = Font.createFont(Font.TRUETYPE_FONT, new
FileInputStream(ttfFilename));
String fontPSName = font.getPSName();
String fontName = font.getFontName(Locale.US);
LOG.debug("getPSName: " + font.getPSName());
LOG.debug("getFontName: " + font.getFontName(Locale.US));
if (fontPSName != null && !fontPSName.isEmpty())
{
ttfFontfiles.put(normalizeFontname(fontPSName), ttfFilename);
}
if (fontName != null && !fontName.isEmpty())
{
ttfFontfiles.put(normalizeFontname(font.getFontName(Locale.US)), ttfFilename);
}
}
catch (FontFormatException ex)
{
LOG.debug ("FontFormatException: " + ex.getMessage());
}
}
{code}
It uses java font parsing only, because one can assume that the standard fonts
will be parsed properly by java. And we need only the name. Instead of 10
minutes, loadFonts() now takes a few seconds. And there's more:
{code}
font.getFontName(Locale.US)
{code}
returns the font name without "MT" or "PSMT" or whatever, so I was able to
remove the mappings I mentioned myself a few days ago from WindowsFontDirFinder
(I kept the last one which you introduced, although I don't have an example to
test). "US" is important because without that parameter, I get "fett" instead
of "bold" in the font name.
> 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)