[gs-commits] ghostpdl branch, master, updated. ghostpdl-9.02-1028-g701b769

Ken Sharp ken at ghostscript.com
Thu Mar 22 15:09:01 UTC 2012


The ghostpdl branch, master has been updated
       via  701b769786f6e2b036df8427c17c6a5dc294a672 (commit)
      from  b68ee69570803001a959721209fff6a2e4430f84 (commit)

----------------------------------------------------------------------
commit 701b769786f6e2b036df8427c17c6a5dc294a672
Author: Ken Sharp <ken.sharp at artifex.com>
Date:   Thu Mar 22 15:08:43 2012 +0000

    pdfwrite - update CIDSet emission for PDF/A-2 compatibility
    
    This completes the work for creation of PDF/A-2 files. Note that Acrobat X
    preflight complains about the CIDSet we include in PDF/A-2 files. However I
    believe that the current code is correct, and that the Acrobat preflight is
    incorrect. The PDF-Tools validator is completely happy with our CIDSet.
    
    I'm unable to fathom what it is the Acrobat preflight tool wants. The old
    PDF/A-1 CIDSet is flagged as invalid, as is every premutation of values I
    can think of.
    
    In the absence of any example file to look at, or a definitive resource on
    the subject, I'm comitting this and concluding the development. I will of
    course be happy to work on the CIDSet emission if someone can bring more
    information.
    
    No differences expected PDF/A is not tested by the cluster.

diff --git a/gs/base/gdevpdtd.c b/gs/base/gdevpdtd.c
index 9ebe7d6..560018d 100644
--- a/gs/base/gdevpdtd.c
+++ b/gs/base/gdevpdtd.c
@@ -755,16 +755,25 @@ pdf_convert_truetype_font_descriptor(gx_device_pdf *pdev, pdf_font_resource_t *p
     if (pdfont->u.cidfont.CIDToGIDMap == NULL)
         return_error(gs_error_VMerror);
     memset(pdfont->u.cidfont.CIDToGIDMap, 0, length_CIDToGIDMap);
-    for (ch = FirstChar; ch <= LastChar; ch++) {
-        if (Encoding[ch].glyph != GS_NO_GLYPH) {
+    if(pdev->PDFA == 1) {
+        for (ch = FirstChar; ch <= LastChar; ch++) {
+            if (Encoding[ch].glyph != GS_NO_GLYPH) {
+                gs_glyph glyph = pfont->procs.encode_char(pfont, ch, GLYPH_SPACE_INDEX);
+
+                pbfont->CIDSet[ch / 8] |= 0x80 >> (ch % 8);
+                pdfont->u.cidfont.CIDToGIDMap[ch] = glyph - GS_MIN_GLYPH_INDEX;
+            }
+        }
+        /* Set the CIDSet bit for CID 0 (the /.notdef) which must always be present */
+        pbfont->CIDSet[0] |= 0x80;
+    } else {
+        for (ch = 0; ch <= pbfont->num_glyphs; ch++) {
             gs_glyph glyph = pfont->procs.encode_char(pfont, ch, GLYPH_SPACE_INDEX);
 
             pbfont->CIDSet[ch / 8] |= 0x80 >> (ch % 8);
             pdfont->u.cidfont.CIDToGIDMap[ch] = glyph - GS_MIN_GLYPH_INDEX;
         }
     }
-    /* Set the CIDSet bit for CID 0 (the /.notdef) which must always be present */
-    pbfont->CIDSet[0] |= 0x80;
     pbfont->CIDSetLength = length_CIDSet;
     pdfont->u.cidfont.CIDToGIDMapLength = length_CIDToGIDMap / sizeof(ushort);
     pdfont->u.cidfont.Widths2 = NULL;


Summary of changes:
 gs/base/gdevpdtd.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)



More information about the gs-commits mailing list