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 2016/10/08 09:43:17 UTC

svn commit: r1763882 - /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFontType2Embedder.java

Author: lehmi
Date: Sat Oct  8 09:43:17 2016
New Revision: 1763882

URL: http://svn.apache.org/viewvc?rev=1763882&view=rev
Log:
PDFBOX-3300: reverted some of the former optimizations as the widths are needed in getStringWidth so that those have to be created at beginning as be overwritten when subsetting the font at the end

Modified:
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFontType2Embedder.java

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFontType2Embedder.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFontType2Embedder.java?rev=1763882&r1=1763881&r2=1763882&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFontType2Embedder.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFontType2Embedder.java Sat Oct  8 09:43:17 2016
@@ -73,7 +73,7 @@ final class PDCIDFontType2Embedder exten
         dict.setItem(COSName.ENCODING, COSName.IDENTITY_H); // CID = GID
 
         // descendant CIDFont
-        cidFont = createCIDFont(embedSubset);
+        cidFont = createCIDFont();
         COSArray descendantFonts = new COSArray();
         descendantFonts.add(cidFont);
         dict.setItem(COSName.DESCENDANT_FONTS, descendantFonts);
@@ -108,7 +108,6 @@ final class PDCIDFontType2Embedder exten
         buildWidths(cidToGid);
         buildCIDToGIDMap(cidToGid);
         buildCIDSet(cidToGid);
-        buildToUnicodeCMap(gidToCid);
     }
 
     private void buildToUnicodeCMap(Map<Integer, Integer> newGIDToOldCID) throws IOException
@@ -177,7 +176,7 @@ final class PDCIDFontType2Embedder exten
         return info;
     }
 
-    private COSDictionary createCIDFont(boolean embedSubset) throws IOException
+    private COSDictionary createCIDFont() throws IOException
     {
         COSDictionary cidFont = new COSDictionary();
 
@@ -196,12 +195,7 @@ final class PDCIDFontType2Embedder exten
         cidFont.setItem(COSName.FONT_DESC, fontDescriptor.getCOSObject());
 
         // W - widths
-        if (!embedSubset)
-        {
-            // subsetted fonts have a reduced amount of widths
-            // and will be created after subsetting
-            buildWidths(cidFont);
-        }
+        buildWidths(cidFont);
 
         // CIDToGIDMap
         cidFont.setItem(COSName.CID_TO_GID_MAP, COSName.IDENTITY);