You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2017/09/04 17:39:14 UTC

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

Author: tilman
Date: Mon Sep  4 17:39:14 2017
New Revision: 1807262

URL: http://svn.apache.org/viewvc?rev=1807262&view=rev
Log:
PDFBOX-3920: add all CIDs to CIDSet, not just those that have a GID (importanrt for PDF/A-2)

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=1807262&r1=1807261&r2=1807262&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 Mon Sep  4 17:39:14 2017
@@ -240,12 +240,14 @@ final class PDCIDFontType2Embedder exten
     }
 
     /**
-     * Builds the CIDSet entry, required by PDF/A. This lists all CIDs in the font.
+     * Builds the CIDSet entry, required by PDF/A. This lists all CIDs in the font, including those
+     * that don't have a GID.
      */
     private void buildCIDSet(Map<Integer, Integer> cidToGid) throws IOException
     {
-        byte[] bytes = new byte[Collections.max(cidToGid.keySet()) / 8 + 1];
-        for (int cid : cidToGid.keySet())
+        int cidMax = Collections.max(cidToGid.keySet());
+        byte[] bytes = new byte[cidMax / 8 + 1];
+        for (int cid = 0; cid <= cidMax; cid++)
         {
             int mask = 1 << 7 - cid % 8;
             bytes[cid / 8] |= mask;