pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From le...@apache.org
Subject svn commit: r1553174 - in /pdfbox/trunk: fontbox/src/main/java/org/apache/fontbox/afm/ pdfbox/src/main/java/org/apache/pdfbox/encoding/ pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/
Date Mon, 23 Dec 2013 18:45:46 GMT
Author: lehmi
Date: Mon Dec 23 18:45:46 2013
New Revision: 1553174

URL: http://svn.apache.org/r1553174
Log:
PDFBOX-1808: don't cache values which are used one time only

Modified:
    pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/afm/AFMParser.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/encoding/AFMEncoding.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1AfmPfbFont.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1CFont.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1Font.java

Modified: pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/afm/AFMParser.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/afm/AFMParser.java?rev=1553174&r1=1553173&r2=1553174&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/afm/AFMParser.java (original)
+++ pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/afm/AFMParser.java Mon Dec 23 18:45:46
2013
@@ -29,7 +29,7 @@ import org.apache.fontbox.util.BoundingB
  * @see <A href="http://partners.adobe.com/asn/developer/type/">AFM Documentation</A>
  *
  * @author Ben Litchfield (ben@benlitchfield.com)
- * @version $Revision: 1.1 $
+ * 
  */
 public class AFMParser
 {
@@ -287,7 +287,6 @@ public class AFMParser
 
 
     private InputStream input;
-    private FontMetric result;
 
     /**
      * A method to test parsing of all AFM documents in the resources
@@ -329,21 +328,13 @@ public class AFMParser
      * This will parse the AFM document.  This will close the Input stream
      * when the parsing is finished.
      *
+     * @return the parsed FontMetric
+     * 
      * @throws IOException If there is an IO error reading the document.
      */
-    public void parse() throws IOException
+    public FontMetric parse() throws IOException
     {
-        result = parseFontMetric();
-    }
-
-    /**
-     * This will get the result of the parsing.
-     *
-     * @return The parsed java object.
-     */
-    public FontMetric getResult()
-    {
-        return result;
+    	return parseFontMetric();
     }
 
     /**

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/encoding/AFMEncoding.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/encoding/AFMEncoding.java?rev=1553174&r1=1553173&r2=1553174&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/encoding/AFMEncoding.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/encoding/AFMEncoding.java Mon Dec
23 18:45:46 2013
@@ -27,11 +27,10 @@ import org.apache.pdfbox.cos.COSBase;
  * This will handle the encoding from an AFM font.
  *
  * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>
- * @version $Revision: 1.8 $
+ * 
  */
 public class AFMEncoding extends Encoding
 {
-    private FontMetric metric = null;
 
     /**
      * Constructor.
@@ -40,8 +39,7 @@ public class AFMEncoding extends Encodin
      */
     public AFMEncoding( FontMetric fontInfo )
     {
-        metric = fontInfo;
-        Iterator<CharMetric> characters = metric.getCharMetrics().iterator();
+        Iterator<CharMetric> characters = fontInfo.getCharMetrics().iterator();
         while( characters.hasNext() )
         {
             CharMetric nextMetric = (CharMetric)characters.next();

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1AfmPfbFont.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1AfmPfbFont.java?rev=1553174&r1=1553173&r2=1553174&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1AfmPfbFont.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1AfmPfbFont.java
Mon Dec 23 18:45:46 2013
@@ -43,7 +43,7 @@ import org.apache.pdfbox.pdmodel.common.
  * This is implementation of the Type1 Font with a afm and a pfb file.
  * 
  * @author <a href="mailto:m.g.n@gmx.de">Michael Niedermair</a>
- * @version $Revision: 1.5 $
+ * 
  */
 public class PDType1AfmPfbFont extends PDType1Font
 {
@@ -117,8 +117,7 @@ public class PDType1AfmPfbFont extends P
 
         // read the afm
         AFMParser parser = new AFMParser(afm);
-        parser.parse();
-        metric = parser.getResult();
+        metric = parser.parse();
         setFontEncoding(afmToDictionary(new AFMEncoding(metric)));
 
         // set the values

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1CFont.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1CFont.java?rev=1553174&r1=1553173&r2=1553174&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1CFont.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1CFont.java Mon
Dec 23 18:45:46 2013
@@ -420,9 +420,7 @@ public class PDType1CFont extends PDSimp
         try
         {
             AFMParser afmParser = new AFMParser(is);
-            afmParser.parse();
-
-            FontMetric result = afmParser.getResult();
+            FontMetric result = afmParser.parse();
 
             // Replace default FontBBox value with a newly computed one
             BoundingBox bounds = result.getFontBBox();

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=1553174&r1=1553173&r2=1553174&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 Mon
Dec 23 18:45:46 2013
@@ -175,8 +175,8 @@ public class PDType1Font extends PDSimpl
                 try
                 {
                     AFMParser parser = new AFMParser(afmStream);
-                    parser.parse();
-                    metrics.put(name, parser.getResult());
+                    FontMetric metric = parser.parse(); 
+                    metrics.put(name, metric);
                 }
                 finally
                 {



Mime
View raw message