pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From le...@apache.org
Subject svn commit: r1451878 - /pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/CFFParser.java
Date Sat, 02 Mar 2013 11:57:25 GMT
Author: lehmi
Date: Sat Mar  2 11:57:25 2013
New Revision: 1451878

URL: http://svn.apache.org/r1451878
Log:
PDFBOX-1464: remove unnecessary linear searches as proposed by Adrian Nistor

Modified:
    pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/CFFParser.java

Modified: pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/CFFParser.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/CFFParser.java?rev=1451878&r1=1451877&r2=1451878&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/CFFParser.java (original)
+++ pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/CFFParser.java Sat Mar  2 11:57:25
2013
@@ -865,14 +865,14 @@ public class CFFParser
         @Override
         public int getFd(int glyph)
         {
+            Map<String, byte[]> charString = owner.getCharStringsDict();
+            Set<String> keys = charString.keySet();
             // ---- search the position of the given glyph
-            for (Mapping mapping: this.owner.getMappings())
+            for (Mapping mapping: owner.getMappings())
             {
-                if (mapping.getSID() == glyph)
+                if (mapping.getSID() == glyph && charString.containsKey(mapping.getName()))
                 {
                     int index = 0;
-                    Map<String, byte[]> charString = this.owner.getCharStringsDict();
-                    Set<String> keys = charString.keySet();
                     for (String str : keys)
                     {
                         if (mapping.getName().equals(str))



Mime
View raw message