pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jahew...@apache.org
Subject svn commit: r1622913 - in /pdfbox/trunk/pdfbox/src: main/java/org/apache/pdfbox/encoding/ main/java/org/apache/pdfbox/pdmodel/font/ test/java/org/apache/pdfbox/pdmodel/font/
Date Sat, 06 Sep 2014 19:18:48 GMT
Author: jahewson
Date: Sat Sep  6 19:18:48 2014
New Revision: 1622913

URL: http://svn.apache.org/r1622913
Log:
PDFBOX-2317: Removed invalid test clause

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/encoding/GlyphList.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDSimpleFont.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1Font.java
    pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/font/TestTTFParser.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/encoding/GlyphList.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/encoding/GlyphList.java?rev=1622913&r1=1622912&r2=1622913&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/encoding/GlyphList.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/encoding/GlyphList.java Sat Sep  6
19:18:48 2014
@@ -67,13 +67,6 @@ public class GlyphList
             // PDFBOX-1946 ignore and continue
         }
 
-        // todo: this is not desirable in many cases, should be done much later, e.g. TextStripper
-        DEFAULT.nameToUnicode.put("fi", "fi");
-        DEFAULT.nameToUnicode.put("fl", "fl");
-        DEFAULT.nameToUnicode.put("ffi", "ffi");
-        DEFAULT.nameToUnicode.put("ff", "ff");
-        DEFAULT.nameToUnicode.put("pi", "pi");
-
         // Zapf Dingbats has its own glyph list
         ZAPF_DINGBATS = new GlyphList();
         ZAPF_DINGBATS.loadGlyphs("org/apache/pdfbox/resources/zapf_dingbats.properties");
@@ -108,17 +101,23 @@ public class GlyphList
                     int characterCode = Integer.parseInt(tokenizer.nextToken(), 16);
                     value.append((char) characterCode);
                 }
+                String unicode = value.toString();
+
                 if (nameToUnicode.containsKey(glyphName))
                 {
-                    LOG.warn("duplicate value for " + glyphName + " -> " + value + " "
+
+                    LOG.warn("duplicate value for " + glyphName + " -> " + unicode + "
" +
                              nameToUnicode.get(glyphName));
                 }
                 else
                 {
-                    nameToUnicode.put(glyphName, value.toString());
+                    nameToUnicode.put(glyphName, unicode);
                 }
+
                 // reverse mapping
-                unicodeToName.put(value.toString(), glyphName);
+                if (!unicodeToName.containsKey(unicode))
+                {
+                    unicodeToName.put(unicode, glyphName);
+                }
             }
         }
         catch (IOException io)

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDSimpleFont.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDSimpleFont.java?rev=1622913&r1=1622912&r2=1622913&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDSimpleFont.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDSimpleFont.java Sat
Sep  6 19:18:48 2014
@@ -237,7 +237,7 @@ public abstract class PDSimpleFont exten
         if (encoding != null)
         {
             name = encoding.getName(code);
-            unicode = glyphList.toUnicode(name); // todo: tie a final GlyphList instance
to each PDFont in the constructor.
+            unicode = glyphList.toUnicode(name);
             if (unicode != null)
             {
                 return unicode;

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1Font.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1Font.java?rev=1622913&r1=1622912&r2=1622913&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1Font.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1Font.java Sat
Sep  6 19:18:48 2014
@@ -116,18 +116,6 @@ public class PDType1Font extends PDSimpl
         ALT_NAMES.put("ellipsis", "elipsis"); // misspelled in ArialMT
     }
 
-    // unicode names for ligatures, needed to undo mapping in org.apache.pdfbox.Encoding
-    private static final Map<String, String> LIGATURE_UNI_NAMES = new HashMap<String,
String>();
-    static
-    {
-        LIGATURE_UNI_NAMES.put("ff", "uniFB00");
-        LIGATURE_UNI_NAMES.put("fi", "uniFB01");
-        LIGATURE_UNI_NAMES.put("fl", "uniFB02");
-        LIGATURE_UNI_NAMES.put("ffi", "uniFB03");
-        LIGATURE_UNI_NAMES.put("ffl", "uniFB04");
-        LIGATURE_UNI_NAMES.put("pi", "uni03C0");
-    }
-
     // todo: replace with enum? or getters?
     public static final PDType1Font TIMES_ROMAN = new PDType1Font("Times-Roman");
     public static final PDType1Font TIMES_BOLD = new PDType1Font("Times-Bold");
@@ -434,13 +422,6 @@ public class PDType1Font extends PDSimpl
                             return uniName;
                         }
                     }
-                    else if (unicodes.length() > 1)
-                    {
-                        if (LIGATURE_UNI_NAMES.containsKey(name))
-                        {
-                           return LIGATURE_UNI_NAMES.get(name);
-                        }
-                    }
                 }
             }
         }

Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/font/TestTTFParser.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/font/TestTTFParser.java?rev=1622913&r1=1622912&r2=1622913&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/font/TestTTFParser.java (original)
+++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/font/TestTTFParser.java Sat
Sep  6 19:18:48 2014
@@ -120,10 +120,6 @@ public class TestTTFParser
                 {
                     Assert.assertEquals(0x03c0, charCode);
                 }
-                else
-                {
-                    Assert.assertEquals(GlyphList.DEFAULT.unicodeToName((char) charCode),
name);
-                }
             }
         }
     }



Mime
View raw message