[
https://issues.apache.org/jira/browse/PDFBOX-62?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13975552#comment-13975552
]
Tilman Hausherr commented on PDFBOX-62:
---------------------------------------
>From the specification:
====
"A TrueType font dictionary can contain the same entries as a Type 1 font
dictionary (Table 5.8 on page 413)"
FirstChar, LastChar, Widths and FontDescriptor are "Required except for the
standard 14 fonts".
"These fonts, or their font metrics and suitable substitution fonts, must be
available to the consumer application. The character sets and encodings for
these fonts are listed in Appendix D. The Adobe font metrics (AFM) files for
the standard 14 fonts are available from the ASN Web site (see the
Bibliography). For more information on font metrics, see Adobe Technical Note
#5004, Adobe Font Metrics File Format Specification."
====
By stretching this somewhat, I'd say that TT fonts named like standard 14 fonts
are also to be handled like standard 14 fonts, when the metrics are missing.
Therefore I implemented PDTrueTypeFont.getAFM() based on the code found in
PDType1Font and now both files (the one from here and the one from PDFBOX-2006)
render.
I am attaching a diff and two properly rendered files for review. I won't
commit it right now, I'd like to get feedback first; if I do commit it, I would
create a separate class to move the (now double) AFM code there.
> Incorrect (zero) character widths returned in some docs
> -------------------------------------------------------
>
> Key: PDFBOX-62
> URL: https://issues.apache.org/jira/browse/PDFBOX-62
> Project: PDFBox
> Issue Type: Bug
> Components: Rendering, Text extraction
> Attachments: 5542.pdf, PDTrueTypeFont.diff,
> pdfbox-2006-zerowidth.pdf-1.png, pdfbox-62-zerowidth.pdf-1.png
>
>
> [imported from SourceForge]
> http://sourceforge.net/tracker/index.php?group_id=78314&atid=552832&aid=1216674
> Originally submitted by tamirhassan on 2005-06-07 13:42.
> For certain PDF documents (such as the one attached)
> the character/string widths (as obtained e.g. by the
> PDFont.getStringWidth method) are not returned
> correctly, i.e. they appear to be correct for punctuation
> characters but are zero for alphanumeric characters.
> It seems as if these alphanumeric characters are NOT
> within PDFont.firstChar and PDFont.lastChar in the
> Type 1 font. The method therefore attempts to obtain
> the font widths from the AFM (font metric) file, but fails
> (silently) with a 'resource is null' logline message.
> (Note that this problem doesn't seem to occur with Type
> 1 fonts in other documents.)
> A more detailed discussion regarding this issue can be
> found in this link:
> http://sourceforge.net/forum/forum.php?
> thread_id=1260349&forum_id=267205
> Thanks in advance for any help that can be obtained,
> Tam
--
This message was sent by Atlassian JIRA
(v6.2#6252)