[gs-commits] ghostpdl branch, pdfi, updated. jbig2dec-0.14-2337-gee3133a

[email protected] (Nancy Durgin) Tue, 22 Oct 2019 16:54:39 +0000 (UTC)
Newsgroups gmane.comp.printing.ghostscript.cvs
Message-ID <[email protected]>
The ghostpdl branch, pdfi has been updated
       via  ee3133a3f2eb684177431c98cc811e183e9651c9 (commit)
      from  d34dcfca0b4a384ab03c822df109369a27a707da (commit)

----------------------------------------------------------------------
commit ee3133a3f2eb684177431c98cc811e183e9651c9
Author: Nancy Durgin <[email protected]>
Date:   Thu Oct 17 14:58:42 2019 -0700

    Make the 'i' setflat operator match gs code
    
    Spec says the value is 1-100, with 0 meaning
    use the device default.
    
    But the gs implementation does a "min(val, 1)" in the ps code
    and gs_gstate_setflat will pin it to >= 0.2, so basically we get
    a range of 0.2-1.0 instead.
    
    This now matches what Adobe, gs, and mupdf do.  See Bug 555657.

diff --git a/pdf/pdf_gstate.c b/pdf/pdf_gstate.c
index 51d0567..32116da 100644
--- a/pdf/pdf_gstate.c
+++ b/pdf/pdf_gstate.c
@@ -393,6 +393,14 @@ int pdfi_setflat(pdf_context *ctx)
                 return 0;
         }
     }
+    /* PDF spec says the value is 1-100, with 0 meaning "use the default"
+     * But gs code (and now our code) forces the value to be <= 1
+     * This matches what Adobe and evince seem to do (see Bug 555657).
+     * Apparently mupdf implements this as a no-op, which is essentially
+     * what this does now.
+     */
+    if (d1 > 1.0)
+        d1 = 1.0;
     code = gs_setflat(ctx->pgs, d1);
     pdfi_pop(ctx, 1);
     if(code < 0 && ctx->pdfstoponerror)


Summary of changes:
 pdf/pdf_gstate.c | 8 ++++++++
 1 file changed, 8 insertions(+)