You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by le...@apache.org on 2014/05/30 18:22:37 UTC

svn commit: r1598657 - in /pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font: PDCIDFont.java PDType0Font.java PDType1AfmPfbFont.java PDType1CFont.java PDType1Font.java

Author: lehmi
Date: Fri May 30 16:22:37 2014
New Revision: 1598657

URL: http://svn.apache.org/r1598657
Log:
PDFBOX-2101: clear cached resources if necessary

Modified:
    pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFont.java
    pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType0Font.java
    pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1AfmPfbFont.java
    pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1CFont.java
    pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1Font.java

Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFont.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFont.java?rev=1598657&r1=1598656&r2=1598657&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFont.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFont.java Fri May 30 16:22:37 2014
@@ -368,4 +368,15 @@ public abstract class PDCIDFont extends 
         }
         return result;
     }
+    
+    @Override
+    public void clear()
+    {
+        super.clear();
+        if (widthCache != null)
+        {
+            widthCache.clear();
+            widthCache = null;
+        }
+    }
 }

Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType0Font.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType0Font.java?rev=1598657&r1=1598656&r2=1598657&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType0Font.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType0Font.java Fri May 30 16:22:37 2014
@@ -219,4 +219,20 @@ public class PDType0Font extends PDSimpl
     {
         return descendantFont;
     }
+    @Override
+    public void clear()
+    {
+        super.clear();
+        if (descendantFontArray != null)
+        {
+            descendantFontArray.clear();
+            descendantFontArray = null;
+        }
+        if (descendantFont != null)
+        {
+            descendantFont.clear();
+            descendantFont = null;
+        }
+        descendantFontDictionary = null;
+    }
 }

Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1AfmPfbFont.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1AfmPfbFont.java?rev=1598657&r1=1598656&r2=1598657&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1AfmPfbFont.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1AfmPfbFont.java Fri May 30 16:22:37 2014
@@ -237,4 +237,10 @@ public class PDType1AfmPfbFont extends P
         return new DictionaryEncoding(dictionary);
     }
 
+    @Override
+    public void clear()
+    {
+        super.clear();
+        metric = null;
+    }
 }

Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1CFont.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1CFont.java?rev=1598657&r1=1598656&r2=1598657&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1CFont.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1CFont.java Fri May 30 16:22:37 2014
@@ -664,5 +664,44 @@ public class PDType1CFont extends PDSimp
         }
 
     }
-
+    
+    @Override
+    public void clear()
+    {
+        super.clear();
+        cffFont = null;
+        fontMetric = null;
+        fontBBox = null;
+        if (characterToSID != null)
+        {
+            characterToSID.clear();
+            characterToSID = null;
+        }
+        if (codeToSID != null)
+        {
+            codeToSID.clear();
+            codeToSID = null;
+        }
+        if (glyphHeights != null)
+        {
+            glyphHeights.clear();
+            glyphHeights = null;
+        }
+        if (glyphWidths != null)
+        {
+            glyphWidths.clear();
+            glyphWidths = null;
+        }
+        if (sidToCharacter != null)
+        {
+            sidToCharacter.clear();
+            sidToCharacter = null;
+        }
+        if (sidToName != null)
+        {
+            sidToName.clear();
+            sidToName = null;
+        }
+    }
+    
 }

Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1Font.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1Font.java?rev=1598657&r1=1598656&r2=1598657&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1Font.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1Font.java Fri May 30 16:22:37 2014
@@ -503,4 +503,15 @@ public class PDType1Font extends PDSimpl
             return super.getFontMatrix();
         }
     }
+
+    @Override
+    public void clear()
+    {
+        super.clear();
+        if (type1CFont != null)
+        {
+            type1CFont.clear();
+            type1CFont = null;
+        }
+    }
 }