You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Andreas Lehmkühler (JIRA)" <ji...@apache.org> on 2013/07/16 09:30:48 UTC
[jira] [Commented] (PDFBOX-1661) Fix font subtype automatically
[ https://issues.apache.org/jira/browse/PDFBOX-1661?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13709570#comment-13709570 ]
Andreas Lehmkühler commented on PDFBOX-1661:
--------------------------------------------
Thanks for the report and the patch. But I won't apply it as neither PDFBox nor TCPDF are doing anything wrong.
A Type0 font is a composite font wrapping a descendant font which is most likely a Type1 or a TrueType font. If you have a look at the constructor of the PDType0Font you'll see that a descendant font is created too. In your case this should by an instance of the class PDCIDFontType0Font, which holds the instance of the PDType1CFont class which represents a CFF font (some sort of a Type 1 font)
I'm afraid everything is o.k. here.
> Fix font subtype automatically
> ------------------------------
>
> Key: PDFBOX-1661
> URL: https://issues.apache.org/jira/browse/PDFBOX-1661
> Project: PDFBox
> Issue Type: Improvement
> Components: PDModel
> 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
>
> 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 is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira