pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jahew...@apache.org
Subject svn commit: r1656102 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFontType0.java
Date Fri, 30 Jan 2015 19:51:46 GMT
Author: jahewson
Date: Fri Jan 30 19:51:46 2015
New Revision: 1656102

URL: http://svn.apache.org/r1656102
Log:
PDFBOX-2642: Log an error when a CIDFontType0 embeds a Type1 font

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFontType0.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFontType0.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFontType0.java?rev=1656102&r1=1656101&r2=1656102&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFontType0.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFontType0.java Fri
Jan 30 19:51:46 2015
@@ -48,7 +48,6 @@ public class PDCIDFontType0 extends PDCI
 
     private final CFFCIDFont cidFont;  // Top DICT that uses CIDFont operators
     private final CFFType1Font t1Font; // Top DICT that does not use CIDFont operators
-    // todo: PDFBOX-2642 contains a Type1 PFB font in a CIDFont, but we can't handle that
currently
     
     private final Map<Integer, Float> glyphHeights = new HashMap<Integer, Float>();
     private final boolean isEmbedded;
@@ -80,7 +79,11 @@ public class PDCIDFontType0 extends PDCI
 
         boolean fontIsDamaged = false;
         CFFFont cffFont = null;
-        if (bytes != null) {
+        if (bytes != null && bytes.length > 0 && (bytes[0] & 0xff)
== '%') {
+            // todo: PDFBOX-2642 contains a Type1 PFB font in a CIDFont, but we can't handle
it yet
+            LOG.error("Unsupported: Type1 font instead of CFF in " + fd.getFontName());
+            fontIsDamaged = true;
+        } else if (bytes != null) {
             CFFParser cffParser = new CFFParser();
             try
             {
@@ -142,7 +145,10 @@ public class PDCIDFontType0 extends PDCI
                 {
                     // this error often indicates that the user needs to install the Adobe
Reader
                     // Asian and Extended Language Pack
-                    LOG.error("Missing CID-keyed font " + getBaseFont());
+                    if (!fontIsDamaged)
+                    {
+                        LOG.error("Missing CID-keyed font " + getBaseFont());
+                    }
                 }
                 else
                 {



Mime
View raw message