pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jahew...@apache.org
Subject svn commit: r1652922 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/edit/PDPageContentStream.java
Date Mon, 19 Jan 2015 06:42:06 GMT
Author: jahewson
Date: Mon Jan 19 06:42:06 2015
New Revision: 1652922

URL: http://svn.apache.org/r1652922
Log:
PDFBOX-2605: Subset each font only once

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/edit/PDPageContentStream.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/edit/PDPageContentStream.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/edit/PDPageContentStream.java?rev=1652922&r1=1652921&r2=1652922&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/edit/PDPageContentStream.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/edit/PDPageContentStream.java
Mon Jan 19 06:42:06 2015
@@ -80,7 +80,7 @@ public final class PDPageContentStream i
 
     private boolean inTextMode = false;
     private final Stack<PDFont> fontStack = new Stack<PDFont>();
-    private final List<PDFont> fontsToSubset = new ArrayList<PDFont>();
+    private final Set<PDFont> fontsToSubset = new HashSet<PDFont>();
     private final Map<PDFont, Set<Integer>> subsetCodePoints = new HashMap<PDFont,
Set<Integer>>();
 
     private Stack<PDColorSpace> nonStrokingColorSpaceStack = new Stack<PDColorSpace>();
@@ -287,8 +287,11 @@ public final class PDPageContentStream i
 
         if (embedSubset)
         {
-            fontsToSubset.add(font);
-            subsetCodePoints.put(font, new HashSet<Integer>());
+            if (!fontsToSubset.contains(font))
+            {
+                fontsToSubset.add(font);
+                subsetCodePoints.put(font, new HashSet<Integer>());
+            }
         }
         else
         {



Mime
View raw message