[
https://issues.apache.org/jira/browse/PDFBOX-1661?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13896068#comment-13896068
]
John Hewson commented on PDFBOX-1661:
-------------------------------------
There is indeed a problem reading the Type 0 fonts in this file. I tried 2.0.0
trunk and got the following, along with bad rendering:
{code}
Feb 09, 2014 1:57:14 PM org.apache.pdfbox.pdfviewer.PageDrawer createAWTFont
INFO: Unsupported type of font org.apache.pdfbox.pdmodel.font.PDType0Font
Feb 09, 2014 1:57:15 PM org.apache.pdfbox.pdfviewer.PageDrawer createAWTFont
INFO: Using font Helvetica-Light instead
Feb 09, 2014 1:57:15 PM org.apache.pdfbox.pdfviewer.PageDrawer createAWTFont
INFO: Unsupported type of font org.apache.pdfbox.pdmodel.font.PDType0Font
Feb 09, 2014 1:57:15 PM org.apache.pdfbox.pdfviewer.PageDrawer createAWTFont
INFO: Using font Helvetica-Light instead
Feb 09, 2014 1:57:15 PM org.apache.pdfbox.util.PDFImageWriter writeImage
INFO: Writing: page-081.jpg
{code}
> Fix font subtype automatically
> ------------------------------
>
> Key: PDFBOX-1661
> URL: https://issues.apache.org/jira/browse/PDFBOX-1661
> Project: PDFBox
> Issue Type: Improvement
> Components: PDModel, Rendering
> Affects Versions: 1.8.1
> Environment: PDFBox: PDFBox 1.8.1
> Reader: Adobe Reader 11.0.0
> Generator: TCPDF 4.5.041
> PDF Content:
> <</Type /Font
> /BaseFont /AdobeSongStd-Light,Bold-UniGB-UTF16-H
> /Subtype /Type0
> /Encoding /UniGB-UTF16-H
> /DescendantFonts [27 0 R]
> Reporter: Raymond Wu
> Labels: encoding, font
> Attachments: adobe-screenshot.png, page-08.pdf, pdf-screenshot.png
>
>
> Subtype is parsed as "Type0" by PDFBox, but parsed as "Type1" by Adobe Reader.
> This is not a bug of PDFBox.
> The reason is TCPDF 4.5.041 generate font AdobeSongStd-Light with bad subtype
> "Type0".
> It should be "Type1".
> I have test the following codes and they work.
> File: org/apache/pdfbox/pdmodel/font/PDFontFactory.java
> Method: public static PDFont createFont( COSDictionary dic ) throws
> IOException
> Original:
> else if( subType.equals( COSName.TYPE0 ) )
> {
> retval = new PDType0Font( dic );
> }
> Fixed:
> else if( subType.equals( COSName.TYPE0 ) )
> {
> COSName encoding = (COSName)dic.getDictionaryObject(COSName.ENCODING);
> retval = (encoding!=null) ? new PDType1Font( dic ) : new PDType0Font( dic
> );
> }
> With such patch PDFBox will act like Adobe Reader.
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)