pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jahew...@apache.org
Subject svn commit: r1646052 - in /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font: PDCIDFontType2.java PDType0Font.java
Date Tue, 16 Dec 2014 19:23:24 GMT
Author: jahewson
Date: Tue Dec 16 19:23:23 2014
New Revision: 1646052

URL: http://svn.apache.org/r1646052
Log:
PDFBOX-2560: Nonsymbolic flag is not used in Type0 fonts

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

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFontType2.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFontType2.java?rev=1646052&r1=1646051&r2=1646052&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFontType2.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFontType2.java Tue
Dec 16 19:23:23 2014
@@ -35,8 +35,6 @@ import org.apache.pdfbox.cos.COSBase;
 import org.apache.pdfbox.cos.COSDictionary;
 import org.apache.pdfbox.cos.COSName;
 import org.apache.pdfbox.cos.COSStream;
-import org.apache.pdfbox.pdmodel.font.encoding.GlyphList;
-import org.apache.pdfbox.pdmodel.font.encoding.StandardEncoding;
 import org.apache.pdfbox.io.IOUtils;
 import org.apache.pdfbox.pdmodel.common.PDStream;
 import org.apache.pdfbox.util.Matrix;
@@ -252,35 +250,10 @@ public class PDCIDFontType2 extends PDCI
                     return cid2gid[cid];
                 }
             }
-            else if (!parent.isSymbolic())
-            {
-                // this nonsymbolic behaviour isn't well documented, test with PDFBOX-1422
-
-                // if the font descriptor's Nonsymbolic flag is set, the conforming reader
shall
-                // create a table that maps from character codes to glyph names
-                String name = null;
-
-                // If the Encoding entry is one of the names MacRomanEncoding, WinAnsiEncoding,
-                // or a dictionary, then the table is initialized as normal
-                // todo: Encoding is not allowed though, right? So this never happens?
-                /*if (getFontEncoding() != null)
-                {
-                    name = getFontEncoding().getName(cid);
-                }*/
-
-                // Any undefined entries in the table shall be filled using StandardEncoding
-                if (name == null)
-                {
-                    name = StandardEncoding.INSTANCE.getName(code);
-                }
-
-                // map to a Unicode value using the Adobe Glyph List
-                unicode = GlyphList.getAdobeGlyphList().toUnicode(name);
-            }
             else
             {
-                int cid = codeToCID(code);
-                unicode = parent.toUnicode(cid); // code = CID for TTF
+                // test with PDFBOX-1422 and PDFBOX-2560
+                unicode = parent.toUnicode(code);
             }
 
             if (unicode == null)

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType0Font.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType0Font.java?rev=1646052&r1=1646051&r2=1646052&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType0Font.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType0Font.java Tue
Dec 16 19:23:23 2014
@@ -31,8 +31,6 @@ import org.apache.pdfbox.cos.COSBase;
 import org.apache.pdfbox.cos.COSDictionary;
 import org.apache.pdfbox.cos.COSName;
 import org.apache.pdfbox.pdmodel.PDDocument;
-import org.apache.pdfbox.pdmodel.font.encoding.GlyphList;
-import org.apache.pdfbox.pdmodel.font.encoding.StandardEncoding;
 import org.apache.pdfbox.util.Matrix;
 import org.apache.pdfbox.util.Vector;
 
@@ -95,12 +93,6 @@ public class PDType0Font extends PDFont
         readEncoding();
         fetchCMapUCS2();
         descendantFont = PDFontFactory.createDescendantFont(descendantFontDictionary, this);
-
-        // warn if there may be text extraction issues
-        if (!isSymbolic())
-        {
-            LOG.warn("Nonsymbolic Type 0 font: " + getName());
-        }
     }
 
     /**
@@ -316,14 +308,7 @@ public class PDType0Font extends PDFont
             return unicode;
         }
 
-        if (!isSymbolic())
-        {
-            // this nonsymbolic behaviour isn't well documented, test with PDFBOX-1422,
-            // also see PDCIDFontType2#cidToGID()
-            String name = StandardEncoding.INSTANCE.getName(code);
-            return GlyphList.getAdobeGlyphList().toUnicode(name);
-        }
-        else if (isCMapPredefined && cMapUCS2 != null)
+        if (isCMapPredefined && cMapUCS2 != null)
         {
             // if the font is composite and uses a predefined cmap (excluding Identity-H/V)
then
             // or if its decendant font uses Adobe-GB1/CNS1/Japan1/Korea1



Mime
View raw message