summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Deutschmann <whissi@gentoo.org>2020-09-10 18:10:49 +0200
committerThomas Deutschmann <whissi@gentoo.org>2020-09-11 20:06:36 +0200
commitacfc02c1747065fe450c7cfeb6f1844b62335f08 (patch)
tree5887806a2e6b99bbb0255e013a9028810e230a7f /Resource
parentImport Ghostscript 9.52 (diff)
downloadghostscript-gpl-patches-acfc02c1747065fe450c7cfeb6f1844b62335f08.tar.gz
ghostscript-gpl-patches-acfc02c1747065fe450c7cfeb6f1844b62335f08.tar.bz2
ghostscript-gpl-patches-acfc02c1747065fe450c7cfeb6f1844b62335f08.zip
Import Ghostscript 9.53ghostscript-9.53
Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
Diffstat (limited to 'Resource')
-rw-r--r--Resource/CIDFont/ArtifexBulletbin2659 -> 2659 bytes
-rw-r--r--Resource/ColorSpace/DefaultCMYK2
-rw-r--r--Resource/ColorSpace/DefaultGray2
-rw-r--r--Resource/ColorSpace/DefaultRGB2
-rw-r--r--Resource/ColorSpace/TrivialCMYK2
-rw-r--r--Resource/ColorSpace/sGray2
-rw-r--r--Resource/ColorSpace/sRGB2
-rw-r--r--Resource/Decoding/FCO_Dingbats2
-rw-r--r--Resource/Decoding/FCO_Symbol2
-rw-r--r--Resource/Decoding/FCO_Unicode2
-rw-r--r--Resource/Decoding/FCO_Wingdings2
-rw-r--r--Resource/Decoding/Latin12
-rw-r--r--Resource/Decoding/StandardEncoding2
-rw-r--r--Resource/Decoding/Unicode2
-rw-r--r--Resource/Encoding/CEEncoding2
-rw-r--r--Resource/Encoding/ExpertEncoding2
-rw-r--r--Resource/Encoding/ExpertSubsetEncoding2
-rw-r--r--Resource/Encoding/NotDefEncoding2
-rw-r--r--Resource/Encoding/Wingdings2
-rw-r--r--Resource/Font/NimbusSans-BoldItalicbin112011 -> 123308 bytes
-rw-r--r--Resource/Font/NimbusSans-Italicbin109766 -> 120927 bytes
-rw-r--r--Resource/Init/FCOfontmap-PCLPS22
-rw-r--r--Resource/Init/Fontmap.GS2
-rw-r--r--Resource/Init/gs_agl.ps2
-rw-r--r--Resource/Init/gs_btokn.ps159
-rw-r--r--Resource/Init/gs_cff.ps2
-rw-r--r--Resource/Init/gs_cidcm.ps2
-rw-r--r--Resource/Init/gs_ciddc.ps2
-rw-r--r--Resource/Init/gs_cidfm.ps2
-rw-r--r--Resource/Init/gs_cidfn.ps2
-rw-r--r--Resource/Init/gs_cidtt.ps2
-rw-r--r--Resource/Init/gs_cmap.ps2
-rw-r--r--Resource/Init/gs_cspace.ps2
-rw-r--r--Resource/Init/gs_dbt_e.ps2
-rw-r--r--Resource/Init/gs_diskn.ps2
-rw-r--r--Resource/Init/gs_dps1.ps2
-rw-r--r--Resource/Init/gs_dps2.ps2
-rw-r--r--Resource/Init/gs_dscp.ps2
-rw-r--r--Resource/Init/gs_epsf.ps67
-rw-r--r--Resource/Init/gs_fapi.ps2
-rw-r--r--Resource/Init/gs_fntem.ps2
-rw-r--r--Resource/Init/gs_fonts.ps2
-rw-r--r--Resource/Init/gs_frsd.ps2
-rw-r--r--Resource/Init/gs_icc.ps2
-rw-r--r--Resource/Init/gs_il1_e.ps2
-rw-r--r--Resource/Init/gs_init.ps10
-rw-r--r--Resource/Init/gs_lev2.ps2
-rw-r--r--Resource/Init/gs_ll3.ps2
-rw-r--r--Resource/Init/gs_mex_e.ps2
-rw-r--r--Resource/Init/gs_mgl_e.ps2
-rw-r--r--Resource/Init/gs_mro_e.ps2
-rw-r--r--Resource/Init/gs_pdf_e.ps2
-rw-r--r--Resource/Init/gs_pdfwr.ps2
-rw-r--r--Resource/Init/gs_res.ps2
-rw-r--r--Resource/Init/gs_resmp.ps2
-rw-r--r--Resource/Init/gs_setpd.ps2
-rw-r--r--Resource/Init/gs_statd.ps2
-rw-r--r--Resource/Init/gs_std_e.ps2
-rw-r--r--Resource/Init/gs_sym_e.ps2
-rw-r--r--Resource/Init/gs_trap.ps2
-rw-r--r--Resource/Init/gs_ttf.ps13
-rw-r--r--Resource/Init/gs_typ32.ps2
-rw-r--r--Resource/Init/gs_typ42.ps2
-rw-r--r--Resource/Init/gs_type1.ps2
-rw-r--r--Resource/Init/gs_wan_e.ps2
-rw-r--r--Resource/Init/pdf_base.ps17
-rw-r--r--Resource/Init/pdf_draw.ps132
-rw-r--r--Resource/Init/pdf_font.ps24
-rw-r--r--Resource/Init/pdf_main.ps236
-rw-r--r--Resource/Init/pdf_ops.ps153
-rw-r--r--Resource/Init/pdf_rbld.ps4
-rw-r--r--Resource/Init/pdf_sec.ps73
-rw-r--r--Resource/SubstCID/CNS1-WMode2
-rw-r--r--Resource/SubstCID/GB1-WMode2
-rw-r--r--Resource/SubstCID/Japan1-WMode2
-rw-r--r--Resource/SubstCID/Korea1-WMode2
76 files changed, 617 insertions, 395 deletions
diff --git a/Resource/CIDFont/ArtifexBullet b/Resource/CIDFont/ArtifexBullet
index ce579f06..18c98f16 100644
--- a/Resource/CIDFont/ArtifexBullet
+++ b/Resource/CIDFont/ArtifexBullet
Binary files differ
diff --git a/Resource/ColorSpace/DefaultCMYK b/Resource/ColorSpace/DefaultCMYK
index 44d6daba..cba9326c 100644
--- a/Resource/ColorSpace/DefaultCMYK
+++ b/Resource/ColorSpace/DefaultCMYK
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/ColorSpace/DefaultGray b/Resource/ColorSpace/DefaultGray
index d7b74f84..95c9ef41 100644
--- a/Resource/ColorSpace/DefaultGray
+++ b/Resource/ColorSpace/DefaultGray
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/ColorSpace/DefaultRGB b/Resource/ColorSpace/DefaultRGB
index 6e8808f8..53ddf3ea 100644
--- a/Resource/ColorSpace/DefaultRGB
+++ b/Resource/ColorSpace/DefaultRGB
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/ColorSpace/TrivialCMYK b/Resource/ColorSpace/TrivialCMYK
index 16794983..b3dec8b8 100644
--- a/Resource/ColorSpace/TrivialCMYK
+++ b/Resource/ColorSpace/TrivialCMYK
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/ColorSpace/sGray b/Resource/ColorSpace/sGray
index b8217357..a0997d0b 100644
--- a/Resource/ColorSpace/sGray
+++ b/Resource/ColorSpace/sGray
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/ColorSpace/sRGB b/Resource/ColorSpace/sRGB
index 95c6be73..16f3ecfa 100644
--- a/Resource/ColorSpace/sRGB
+++ b/Resource/ColorSpace/sRGB
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Decoding/FCO_Dingbats b/Resource/Decoding/FCO_Dingbats
index 412b6bc0..8da04509 100644
--- a/Resource/Decoding/FCO_Dingbats
+++ b/Resource/Decoding/FCO_Dingbats
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Decoding/FCO_Symbol b/Resource/Decoding/FCO_Symbol
index d12c81ed..c9411a03 100644
--- a/Resource/Decoding/FCO_Symbol
+++ b/Resource/Decoding/FCO_Symbol
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Decoding/FCO_Unicode b/Resource/Decoding/FCO_Unicode
index 5dd38cc2..4cdf58a5 100644
--- a/Resource/Decoding/FCO_Unicode
+++ b/Resource/Decoding/FCO_Unicode
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Decoding/FCO_Wingdings b/Resource/Decoding/FCO_Wingdings
index e3b7acb4..a31cefd8 100644
--- a/Resource/Decoding/FCO_Wingdings
+++ b/Resource/Decoding/FCO_Wingdings
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Decoding/Latin1 b/Resource/Decoding/Latin1
index eec0fbfd..8960ab4f 100644
--- a/Resource/Decoding/Latin1
+++ b/Resource/Decoding/Latin1
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Decoding/StandardEncoding b/Resource/Decoding/StandardEncoding
index c7775a25..f2b27a56 100644
--- a/Resource/Decoding/StandardEncoding
+++ b/Resource/Decoding/StandardEncoding
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Decoding/Unicode b/Resource/Decoding/Unicode
index 0e2e185f..7ecd3069 100644
--- a/Resource/Decoding/Unicode
+++ b/Resource/Decoding/Unicode
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Encoding/CEEncoding b/Resource/Encoding/CEEncoding
index b5d2cb8b..bd3f8abb 100644
--- a/Resource/Encoding/CEEncoding
+++ b/Resource/Encoding/CEEncoding
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Encoding/ExpertEncoding b/Resource/Encoding/ExpertEncoding
index ed6484db..fe879bda 100644
--- a/Resource/Encoding/ExpertEncoding
+++ b/Resource/Encoding/ExpertEncoding
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Encoding/ExpertSubsetEncoding b/Resource/Encoding/ExpertSubsetEncoding
index 836f79e1..6f789bc5 100644
--- a/Resource/Encoding/ExpertSubsetEncoding
+++ b/Resource/Encoding/ExpertSubsetEncoding
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Encoding/NotDefEncoding b/Resource/Encoding/NotDefEncoding
index aeb0de47..a5e0b8d3 100644
--- a/Resource/Encoding/NotDefEncoding
+++ b/Resource/Encoding/NotDefEncoding
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Encoding/Wingdings b/Resource/Encoding/Wingdings
index accbb48e..4a245571 100644
--- a/Resource/Encoding/Wingdings
+++ b/Resource/Encoding/Wingdings
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Font/NimbusSans-BoldItalic b/Resource/Font/NimbusSans-BoldItalic
index a031ac9c..dc1dad0a 100644
--- a/Resource/Font/NimbusSans-BoldItalic
+++ b/Resource/Font/NimbusSans-BoldItalic
Binary files differ
diff --git a/Resource/Font/NimbusSans-Italic b/Resource/Font/NimbusSans-Italic
index 989210f6..2fcec067 100644
--- a/Resource/Font/NimbusSans-Italic
+++ b/Resource/Font/NimbusSans-Italic
Binary files differ
diff --git a/Resource/Init/FCOfontmap-PCLPS2 b/Resource/Init/FCOfontmap-PCLPS2
index c54e61d1..91bd8f7f 100644
--- a/Resource/Init/FCOfontmap-PCLPS2
+++ b/Resource/Init/FCOfontmap-PCLPS2
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Init/Fontmap.GS b/Resource/Init/Fontmap.GS
index 9f6b6297..5f47b6b4 100644
--- a/Resource/Init/Fontmap.GS
+++ b/Resource/Init/Fontmap.GS
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Init/gs_agl.ps b/Resource/Init/gs_agl.ps
index c30b631f..9c1c52d2 100644
--- a/Resource/Init/gs_agl.ps
+++ b/Resource/Init/gs_agl.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Init/gs_btokn.ps b/Resource/Init/gs_btokn.ps
index b9add383..410b8419 100644
--- a/Resource/Init/gs_btokn.ps
+++ b/Resource/Init/gs_btokn.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
@@ -148,46 +148,36 @@ mark
% worry about interrupts or callbacks when writing to the output file.
% Define procedures for accumulating the space required to represent
-% an object in binary form. The procedures for composite objects (arrays
-% and dictionaries) leave different results on the stack:
-% <#refs> <#chars> <simple_obj> -proc- <#refs> <#chars>
-% <#refs> <#chars> <array|dict> -proc- <array|dict> <#refs> <#chars>
-% This is required so that .writeobjects can also accumulate the actual
-% list of composite objects to write in the binary object sequence.
+% an object in binary form.
+% <#refs> <#chars> <obj> -proc- <#refs'> <#chars'>
/cntdict mark
/integertype /pop load
/realtype 1 index
/marktype 1 index
/nulltype 1 index
/booleantype 1 index
- /nametype { length add } bind
+ /nametype { length add } .bind
/stringtype 1 index
- /arraytype //null
- /dicttype //null
+ /arraytype 0 % replaced below
+ /dicttype 0 % replaced below
.dicttomark def
-/.cntobj { % <<arguments and results as for procedures in cntdict>>
+/.cntobj {
dup type //cntdict exch get exec
} .bind def
cntdict /arraytype {
- dup dup length 5 -1 roll add 4 2 roll { //.cntobj exec } forall
-} bind put
+ dup length % #refs #chars array len
+ 4 -1 roll add % #chars array #refs+len
+ dup 65536 gt {
+ /writeobject .systemvar /limitcheck signalerror
+ } if
+ 3 1 roll % #refs+len #chars array
+ //.cntobj forall
+} .bind put % replace arraytype in cntdict
+
cntdict /dicttype {
- WRITEDICTS {
- dup dup length 2 mul 5 -1 roll add 4 2 roll {
- % We have to use .execn here, rather than simply rolling the
- % value under the top elements, because key might involve arrays
- % or dictionaries.
- cvlit {//.cntobj exec} exch 2 .execn //.cntobj exec
- } forall
- } {
- /writeobject .systemvar /typecheck signalerror
- } ifelse
+ /writeobject .systemvar /typecheck signalerror
} bind put
-/w2dict mark
- /nametype { 2 copy .writecvs pop } bind
- /stringtype 1 index
-.dicttomark def
/.bosheader { % <top_length> <total_length> <string8> .bosheader
% <string4|8>
@@ -211,70 +201,74 @@ cntdict /dicttype {
} .bind def
/.writeobjects { % <file> <tag> <array> .writeobjects -
- mark exch
-
- % Count the space required for refs and strings.
+ % Apply the tag early and forget about it.
+ (12345678) dup 1 5 -1 roll % file array (...) (...) 1 tag
+ put exch % file (.t.) array
- dup length 0 3 -1 roll
- % Stack: file tag -mark- #refs #chars array
- dup 4 1 roll { //.cntobj exec } forall
+ % Calculate the space required for refs and strings.
+ % Reject excessively large graphs or graphs with loops.
+ 0 0 % file (.t.) array #refs #chars
+ 2 index //.cntobj exec % file (.t.) array #refs #chars
- % Write the header.
+ % Write the header.
+ 1 index 8 mul add % file (.t.) array #refs #refs*8+#chars
+ 2 index length exch (12345678) % file (.t.) array #refs len(array) #refs*8+#chars (...)
+ //.bosheader exec % file (.t.) array #refs (...)
+ 4 index exch writestring % file (.t.) array #refs
- % Stack: file tag -mark- array1 ... (array|dict)N #refs #chars
- counttomark 3 add -2 roll 4 1 roll
- % Stack: -mark- array1 ... (array|dict)N tag #refs #chars file
- dup counttomark 1 sub index length
- 4 index 3 bitshift 4 index add
- (xxxxxxxx) //.bosheader exec writestring
-
- % Write the objects per se.
-
- 3 1 roll pop
- counttomark 1 sub index length 3 bitshift exch
- 3 bitshift
- % Stack: -mark- array1 ... (array|dict)N tag file ref# char#
- counttomark 4 sub {
- counttomark -1 roll dup 6 1 roll
- % Stack: ... objN tag file ref# char# objN
- dup type /dicttype eq { % can't be first object
- { 5 1 roll (x\000xxxxxx) .bosobject
- 3 index exch writestring
- 4 -1 roll (x\000xxxxxx) .bosobject
- 3 index exch writestring
+ % Traverse an array tree in width-first order and place all the
+ % arrays that are found on the operand stack. Acyclic graphs are
+ % expanded to trees. The top parameter K indicates the number
+ % of arrays on a given depth level. At the root level, K is equal to 1.
+ mark 2 index 1 % file (.t.) array #refs -mark- array K
+ { dup 0 le { pop exit } if
+ dup {
+ dup index {
+ dup type /arraytype eq {
+ exch 1 add
+ } {
+ pop
+ } ifelse
} forall
- } {
- { (x\000xxxxxx) .bosobject
- dup 1 6 index put
- 3 index exch writestring
- 4 -1 roll pop 0 4 1 roll % clear tag
- } forall
- } ifelse
- } repeat
+ 1 sub
+ } repeat
+ } loop % file (.t.) array #refs -mark- array1 ... arrayN
+ counttomark 5 add -4 roll % -mark- array1 ... arrayN file (.t.) array #refs
- % Write the strings and names.
+ % Write the content of the root array
+ 8 mul % -mark- array1 ... arrayN file (.t.) array #refs*8
+ exch dup length 8 mul % -mark- array1 ... arrayN file (.t.) #refs*8 array len(array)*8
+ 3 1 roll % -mark- array1 ... arrayN file (.t.) len(array)*8 #refs*8 array
+ { 3 index % -mark- array1 ... arrayN file (.t.) len(array)*8 #refs*8 obj (.t.)
+ .bosobject % -mark- array1 ... arrayN file (.t.) len(array)*8 #refs*8 (.t.)
+ 4 index exch writestring % -mark- array1 ... arrayN file (.t.) len(array)*8 #refs*8
+ } forall
+ 3 -1 roll pop % -mark- array1 ... arrayN file len(array)*8 #refs*8
- pop pop exch pop
- % Stack: -mark- array1 ... array|dictN file
- counttomark 1 sub {
- counttomark -1 roll {
- % The counting pass ensured that the keys and values
- % of any dictionary must be writable objects.
- % Hence, we are processing a dictionary iff
- % the next-to-top stack element is not a file.
- 1 index type /filetype ne {
- exch 2 index exch dup type //w2dict exch .knownget
- { exec } { pop } ifelse pop
- } if
- dup type //w2dict exch .knownget { exec } { pop } ifelse
+ % Write the remaining arrays
+ counttomark 2 sub -1 3 {
+ index { % ... file #refs #str obj
+ (1\000345678) .bosobject % ... file #refs #str (...)
+ 3 index exch writestring % ... file #refs #str
} forall
- } repeat
+ } for
+ pop pop % -mark- array1 ... arrayN file
- % Clean up.
-
- % Stack: -mark- file
- pop pop
+ % Write strings and names.
+ counttomark 1 sub -1 1 {
+ index {
+ dup type /nametype eq {
+ .namestring
+ } if
+ dup type /stringtype eq {
+ 1 index exch writestring
+ } {
+ pop
+ } ifelse
+ } forall
+ } for
+ cleartomark % Clean up
} .bind def
/.writeobject {
@@ -324,7 +318,6 @@ cntdict /dicttype {
} bind def
currentdict /cntdict .undef
-currentdict /w2dict .undef
% End of level2dict
diff --git a/Resource/Init/gs_cff.ps b/Resource/Init/gs_cff.ps
index 99d214a6..6cfa1ec1 100644
--- a/Resource/Init/gs_cff.ps
+++ b/Resource/Init/gs_cff.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Init/gs_cidcm.ps b/Resource/Init/gs_cidcm.ps
index 5ec2fa34..503ec867 100644
--- a/Resource/Init/gs_cidcm.ps
+++ b/Resource/Init/gs_cidcm.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Init/gs_ciddc.ps b/Resource/Init/gs_ciddc.ps
index f0fb5d81..6cdba039 100644
--- a/Resource/Init/gs_ciddc.ps
+++ b/Resource/Init/gs_ciddc.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Init/gs_cidfm.ps b/Resource/Init/gs_cidfm.ps
index e123bfc1..f22e45d6 100644
--- a/Resource/Init/gs_cidfm.ps
+++ b/Resource/Init/gs_cidfm.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Init/gs_cidfn.ps b/Resource/Init/gs_cidfn.ps
index ca2a5a7c..20af1c87 100644
--- a/Resource/Init/gs_cidfn.ps
+++ b/Resource/Init/gs_cidfn.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Init/gs_cidtt.ps b/Resource/Init/gs_cidtt.ps
index 12ade5e5..e045cfdd 100644
--- a/Resource/Init/gs_cidtt.ps
+++ b/Resource/Init/gs_cidtt.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Init/gs_cmap.ps b/Resource/Init/gs_cmap.ps
index 2733ea3b..3252089a 100644
--- a/Resource/Init/gs_cmap.ps
+++ b/Resource/Init/gs_cmap.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Init/gs_cspace.ps b/Resource/Init/gs_cspace.ps
index ff5955a9..8aaf6b74 100644
--- a/Resource/Init/gs_cspace.ps
+++ b/Resource/Init/gs_cspace.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Init/gs_dbt_e.ps b/Resource/Init/gs_dbt_e.ps
index 01e3c824..2aca0c68 100644
--- a/Resource/Init/gs_dbt_e.ps
+++ b/Resource/Init/gs_dbt_e.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Init/gs_diskn.ps b/Resource/Init/gs_diskn.ps
index d3402782..85ff07e3 100644
--- a/Resource/Init/gs_diskn.ps
+++ b/Resource/Init/gs_diskn.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Init/gs_dps1.ps b/Resource/Init/gs_dps1.ps
index 7cf29b46..14cc5d6d 100644
--- a/Resource/Init/gs_dps1.ps
+++ b/Resource/Init/gs_dps1.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Init/gs_dps2.ps b/Resource/Init/gs_dps2.ps
index 619984f2..2dfaaa49 100644
--- a/Resource/Init/gs_dps2.ps
+++ b/Resource/Init/gs_dps2.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Init/gs_dscp.ps b/Resource/Init/gs_dscp.ps
index dad0ec30..15764b17 100644
--- a/Resource/Init/gs_dscp.ps
+++ b/Resource/Init/gs_dscp.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Init/gs_epsf.ps b/Resource/Init/gs_epsf.ps
index b28f742e..cf020751 100644
--- a/Resource/Init/gs_epsf.ps
+++ b/Resource/Init/gs_epsf.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
@@ -59,41 +59,44 @@
% Rescale, translate and rotate to fit the BoundingBox on the page
/EPSBoundingBoxFitPage { % llx lly urx ury --
EPSDEBUG { (gs_epsf.ps: Rescaling EPS to fit page\n) print flush } if
- clippath pathbbox newpath
- % translate to new origin at lower left of clippath
- 3 index 3 index translate
- % Figure out if rotate is needed.
+ clippath pathbbox newpath % ellx elly eurx eury pllx plly purx pury
- 1 index 4 index sub 1 index 4 index sub eq not {
- 1 index 4 index sub 1 index 4 index sub gt % bbox page-clipbox page-is-landscape
- 6 index 10 index sub 6 index 10 index sub gt % bbox page-clipbox page-is-landscape bbox-is-landscape
- xor
- }{
- //false
- }ifelse
- dup 10 1 roll % need-rotate compute need-rotate.
-
- % if we are rotating the contents, we need to also rotate the
- % bounding box of the content!
- {
- 8 -4 roll
- exch 4 -2 roll exch 4 2 roll
+ % Convert box corners to coordinates of the center and box sizes
+ 2 { % loop doing the page coordinates, the the EPS bbox coordinates
+ 3 -1 roll exch % ... llx urx lly ury
+ 2 { % loop doing Y then X coordnates
+ 2 copy exch sub % ... llx urx lly ury ury-lly
+ 3 1 roll % ... llx urx ury-lly lly ury
+ add 2 div % ... llx urx ury-lly (lly+ury)/2
+ 4 2 roll % ... ury-lly (lly+ury)/2 llx urx
+ } repeat
8 4 roll
+ } repeat
+ % edx, edy = EPS dimension X and Y, ecx, ecy = EPS Center X and Y.
+ % pdx and pcx, etc, are for the Page values.
+ % edx ecx edy ecy pdx pcx pdy pcy
+
+ % Move the origin to the center of the printable area.
+ 3 -1 roll exch % edx ecx edy ecy pdx pdy pcx pcy
+ translate % edx ecx edy ecy pdx pdy
+
+ % Find orientation of the best fit. Square pages or files don't rotate.
+ 2 copy sub % edx ecx edy ecy pdx pdy pdx-pdy
+ 6 index 5 index sub mul % edx ecx edy ecy pdx pdy (pdx-pdy)*(edx-edy)
+ 0 lt {
+ 90 rotate
+ exch
} if
- % stack: rotate-needed bbox page-clipbox
- % calculate scale to fit smaller of width or height
- exch 4 -1 roll sub 3 1 roll exch sub
- 4 2 roll 5 index 5 index 4 2 roll
- exch 4 -1 roll sub 3 1 roll exch sub
- 4 2 roll
- exch 4 -1 roll div 3 1 roll exch div
- 1 index 1 index lt {pop}{exch pop} ifelse
- dup scale
- % translate to EPS -llx,-lly
- exch neg exch neg translate
- % Finally perform the rotate if needed.
- { clippath pathbbox pop 0 translate 90 rotate pop pop } if
+ % Scale to fit in the most restricting direction.
+ 4 -1 roll div % edx ecx ecy pdx pdy/edy
+ exch 5 -1 roll div % ecx ecy pdy/edy pdx/edx
+ //.min exec
+ dup scale % ecx ecy
+
+ % Center the document
+ neg exch neg exch translate
+
} bind executeonly odef
/EPSBoundingBoxProcess { % (llx lly urx ury) state --
diff --git a/Resource/Init/gs_fapi.ps b/Resource/Init/gs_fapi.ps
index 1ca3dff7..0b493c6a 100644
--- a/Resource/Init/gs_fapi.ps
+++ b/Resource/Init/gs_fapi.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Init/gs_fntem.ps b/Resource/Init/gs_fntem.ps
index 66432e11..d5ac0bfa 100644
--- a/Resource/Init/gs_fntem.ps
+++ b/Resource/Init/gs_fntem.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Init/gs_fonts.ps b/Resource/Init/gs_fonts.ps
index 204e2832..3f4f4af8 100644
--- a/Resource/Init/gs_fonts.ps
+++ b/Resource/Init/gs_fonts.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Init/gs_frsd.ps b/Resource/Init/gs_frsd.ps
index c4ed1cb0..74c1dd27 100644
--- a/Resource/Init/gs_frsd.ps
+++ b/Resource/Init/gs_frsd.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Init/gs_icc.ps b/Resource/Init/gs_icc.ps
index 6a4e88a0..fac0cb25 100644
--- a/Resource/Init/gs_icc.ps
+++ b/Resource/Init/gs_icc.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Init/gs_il1_e.ps b/Resource/Init/gs_il1_e.ps
index 3de6ab5c..f8cfff04 100644
--- a/Resource/Init/gs_il1_e.ps
+++ b/Resource/Init/gs_il1_e.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Init/gs_init.ps b/Resource/Init/gs_init.ps
index 05d01c21..849e24ef 100644
--- a/Resource/Init/gs_init.ps
+++ b/Resource/Init/gs_init.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
@@ -34,7 +34,7 @@
% Interpreter library version number
% NOTE: the interpreter code requires that the first non-comment token
% in this file be an integer, and that it match the compiled-in version!
-952
+9530
% Check the interpreter revision.
dup revision ne
@@ -276,9 +276,9 @@ userdict /=string 256 string put
(\)\n) revisiondate 10 mod revisiondate 10 idiv 10 mod (-)
revisiondate 100 idiv 10 mod revisiondate 1000 idiv 10 mod (-)
revisiondate 10000 idiv ( \()
- revision 10 mod
- revision 100 mod 10 idiv (.)
- revision 100 idiv ( )
+ revision 10 mod (.)
+ revision 1000 mod 10 idiv (.)
+ revision 1000 idiv ( )
product
counttomark
{ (%stdout) (w) file exch 0 .writecvp
diff --git a/Resource/Init/gs_lev2.ps b/Resource/Init/gs_lev2.ps
index 8c41aba0..fefa732b 100644
--- a/Resource/Init/gs_lev2.ps
+++ b/Resource/Init/gs_lev2.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Init/gs_ll3.ps b/Resource/Init/gs_ll3.ps
index 6caa93f8..f6d98482 100644
--- a/Resource/Init/gs_ll3.ps
+++ b/Resource/Init/gs_ll3.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Init/gs_mex_e.ps b/Resource/Init/gs_mex_e.ps
index 7b28360f..dda0675c 100644
--- a/Resource/Init/gs_mex_e.ps
+++ b/Resource/Init/gs_mex_e.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Init/gs_mgl_e.ps b/Resource/Init/gs_mgl_e.ps
index 7c97efb9..e02729b1 100644
--- a/Resource/Init/gs_mgl_e.ps
+++ b/Resource/Init/gs_mgl_e.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Init/gs_mro_e.ps b/Resource/Init/gs_mro_e.ps
index f3f15430..7d0e3b7c 100644
--- a/Resource/Init/gs_mro_e.ps
+++ b/Resource/Init/gs_mro_e.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Init/gs_pdf_e.ps b/Resource/Init/gs_pdf_e.ps
index 382542ad..172cd72c 100644
--- a/Resource/Init/gs_pdf_e.ps
+++ b/Resource/Init/gs_pdf_e.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Init/gs_pdfwr.ps b/Resource/Init/gs_pdfwr.ps
index ed691b9d..a53b8c3f 100644
--- a/Resource/Init/gs_pdfwr.ps
+++ b/Resource/Init/gs_pdfwr.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Init/gs_res.ps b/Resource/Init/gs_res.ps
index 5559e6a9..18f63a30 100644
--- a/Resource/Init/gs_res.ps
+++ b/Resource/Init/gs_res.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Init/gs_resmp.ps b/Resource/Init/gs_resmp.ps
index ba17df60..5ba4f43e 100644
--- a/Resource/Init/gs_resmp.ps
+++ b/Resource/Init/gs_resmp.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Init/gs_setpd.ps b/Resource/Init/gs_setpd.ps
index 0733af0f..51b26899 100644
--- a/Resource/Init/gs_setpd.ps
+++ b/Resource/Init/gs_setpd.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Init/gs_statd.ps b/Resource/Init/gs_statd.ps
index 3ea50eee..7b85ef0f 100644
--- a/Resource/Init/gs_statd.ps
+++ b/Resource/Init/gs_statd.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Init/gs_std_e.ps b/Resource/Init/gs_std_e.ps
index f4ea79e3..4bfa6c5b 100644
--- a/Resource/Init/gs_std_e.ps
+++ b/Resource/Init/gs_std_e.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Init/gs_sym_e.ps b/Resource/Init/gs_sym_e.ps
index b9abc86f..fb92a299 100644
--- a/Resource/Init/gs_sym_e.ps
+++ b/Resource/Init/gs_sym_e.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Init/gs_trap.ps b/Resource/Init/gs_trap.ps
index 58c5888a..e4d6cafe 100644
--- a/Resource/Init/gs_trap.ps
+++ b/Resource/Init/gs_trap.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Init/gs_ttf.ps b/Resource/Init/gs_ttf.ps
index 6be8fe99..394cba28 100644
--- a/Resource/Init/gs_ttf.ps
+++ b/Resource/Init/gs_ttf.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
@@ -1657,7 +1657,13 @@ currentdict /.pickcmap_with_no_xlatmap .undef
/CharStrings currentdict end
} .bind def
-% - .pdfcharkeys /CharStrings <charstrings> /Encoding <encoding>
+% If we're using a 1,0 cmap table, we need to store the table for the heuristic
+% to know whether to image or elide GID 0. See zfapi.c ps_get_glyphname_or_cid().
+% For other cmap types, we don't. Since this just pushes key/value pairs onto the
+% stack for a later dicttomark op, it doesn't matter that different branches can push
+% different numbers of objects.
+%
+% - .pdfcharkeys [/TT_cmap cmapdict] /CharStrings <charstrings> /Encoding <encoding>
/.pdfcharkeys {
% The following algorithms are per the PDF 1.7 Reference.
TTFDEBUG { (.pdfcharkeys beg) = } if
@@ -1736,12 +1742,13 @@ currentdict /.pickcmap_with_no_xlatmap .undef
} ifelse
} {
<00010000> //.findcmap exec {
+ /TT_cmap 1 index cmapdict 3 -1 roll
TTFDEBUG { (Using cmap 1.0 for non-symbolic.) = } if
prebuilt_encoding //null ne {
prebuilt_encoding .invert_encoding exch .romanmacdict //.pdfmapchars exec
prebuilt_encoding
} {
- 0 dict exch
+ 0 dict exch .romanmacdict //.pdfmapchars exec
/MacRomanEncodingForTrueType .findencoding
} ifelse
/Encoding exch
diff --git a/Resource/Init/gs_typ32.ps b/Resource/Init/gs_typ32.ps
index 9799a0be..2d5fc814 100644
--- a/Resource/Init/gs_typ32.ps
+++ b/Resource/Init/gs_typ32.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Init/gs_typ42.ps b/Resource/Init/gs_typ42.ps
index ba5074ce..654a268c 100644
--- a/Resource/Init/gs_typ42.ps
+++ b/Resource/Init/gs_typ42.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Init/gs_type1.ps b/Resource/Init/gs_type1.ps
index a039ccee..18488ebe 100644
--- a/Resource/Init/gs_type1.ps
+++ b/Resource/Init/gs_type1.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Init/gs_wan_e.ps b/Resource/Init/gs_wan_e.ps
index 406c7fae..5d3673cc 100644
--- a/Resource/Init/gs_wan_e.ps
+++ b/Resource/Init/gs_wan_e.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/Init/pdf_base.ps b/Resource/Init/pdf_base.ps
index 618e5e51..2cc18270 100644
--- a/Resource/Init/pdf_base.ps
+++ b/Resource/Init/pdf_base.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
@@ -288,9 +288,11 @@ currentdict /num-chars-dict .undef
% Execute a file, like .pdfrun, for a marking context.
% This temporarily rebinds LocalResources and DefaultQstate.
/.pdfruncontext { % <resdict> <file> <opdict> .pdfruncontext -
- /.pdfrun load LocalResources DefaultQstate
- /LocalResources 7 -1 roll
- dup /ParentResources LocalResources put % save the parent LocalResources
+ /.pdfrun load LocalResources DefaultQstate % res file op .pdfrun Loc Qst
+ /LocalResources 7 -1 roll % file op .pdfrun Loc Qst /Loc res
+ dup 4 index ne { % Ensure Loc != res to avoid self-referencing /ParentResources
+ dup /ParentResources 5 index put % save the parent LocalResources
+ } if
store % store new LocalResources
/DefaultQstate qstate store
3 .execn
@@ -487,7 +489,12 @@ currentdict /token_nofail_dict .undef
} if
oforce % but dereference {1 0 R}
dup type dup /arraytype eq exch /packedarraytype eq or {
- [ exch 2 index <<>> copy exch { safe_recursive exch } forall pop]
+ [ exch {
+ counttomark 1 add index <<>> copy % create a copy for the recursion
+ exch safe_recursive exch
+ pop % pop the dictionary created for this level
+ } forall
+ ]
} {
dup type /dicttype eq {
<< exch 2 index <<>> copy exch { 3 -1 roll exch safe_recursive 3 -1 roll oforce 3 1 roll exch } forall pop>>
diff --git a/Resource/Init/pdf_draw.ps b/Resource/Init/pdf_draw.ps
index 1deb0526..a93a526c 100644
--- a/Resource/Init/pdf_draw.ps
+++ b/Resource/Init/pdf_draw.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
@@ -749,7 +749,6 @@ def
/GroupGState .knownget { setgstate } if
newpath //null SMask
- 1 .setopacityalpha 1 .setshapealpha
1 CA 1 ca
/Compatible .setblendmode
% Execute the body of the Form, similar to DoForm.
@@ -874,7 +873,15 @@ currentdict /csncompdict undef
dup dup 1 oget
mark exch { oforce } forall .dicttomark
dup dup //true resolvestream
- /ReusableStreamDecode filter /DataSource exch put
+ {
+ /ReusableStreamDecode filter
+ } stopped
+ {
+ pop null
+% ( **** Error: Failed to read ICC profile for an ICCBased colour space.\n) pdfformaterror
+% ( Falling back to a colour space determined by the /N value.\n) pdfformaterror
+ }if
+ /DataSource exch put
dup /.hash 0 put % placeholder for use by seticc icc_profile_cache key
% Check that the number of components (/N) defined in the ICCBased
% dictionry matches the actual profile. Bug #696120
@@ -1470,7 +1477,7 @@ drawopdict begin
/sh {
OFFlevels length 0 eq {
- setfillstate resolvesh
+ setsmaskstate resolvesh
//sh_save 0 save put
PDFusingtransparency {
gsave
@@ -2284,7 +2291,6 @@ currentdict /last-ditch-bpc-csp undef
PDFfile fileposition exch
gsave //nodict begin
//null .setSMask
- 1 .setopacityalpha 1 .setshapealpha
1 CA 1 ca
/Compatible .setblendmode
DoImage
@@ -2303,11 +2309,10 @@ currentdict /last-ditch-bpc-csp undef
currentdict /SMask get /Matte known {/CS currentdict /ColorSpace get dup pdfopdict /cs get exec } if
>> 0 0 1 1
.begintransparencygroup
- .currentstrokeconstantalpha .currentfillconstantalpha .currentshapealpha .currentopacityalpha 5 -1 roll
+ .currentstrokeconstantalpha .currentfillconstantalpha 3 -1 roll
1 .setfillconstantalpha 1 .setstrokeconstantalpha
- 1 .setopacityalpha 1 .setshapealpha
doimage
- .setopacityalpha .setshapealpha .setfillconstantalpha .setstrokeconstantalpha
+ .setfillconstantalpha .setstrokeconstantalpha
.endtransparencygroup
% tell the compositor we're done with the SMask.
% Note that any SMask in the ExtGState should be reapplied
@@ -2320,10 +2325,10 @@ currentdict /last-ditch-bpc-csp undef
% the image doesn't have an SMask, but the ExtGState does, force a group.
<< /Subtype /Group /Isolated //true >> 0 0 1 1
.begintransparencygroup
- .currentstrokeconstantalpha .currentfillconstantalpha .currentshapealpha .currentopacityalpha 5 -1 roll
- 1 .setopacityalpha 1 .setshapealpha
+ .currentstrokeconstantalpha .currentfillconstantalpha 3 -1 roll
+ 1 .setfillconstantalpha 1 .setstrokeconstantalpha
doimage
- .setopacityalpha .setshapealpha .setfillconstantalpha .setstrokeconstantalpha
+ .setfillconstantalpha .setstrokeconstantalpha
.endtransparencygroup
} {
doimage
@@ -2410,8 +2415,8 @@ currentdict /last-ditch-bpc-csp undef
4 array astore grestore
/image
setup_trans
- { currentdict end setfillstate //true ValidateDecode { imagemask } }
- { ColorSpace setgcolorspace currentdict end setfillblend //false ValidateDecode { image } }
+ { currentdict end setsmaskstate //true ValidateDecode { imagemask } }
+ { ColorSpace setgcolorspace currentdict end setsmaskstate //false ValidateDecode { image } }
ifelse
PDFSTOPONERROR { exec //false } { stopped } ifelse {
dup type /dicttype eq { pop } if % Sometimes image fails to restore the stack
@@ -2446,7 +2451,7 @@ currentdict /last-ditch-bpc-csp undef
/.paintform { % <formdict> <resdict> <stream> .paintform -
1 index /FormResDict gput % For broken forms that inherit resources from the context.
- 3 -1 roll dup /Group known PDFusingtransparency and {
+ 3 -1 roll dup /Group oknown PDFusingtransparency and {
.paintgroupform
} {
pop pdfopdict .pdfruncontext
@@ -2630,7 +2635,27 @@ pdfdict
} forall
} if
- 3 index //false /resolvestream cvx
+ 3 index
+ % /Contents for the stream is not per the spec, but Acrobat handles it
+ dup /Contents knownoget
+ {
+ % We want to make it's a dictionary, and represents a stream
+ dup type /dicttype eq
+ {
+ dup /FilePosition known
+ {
+ PDFSTOPONERROR { /DoForm cvx /undefinedresource signalerror } if
+ ( **** Error: Invalid Form definition. Output may be incorrect.\n) pdfformaterror
+ exch pop
+ }
+ {pop} ifelse
+ }
+ {
+ pop
+ }
+ ifelse
+ }if
+ //false /resolvestream cvx
/.paintform cvx
] cvx /PaintProc exch put
% Adjust pdfemptycount since we have an extra dictionary on the stack
@@ -2668,6 +2693,38 @@ pdfdict
pop
/pdfemptycount exch store
+ % We've now seen Form XObjects leaving junk on the stack, so we
+ % can't assume that when we finish the form the stack will be restored
+ % nor can we assume that the junk won't include a 'mark' so we an't
+ % simply do a cleartomark. Instead clear the stack until we get back
+ % to a dictionary which contains /saved_DG. We can still get errors;
+ % if the stream removes too many objects from the stack we will end
+ % up with a stackunderflow, but there's nothing we can do about that.
+ dup type /dicttype eq not {
+ //true
+ } {
+ dup /saved_DG known {
+ //false
+ } {
+ //true
+ } ifelse
+ } ifelse
+ {
+ ( **** Error: Form stream left garbage on the stack, attempting to recover.\n) pdfformaterror
+ ( Output may be incorrect.\n) pdfformaterror
+ {
+ dup type /dicttype eq not {
+ pop
+ } {
+ dup /saved_DG known {
+ exit
+ } {
+ pop
+ } ifelse
+ } ifelse
+ } loop
+ } if
+
%% Put back pre-existing Default* ColorSpace definitions.
dup type /dicttype eq {
begin
@@ -2816,7 +2873,7 @@ drawopdict begin
( Output may be incorrect.\n) pdfformaterror
currentdict /qTextSaveMatrix get setmatrix
} if
- setfillblend
+ setsmaskstate
PDFfile fileposition exch % pos /Name
% Bug #698226, Acrobat signals an error for recursive XObjects in a PDF file
@@ -3234,7 +3291,7 @@ end
{} 2 index /S knownoget {
/D eq { 2 index /D knownoget not { {3} } if exch pop } if
} if
- 3 index /CA knownoget {.setopacityalpha} if
+ 3 index /CA knownoget {dup .setstrokeconstantalpha .setfillconstantalpha} if
3 -1 roll pop
% 2 index annotsetcolor {
0 setdash setlinewidth stroke
@@ -3244,7 +3301,7 @@ end
% If element 3 of the /Border array is 0, then don't draw the border
dup 0 ne {
exch dup length 3 gt { 3 get } { pop {} } ifelse
- 3 index /CA knownoget {.setopacityalpha} if
+ 3 index /CA knownoget {dup .setstrokeconstantalpha .setfillconstantalpha} if
% 2 index annotsetcolor {
0 setdash setlinewidth stroke
% } if
@@ -3253,7 +3310,7 @@ end
} ifelse
} ifelse
} {
- 3 index /CA knownoget {.setopacityalpha} if
+ dup /CA knownoget {dup .setstrokeconstantalpha .setfillconstantalpha} if
1 {}
% 2 index annotsetcolor {
0 setdash setlinewidth stroke
@@ -3265,7 +3322,7 @@ end
/fillborderpath { % <annot> fillborderpath -
gsave
- dup /ca knownoget {.setopacityalpha} if
+ dup /ca knownoget {dup .setstrokeconstantalpha .setfillconstantalpha} if
annotsetinteriorcolor
{fill} if
grestore
@@ -3742,14 +3799,14 @@ currentdict /set_bc_color undef
annotsetinteriorcolor
{
gsave
- dup /ca knownoget {.setopacityalpha} if
+ dup /ca knownoget {dup .setstrokeconstantalpha .setfillconstantalpha} if
dup annotrect
5 index /RD knownoget {
applyRD
} if
rectfill
grestore
- dup /CA knownoget {.setopacityalpha} if
+ dup /CA knownoget {dup .setstrokeconstantalpha .setfillconstantalpha} if
dup annotsetcolor {
drawborder
} if
@@ -3851,10 +3908,10 @@ currentdict /set_bc_color undef
{
gsave
- dup /ca knownoget {.setopacityalpha} if
+ dup /ca knownoget {dup .setstrokeconstantalpha .setfillconstantalpha} if
fill
grestore
- dup /CA knownoget {.setopacityalpha} if
+ dup /CA knownoget {dup .setstrokeconstantalpha .setfillconstantalpha} if
dup annotsetcolor {
strokeborderpath
} if
@@ -3890,7 +3947,7 @@ currentdict /set_bc_color undef
dup 1 index exch lineto
dup neg lineto
closepath
- 1 index /CA knownoget {.setopacityalpha} if
+ 1 index /CA knownoget {dup .setstrokeconstantalpha .setfillconstantalpha} if
1 index fillborderpath
grestore
3 mul
@@ -3916,7 +3973,7 @@ currentdict /set_bc_color undef
2.5 mul dup
0 moveto
0 0 3 -1 roll 0 360 arc
- 1 index /CA knownoget {.setopacityalpha} if
+ 1 index /CA knownoget {dup .setstrokeconstantalpha .setfillconstantalpha} if
1 index fillborderpath
grestore
3 mul dup
@@ -3941,7 +3998,7 @@ currentdict /set_bc_color undef
dup 0 exch lineto
0 lineto
closepath
- 1 index /CA knownoget {.setopacityalpha} if
+ 1 index /CA knownoget {dup .setstrokeconstantalpha .setfillconstantalpha} if
1 index fillborderpath
grestore
3 mul
@@ -3991,7 +4048,7 @@ currentdict /set_bc_color undef
dup 2 div sub
dup 8.4 mul neg 1 index 5.9 mul neg moveto dup 1.2 div neg 0 lineto
dup 8.4 mul neg exch 5.9 mul lineto closepath
- dup /CA knownoget {.setopacityalpha} if
+ dup /CA knownoget {dup .setstrokeconstantalpha .setfillconstantalpha} if
fillborderpath
grestore
} bind executeonly def
@@ -4050,7 +4107,7 @@ currentdict /set_bc_color undef
dup 2 div sub
dup 8.4 mul neg 1 index 5.9 mul neg moveto dup 1.2 div neg 0 lineto
dup 8.4 mul neg exch 5.9 mul lineto closepath
- dup /CA knownoget {.setopacityalpha} if
+ dup /CA knownoget {dup .setstrokeconstantalpha .setfillconstantalpha} if
fillborderpath
grestore
} bind executeonly def
@@ -4090,7 +4147,7 @@ currentdict /set_bc_color undef
3 index aload pop 4 2 roll pop pop
translate
0 0 moveto
- atan % <annot> [x1 y1 x2 y2] [LE1 LE2]
+ {atan} stopped {pop pop 0} if % <annot> [x1 y1 x2 y2] [LE1 LE2]
rotate
dup 1 get % <annot> [x1 y1 x2 y2] [LE1 LE2] LE1
dup //LineEnd_dict exch known not
@@ -4109,7 +4166,7 @@ currentdict /set_bc_color undef
3 index aload pop pop pop
translate
0 0 moveto
- atan 180 add
+ {atan} stopped {pop pop 0} if 180 add
rotate
0 get dup //LineEnd_dict exch known not {pop /None} if //LineEnd_dict exch get 3 index exch exec
grestore
@@ -4137,15 +4194,16 @@ currentdict /set_bc_color undef
} {
gsave
//startannottransparency exec
+ dup annotsetcolor pop
dup /Vertices knownoget {
1 index /LE knownoget {
gsave
1 index 0 4 getinterval aload pop
4 2 roll
2 copy translate 4 2 roll
- 3 -1 roll sub % x1 x2 dy
- 3 1 roll exch sub % dy dx
- atan
+ 3 -1 roll exch sub % x1 x2 dy
+ 3 1 roll sub % dy dx
+ {atan} stopped {pop pop 0} if
rotate
dup 0 get dup //LineEnd_dict exch known not {pop /None} if //LineEnd_dict exch get 3 index exch exec
grestore
@@ -4155,7 +4213,7 @@ currentdict /set_bc_color undef
2 copy translate
3 -1 roll sub % x1 x2 dy
3 1 roll exch sub % dy dx
- atan
+ {atan} stopped {pop pop 0} if
rotate
1 get dup //LineEnd_dict exch known not {pop /None} if //LineEnd_dict exch get 3 index exch exec
grestore
@@ -4514,11 +4572,11 @@ currentdict /set_bc_color undef
dup annotrect rectclip
dup /CA knownoget {
- .setopacityalpha
+ dup .setstrokeconstantalpha .setfillconstantalpha
} if
dup /ca knownoget {
- .setopacityalpha
+ dup .setstrokeconstantalpha .setfillconstantalpha
} if
dup /C knownoget {
diff --git a/Resource/Init/pdf_font.ps b/Resource/Init/pdf_font.ps
index 60deb64e..98a9e3d4 100644
--- a/Resource/Init/pdf_font.ps
+++ b/Resource/Init/pdf_font.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
@@ -2422,9 +2422,25 @@ currentdict /CMap_read_dict undef
} 2 bndef
<01000401> % Type 1C
- { exch pop
- 1 index /Subtype knownoget dup { pop /CIDFontType0 eq } if {
- readCIDFontType0C
+ {
+ exch pop
+
+ 1 index /Subtype knownoget {
+ dup /CIDFontType2 eq{
+ pop
+ ( **** Error: Subtype of a Type 1 CID font is not /CIDFontType0\n) pdfformaterror
+ ( Output may be incorrect.\n) pdfformaterror
+ 1 index /Subtype /CIDFontType0 put
+ readCIDFontType0C
+ }
+ {
+ /CIDFontType0 eq {
+ readCIDFontType0C
+ }
+ {
+ readType1C
+ } ifelse
+ } ifelse
} {
readType1C
} ifelse
diff --git a/Resource/Init/pdf_main.ps b/Resource/Init/pdf_main.ps
index 5cd90556..d7933700 100644
--- a/Resource/Init/pdf_main.ps
+++ b/Resource/Init/pdf_main.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
@@ -278,6 +278,16 @@ systemdict begin
} bind odef
currentdict /runpdfstring .undef
+/DisablePageHandlerDevice
+{
+ systemdict /FirstPage known
+ systemdict /LastPage known or
+ systemdict /Pagelist known or
+ {
+ <</DisablePageHandler //true>> setpagedevice
+ } if
+} bind def
+
/runpdfbegin { % <file> runpdfbegin -
userdict begin
% It turns out that the PDF interpreter uses memory more
@@ -300,6 +310,8 @@ currentdict /runpdfstring .undef
%% resources and needs this definition in place.
<</MaxOpStack -1>> setuserparams
+ //DisablePageHandlerDevice exec
+
0 setobjectformat
/Page# //null def
/Page //null def
@@ -311,8 +323,9 @@ currentdict /runpdfstring .undef
/CumulativePageCount currentpagedevice /PageCount get def
} bind executeonly def
+currentdict /DisablePageHandlerDevice undef
+
/runpdfpagerange { % - runpdfpagerange <firstpage#> <lastpage#>
-<</DisablePageHandler //true>> setpagedevice
/PortfolioPage where {
pop
PortfolioPage cvi dup pdfpagecount add % a b+1
@@ -321,8 +334,8 @@ currentdict /runpdfstring .undef
dup 3 index exch cvs pop % a b+1 /P (b+1)
store
1 sub % a b
- /FirstPage where { pop FirstPage <</DisablePageHandler //true>> setpagedevice} { 1 } ifelse
- /LastPage where { pop LastPage <</DisablePageHandler //true>> setpagedevice} {2000000000} ifelse % a b fp lp
+ /FirstPage where { pop FirstPage} { 1 } ifelse
+ /LastPage where { pop LastPage} {2000000000} ifelse % a b fp lp
2 index 2 index lt { % b < fp
1e10
} {
@@ -395,7 +408,6 @@ currentdict /runpdfstring .undef
pop
}
forall
- <</DisablePageHandler //true>> setpagedevice
/PDFPageList pdfpagecount 1 add array def
{
(,) search {
@@ -477,7 +489,6 @@ currentdict /runpdfstring .undef
1 pdfpagecount
}{
/FirstPage where {
- <</DisablePageHandler //true>> setpagedevice
pop FirstPage dup pdfpagecount gt {
(\nRequested FirstPage is greater than the number of pages in the file: ) print
pdfpagecount = flush
@@ -485,7 +496,7 @@ currentdict /runpdfstring .undef
} {
1
} ifelse
- /LastPage where {<</DisablePageHandler //true>> setpagedevice pop LastPage pdfpagecount .min } { pdfpagecount } ifelse
+ /LastPage where {pop LastPage pdfpagecount .min } { pdfpagecount } ifelse
1 index 1 index gt {
( No pages will be processed \(FirstPage > LastPage\).) = flush
} {
@@ -513,7 +524,12 @@ currentdict /runpdfstring .undef
{
dup /Page# exch store
QUIET not { (Page ) print dup //== exec flush } if
- pdfgetpage pdfshowpage
+ pdfgetpage
+ dup //null ne { pdfshowpage } {
+ ( **** Error: Page #) pdfformaterror Page# 10 string cvs pdfformaterror
+ ( not found.\n) pdfformaterror
+ /dopdfpages cvx /syntaxerror signalerror
+ } ifelse
}{
pop
}ifelse
@@ -538,6 +554,7 @@ currentdict /runpdfstring .undef
PDFTopSave restore
end % userdict
2 vmreclaim % couldn't hurt
+ <</DisablePageHandler //false>> setpagedevice
} bind executeonly def
% Copy stream to an external temporary file and
@@ -1879,7 +1896,7 @@ currentdict /xref-char-dict undef
parent_obj_get % not found -- check it's parent.
} ifelse
} {
- pop pop pop 0
+ pop pop 0
} ifelse
} bind executeonly def
@@ -2076,14 +2093,19 @@ currentdict /xref-char-dict undef
/pdffindpageref { % <int> pdffindpage <objref>
dup pdffindpage?
% Stack: index countleft noderef
- 1 index 1 ne { pop pop /pdffindpage cvx /rangecheck signalerror } if
- exch pop
- PageIndex 2 index 1 sub 65533 .min 2 index oforce put
- PageNumbers 1 index oforce 3 index dup 65534 le
- { put }
- { pop pop pop } % don't store more than 65534 pagenumbers
+ dup //null ne {
+ 1 index 1 ne { pop pop /pdffindpage cvx /rangecheck signalerror } if
+ exch pop
+ PageIndex 2 index 1 sub 65533 .min 2 index oforce put
+ PageNumbers 1 index oforce 3 index dup 65534 le
+ { put }
+ { pop pop pop } % don't store more than 65534 pagenumbers
+ ifelse
+ } {
+ exch pop % return the //null
+ }
ifelse
- exch pop
+ exch pop % pop the page number, return the object or null
} bind executeonly def
/pdffindpage { % <int> pdffindpage <pagedict>
pdffindpageref oforce
@@ -2751,7 +2773,7 @@ currentdict /PDF2PS_matrix_key undef
dup /PDFusingtransparency exch def {
% If the current device isn't CMYK, or if it is a device that (currently) supports transparency
% we don't need the special handling of Overprint transparency, so disable the checking.
- currentpagedevice dup /Colors get 4 lt
+ currentpagedevice dup /Colors get 4 lt 1 index /SimulateOverprint get not or
exch /HaveTransparency .knownget not { //false } if or
% device needs special Oveprint handling
/setup_trans exch
@@ -2900,6 +2922,7 @@ currentdict /PDF2PS_matrix_key undef
% Draw the annotations
//systemdict /ShowAnnots .knownget not { //true } if {
/Annots knownoget {
+ dup type /arraytype eq {
{
/AnnotDrawCheck exch % marker to clean up stack on error
{oforce} stopped
@@ -2936,6 +2959,12 @@ currentdict /PDF2PS_matrix_key undef
} ifelse
} ifelse
} forall
+ }
+ {
+ ( **** Error: Annotation array is not an array, ignoring it.\n) pdfformaterror
+ ( Output may be incorrect.\n) pdfformaterror
+ pop
+ } ifelse
} if
} if
//systemdict /ShowAcroForm .knownget { //true eq } { //false } ifelse {
@@ -3119,48 +3148,56 @@ currentdict /PDF2PS_matrix_key undef
/annotsusetransparency { % <page dict> annotsusetransparency <bool>
//false exch % Assume no transparency
/Annots knownoget { % Get Annots array
+ dup type /arraytype eq {
+ {
+ /AnnotTransparencyCheck exch % marker to clean up stack on error
+ {oforce} stopped
+ {
+ ( **** Error: Unable to check an annotation for use of transparency.\n) pdfformaterror
+ ( Output may be incorrect.\n) pdfformaterror
+ count -1 0 { % make sure we don't go past the top of the stack
+ pop % remove the counter
+ /AnnotTransparencyCheck eq {exit} if % remove object and check if its the marker, exit if it is
+ } for
+ }
+ {
+ exch pop % remove the 'on error' marker
+ dup //null ne {
+ dup /Subtype knownoget {
+ /Highlight eq { % Highlight annotation is always implemented
+ pop pop //true exit % as transparency.
+ } if
+ } if
+ dup /AP knownoget { % Get appearance dict for the annoation
+ /N knownogetdict { % Get the /N (i.e. normal) appearance stream
+ 4 dict exch resourceusestransparency { pop pop //true exit } if
+ } if
+ } if % If AP dict known
+ dup /BM knownoget {
+ pop pop pop //true exit
+ } if
+ dup /CA knownoget {
+ 1 le {
+ pop pop //true exit
+ } if
+ } if
+ /ca knownoget {
+ 1 le {
+ pop //true exit
+ } if
+ } if
+ } {
+ pop
+ } ifelse
+ } ifelse
+ } forall % For all annots on the page
+ }
{
- /AnnotTransparencyCheck exch % marker to clean up stack on error
- {oforce} stopped
- {
- ( **** Error: Unable to check an annotation for use of transparency.\n) pdfformaterror
- ( Output may be incorrect.\n) pdfformaterror
- count -1 0 { % make sure we don't go past the top of the stack
- pop % remove the counter
- /AnnotTransparencyCheck eq {exit} if % remove object and check if its the marker, exit if it is
- } for
- }
- {
- exch pop % remove the 'on error' marker
- dup //null ne {
- dup /Subtype knownoget {
- /Highlight eq { % Highlight annotation is always implemented
- pop pop //true exit % as transparency.
- } if
- } if
- dup /AP knownoget { % Get appearance dict for the annoation
- /N knownogetdict { % Get the /N (i.e. normal) appearance stream
- 4 dict exch resourceusestransparency { pop pop //true exit } if
- } if
- } if % If AP dict known
- dup /BM knownoget {
- //true exit
- } if
- dup /CA knownoget {
- 1 le {
- pop pop //true exit
- } if
- } if
- /ca knownoget {
- 1 le {
- pop //true exit
- } if
- } if
- } {
- pop
- } ifelse
- } ifelse
- } forall % For all annots on the page
+ ( **** Error: Annotation array is not an array, ignoring it.\n) pdfformaterror
+ ( Output may be incorrect.\n) pdfformaterror
+ pop
+ }
+ ifelse
} if
} bind executeonly def
@@ -3277,17 +3314,24 @@ currentdict /PDF2PS_matrix_key undef
% <spotcolordict> <loopdict> <annotsarray>
% annotsspotcolors <spotcolordict> <loopdict>
/annotsspotcolors {
- { oforce
- dup //null ne {
- /AP knownoget { % Get appearance dict for the annoation
- /N knownogetdict { % Get the /N (i.e. normal) appearance stream
- resourcespotcolors
- } if % If normal appearance streamknown
- } if % If AP dict known
- } {
- pop
- } ifelse
- } forall
+ dup type /arraytype eq {
+ { oforce
+ dup //null ne {
+ /AP knownoget { % Get appearance dict for the annoation
+ /N knownogetdict { % Get the /N (i.e. normal) appearance stream
+ resourcespotcolors
+ } if % If normal appearance streamknown
+ } if % If AP dict known
+ } {
+ pop
+ } ifelse
+ } forall
+ }
+ {
+ ( **** Error: Annotation array is not an array, ignoring it.\n) pdfformaterror
+ ( Output may be incorrect.\n) pdfformaterror
+ pop
+ } ifelse
} bind executeonly def
% Determine spot colors are used within a page. We are creating a dict to
@@ -3311,6 +3355,7 @@ currentdict /PDF2PS_matrix_key undef
{
/Parent knownoget
{
+ dup /Pages known not { pop exit } if % not a valid Page Tree ancestor
dup 4 1 roll
resourcespotcolors
3 -1 roll
@@ -3603,6 +3648,43 @@ currentdict /PDF2PS_matrix_key undef
} bind executeonly def
end % pdfdict
+
+
+systemdict /ALLOWPSTRANSPARENCY get
+{
+ /.setopacityalpha
+ {
+ /.setfillconstantalpha where
+ {
+ pop
+ ( **** WARNING: .setopacityalpha is deprecated (as of 9.53.0) and will be removed in a future release\n) print
+ ( **** See .setfillconstantalpha/.setalphaisshape for the improved solution\n) print flush
+ false .setalphaisshape
+ dup .setfillconstantalpha
+ .setstrokeconstantalpha
+ }
+ {
+ /.setopacityalpha /undefined cvx signalerror
+ } ifelse
+ } bind def
+
+ /.setshapealpha
+ {
+ /.setfillconstantalpha where
+ {
+ pop
+ ( **** WARNING: .setshapealpha is deprecated (as of 9.53.0) and will be removed in a future release.\n) print
+ ( **** See .setfillconstantalpha/.setalphaisshape for the improved solution\n) print flush
+ true .setalphaisshape
+ dup .setfillconstantalpha
+ .setstrokeconstantalpha
+ }
+ {
+ /.setshapealpha /undefined cvx signalerror
+ } ifelse
+ } bind def
+} if
+
.setglobal
%% This list of operators are used internally by various parts of the Ghostscript PDF interpreter.
@@ -3626,21 +3708,15 @@ end % pdfdict
] systemdict .undefinternalnames
% The following are split out allowing control via ALLOWPSTRANSPARENCY command line param
+% The examples/transparency_example.ps uses some of these (on the first line).
[
- /.currentblendmode /.currentopacityalpha /.currentshapealpha /.currenttextknockout /.begintransparencytextgroup
+ /.pushpdf14devicefilter /.poppdf14devicefilter /.setstrokeconstantalpha /.setfillconstantalpha /.endtransparencygroup
+ /.currentblendmode /.currenttextknockout /.begintransparencytextgroup
/.endtransparencytextgroup /.begintransparencymaskgroup /.begintransparencymaskimage /.begintransparencypagegroup
- /.endtransparencymask /.image3x /.abortpdf14devicefilter /.setfillconstantalpha /.setalphaisshape /.currentalphaisshape
-
- % Used by our own test suite files
- %/.pushpdf14devicefilter % transparency-example.ps
- %/.poppdf14devicefilter % transparency-example.ps
- %/.setopacityalpha % transparency-example.ps
- %/.setshapealpha % transparency-example.ps
- %/.endtransparencygroup % transparency-example.ps
-
+ /.endtransparencymask /.image3x /.abortpdf14devicefilter /.setstrokeconstantalpha /.setfillconstantalpha /.setalphaisshape /.currentalphaisshape
% undefining these causes errors/incorrect output
%/.setblendmode /.begintransparencygroup /.settextknockout /.setstrokeoverprint /.setfilloverprint
%/.currentstrokeoverprint /.currentfilloverprint /.currentfillconstantalpha /.currentstrokeconstantalpha
- %/.setstrokeconstantalpha /.setfillconstantalpha /.setSMask /.currentSMask
+ %/.setSMask /.currentSMask
] systemdict dup /ALLOWPSTRANSPARENCY get {pop pop}{.undefinternalnames}ifelse
diff --git a/Resource/Init/pdf_ops.ps b/Resource/Init/pdf_ops.ps
index eb2168a5..47ff512d 100644
--- a/Resource/Init/pdf_ops.ps
+++ b/Resource/Init/pdf_ops.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
@@ -304,7 +304,6 @@ currentdict /gput_always_allow .undef
4 2 roll
//CSdict exch get exec exch .setfillcolorspace exec {.setfillcolor} stopped
{
- (error) == flush
cleartomark
[//null /DeviceGray //null /DeviceRGB /DeviceCMYK] exch
{get} stopped
@@ -483,19 +482,19 @@ currentdict /gput_always_allow .undef
% ---------------- Color installation ---------------- %
% Establish a given color (and color space) as current.
-/.settransparencyparams { % <alpha> <smask> .settransparencyparams -
+/.settransparencyparams { % <smask> .settransparencyparams -
PDFusingtransparency {
.currentalphaisshape
{
- 1 .setopacityalpha exch .setshapealpha 1
+ 1
} {
- 1 .setshapealpha exch .setopacityalpha 0
+ 0
} ifelse
% Set the soft mask by rendering the XObject. Doing this every time
% is obviously very inefficient; we'll improve it later.
.settransparencymask
} {
- pop pop
+ pop
} ifelse
} bind executeonly def
/.settransparencymask { % <paramdict> <masknum> .settransparencymask -
@@ -517,16 +516,7 @@ currentdict /gput_always_allow .undef
} ifelse
} ifelse
} bind executeonly def
-% (Non-mask) images must execute setfillblend.
-/setfillblend {
- .currentfillconstantalpha
- .currentSMask .settransparencyparams
-} bind executeonly def
-/setfillstate {
- setfillblend
-} bind executeonly def
-/setstrokestate {
- .currentstrokeconstantalpha
+/setsmaskstate {
.currentSMask .settransparencyparams
} bind executeonly def
/Cdict 15 dict dup begin % <color...> <colorspace> -proc- -
@@ -673,12 +663,12 @@ end def
} ifelse
} bind executeonly def
-/OPsaveDstack 6 dict def % for GroupPushed, saveOP, saveSA, saveBM
+/OPsaveDstack 6 dict def % for GroupPushed, saveOP, saveFillAlpha, saveBM
//OPsaveDstack begin
/GroupPushed //false def
/ChangeBM //false def
- /saveOA 1 def
- /saveSA 1 def
+ /saveStrokeAlpha 1 def
+ /saveFillAlpha 1 def
/saveBM /Normal def
/previous 1 dict def % for nested setup_trans levels
end
@@ -694,7 +684,7 @@ end
/okOPcs mark /DeviceGray 0 /DeviceCMYK 1 /DeviceN 2 /Separation 3 .dicttomark def
% Take care of pushing a transparency group if we need it for SMask or for Overprint..
-% After pushing the group, we save the opacityalpha and shapealpha and change them
+% After pushing the group, we save the ca and CA and change them
% both to 1. For overprint if the colorspace is acceptable, also change to
% CompatibleOverprint if the device needs it.
@@ -721,10 +711,10 @@ end
mark /Subtype /Group /Isolated .currentSMask //null ne .dicttomark
2 index aload pop % pathbbox
.begintransparencygroup
- % After group pushed, set opacityalpha, shapealpha and blendmode
- /saveOA .currentopacityalpha def
- /saveSA .currentshapealpha def
- 1 .setopacityalpha 1 .setshapealpha
+ % After group pushed, set alphas and blendmode
+ /saveStrokeAlpha .currentstrokeconstantalpha def
+ /saveFillAlpha .currentfillconstantalpha def
+ 1 .setfillconstantalpha 1 .setstrokeconstantalpha
/GroupPushed //true def
} {
/GroupPushed //false def
@@ -748,10 +738,10 @@ end
mark /Subtype /Group /Isolated //true .dicttomark
2 index aload pop % pathbbox
.begintransparencygroup
- % After group pushed, set opacityalpha, shapealpha and blendmode
- /saveOA .currentopacityalpha def
- /saveSA .currentshapealpha def
- 1 .setopacityalpha 1 .setshapealpha
+ % After group pushed, set alphas and blendmode
+ /saveStrokeAlpha .currentstrokeconstantalpha def
+ /saveFillAlpha .currentfillconstantalpha def
+ 1 .setfillconstantalpha 1 .setstrokeconstantalpha
/GroupPushed //true def
} {
/GroupPushed //false def
@@ -766,9 +756,9 @@ end
/teardown_trans {
//OPsaveDstack begin
GroupPushed {
- % pop the group, then restore the opacityalpha and shapealpha
+ % pop the group, then restore the alphas
.endtransparencygroup % end the group
- saveOA .setopacityalpha saveSA .setshapealpha
+ saveStrokeAlpha .setstrokeconstantalpha saveFillAlpha .setfillconstantalpha
} if
% Also, if we changed the BM, restore it (AFTER the group was popped)
.currentblendmode /CompatibleOverprint eq {
@@ -904,7 +894,7 @@ currentdict dup /Dpush .undef /Dpop .undef
/S {
OFFlevels length 0 eq {
- setstrokestate .swapcolors /stroke fsexec .swapcolors
+ setsmaskstate .swapcolors /stroke fsexec .swapcolors
} {
newpath
} ifelse
@@ -912,7 +902,7 @@ currentdict dup /Dpush .undef /Dpop .undef
/f {
OFFlevels length 0 eq {
- setfillstate /fill fsexec
+ setsmaskstate /fill fsexec
} {
newpath
} ifelse
@@ -920,7 +910,7 @@ currentdict dup /Dpush .undef /Dpop .undef
/f* {
OFFlevels length 0 eq {
- setfillstate /eofill fsexec
+ setsmaskstate /eofill fsexec
} {
newpath
} ifelse
@@ -932,7 +922,7 @@ currentdict dup /Dpush .undef /Dpop .undef
/B {
OFFlevels length 0 eq {
- setstrokestate setfillstate /.fillstroke fsexec
+ setsmaskstate /.fillstroke fsexec
} {
newpath
} ifelse
@@ -942,7 +932,7 @@ currentdict dup /Dpush .undef /Dpop .undef
/B* {
OFFlevels length 0 eq {
- setstrokestate setfillstate /.eofillstroke fsexec
+ setsmaskstate /.eofillstroke fsexec
} {
newpath
} ifelse
@@ -953,9 +943,9 @@ currentdict dup /Dpush .undef /Dpop .undef
% Clipping:
/Wdict 8 dict dup begin
-/S { OFFlevels length 0 eq { gsave setstrokestate .swapcolors stroke .swapcolors grestore } if n } bind executeonly def
-/f { OFFlevels length 0 eq { gsave setfillstate fill grestore } if n } bind executeonly def
-/f* { OFFlevels length 0 eq { gsave setfillstate eofill grestore } if n } bind executeonly def
+/S { OFFlevels length 0 eq { gsave setsmaskstate .swapcolors stroke .swapcolors grestore } if n } bind executeonly def
+/f { OFFlevels length 0 eq { gsave setsmaskstate fill grestore } if n } bind executeonly def
+/f* { OFFlevels length 0 eq { gsave setsmaskstate eofill grestore } if n } bind executeonly def
/B {
OFFlevels length 0 eq {
.fillstroke
@@ -1154,7 +1144,7 @@ end readonly def
%% can come into pdf_text_begin with an opacity not equal to 1.
PDFusingtransparency .currenttextknockout and
currentdict /illegal_BT get not and
-{
+ {
.begintransparencytextgroup
} if
@@ -1205,7 +1195,17 @@ currentdict /clip_if_required .undef
} if
} bind executeonly def
-/Tc { .settextspacing { showfirst } /Show gput } bind executeonly def
+/Tc {
+ {.settextspacing} stopped
+ {
+ (\n **** Error: A ) pdfformaterror
+ $error /errorname get 256 string cvs pdfformaterror
+ ( error occured while setting the Text Character spacing to ) pdfformaterror
+ 256 string cvs pdfformaterror
+ (\n Output may be incorrect.\n) pdfformaterror
+ } if
+ { showfirst } /Show gput
+} bind executeonly def
/TL { .settextleading } bind executeonly def
/Tr { .settextrenderingmode { showfirst } /Show gput } bind executeonly def
/Ts { .settextrise settextstate } bind executeonly def
@@ -1328,10 +1328,10 @@ currentdict /clip_if_required .undef
{ % We add 1 to the length just in case the original
% didn't have a FID.
exch dup length 1 add dict exch
- { % Stack: changed newfont key value
- 1 index /FID eq
- not { 3 copy put } if pop pop
- }
+ { % Stack: changed newfont key value
+ 1 index /FID eq
+ not { 3 copy put } if pop pop
+ }
forall exch
}
if pop
@@ -1471,9 +1471,9 @@ currentdict /clip_if_required .undef
/pdfwrite_textrenderingprocs [
% Tr 0 - Fill
- { setfillstate show } bind executeonly
+ { setsmaskstate show } bind executeonly
% Tr 1 - Stroke
- { currentlinewidth exch setstrokestate
+ { currentlinewidth exch setsmaskstate
% Need to set the stroke width to a value which gives the correct
% width under pdfwrite. Pdfwrite uses (in text mode) an identity
% CTM, so we need to calculate the stroke width which would result
@@ -1493,7 +1493,7 @@ currentdict /clip_if_required .undef
}ifelse setlinewidth
show setlinewidth} bind executeonly
% Tr 2 - Fill then Stroke
- { currentlinewidth exch setstrokestate
+ { currentlinewidth exch setsmaskstate
% Need to set the stroke width to a value which gives the correct
% width under pdfwrite. Pdfwrite uses (in text mode) an identity
% CTM, so we need to calculate the stroke width which would result
@@ -1511,9 +1511,9 @@ currentdict /clip_if_required .undef
% we can ignore it. (wrong answer, but consistent)
pop pop currentlinewidth
}ifelse setlinewidth
- setfillstate show setlinewidth} bind executeonly
+ setsmaskstate show setlinewidth} bind executeonly
% Tr 3 - Neither fill nor stroke
- { setfillstate show } bind executeonly
+ { setsmaskstate show } bind executeonly
%
% pdfwrite emits all text inside a gsave/grestore pair. As
% a result we can't preserve any of the 'clip' modes, as the
@@ -1522,7 +1522,7 @@ currentdict /clip_if_required .undef
%
% Tr 4 - Fill, add to clip
{ gsave 0 .settextrenderingmode
- setfillstate dup show grestore //true charpath } bind executeonly
+ setsmaskstate dup show grestore //true charpath } bind executeonly
% Tr 5 - Stroke, add to clip
{ gsave 1 .settextrenderingmode
currentlinewidth dup
@@ -1534,7 +1534,7 @@ currentdict /clip_if_required .undef
% we can ignore it. (wrong answer, but consistent)
pop pop currentlinewidth
}ifelse setlinewidth
- setstrokestate dup show grestore
+ setsmaskstate dup show grestore
//true charpath} bind executeonly
% Tr 6 - Fill, stroke, add to clip
{ gsave 2 .settextrenderingmode
@@ -1551,7 +1551,7 @@ currentdict /clip_if_required .undef
% we can ignore it. (wrong answer, but consistent)
pop pop currentlinewidth
}ifelse setlinewidth
- setstrokestate setfillstate dup show grestore
+ setsmaskstate dup show grestore
//true charpath} bind executeonly
% Tr 7 - Add to clip
{ //true charpath} bind executeonly
@@ -1567,7 +1567,7 @@ currentdict /clip_if_required .undef
{
.currenttextrenderingmode 1 eq .currenttextrenderingmode 2 eq or
.currenttextrenderingmode 5 eq .currenttextrenderingmode 6 eq or or {
- setstrokestate
+ setsmaskstate
% Need to set the stroke width to a value which gives the correct
% width under pdfwrite. Pdfwrite uses (in text mode) an identity
% CTM, so we need to calculate the stroke width which would result
@@ -1589,7 +1589,7 @@ currentdict /clip_if_required .undef
% conditionally set fillstate to avoid multiple operations during text operators
/settextfillstate {
- TextFillStateNeeded { setfillstate //false /TextFillStateNeeded gput } if
+ TextFillStateNeeded { setsmaskstate //false /TextFillStateNeeded gput } if
} bind executeonly def
% If current path is not known to be valid, use the clip path
@@ -1786,7 +1786,7 @@ currentdict /clip_if_required .undef
% correctly.
gsave .currenttextrenderingmode 4 sub .settextrenderingmode
setstrokeforTrpreservation
- setstrokestate settextfillstate //false TextTransSetup dup show grestore TextTransTeardown } if
+ setsmaskstate settextfillstate //false TextTransSetup dup show grestore TextTransTeardown } if
//false charpath
3 copy 32 eq { add } { exch pop } ifelse
% Stack: str wthis xorig yorig wword wchar ccode wextra
@@ -1873,7 +1873,7 @@ currentdict /clip_if_required .undef
}
{
.currentPDFfontsize 0 eq not {
- setstrokestate //true TextTransSetup
+ setsmaskstate //true TextTransSetup
currentpoint //Tmatrix currentmatrix TextSaveMatrix setmatrix
currentdict /qTextSaveMatrix known {qTextSaveMatrix setmatrix} if
.swapcolors stroke TextTransTeardown .swapcolors
@@ -1885,24 +1885,29 @@ currentdict /clip_if_required .undef
% Handle transparency the same as /B operator
/tB {
- PDFusingtransparency {
- % knockout trans group around the filled and stroked object
- mark
- /Isolated //true /Knockout //true
- .dicttomark
- 1 .setopacityalpha
- % While text will always have a currentpoint, strokepath seems to mess with it.
- % we get the currentpoint, then use moveto to restore it for pathbbox
- { gsave currentpoint strokepath moveto pathbbox } stopped grestore {
- /tB cvx /undefinedresult signalerror
- } if
- .begintransparencygroup
- gsave tf grestore tS
- .endtransparencygroup
- } {
- gsave tf grestore tS
- } ifelse
- //true /TextFillStateNeeded gput
+ % Type 3 fonts don't honour text rendering modes, see note on p401 of the 1.7 PDF Reference
+ currentfont /FontType get 3 eq
+ {
+ settextfillstate //true TextTransSetup currentpoint fill TextTransTeardown moveto
+ }
+ {
+ % Don't try to draw text when the point size is 0
+ .currentPDFfontsize 0 eq not {
+ setsmaskstate settextfillstate
+ % While text will always have a currentpoint, strokepath seems to mess with it.
+ % we get the currentpoint, then use moveto to restore it.
+ currentpoint
+
+ % For stroking characters, temporarily restore the graphics CTM so that
+ % the line width will be transformed properly.
+ //Tmatrix currentmatrix TextSaveMatrix setmatrix
+ currentdict /qTextSaveMatrix known {qTextSaveMatrix setmatrix} if
+ B
+ setmatrix
+ moveto
+ } if
+ } ifelse
+ //true /TextFillStateNeeded gput
} bind executeonly def
% This does the wrong thing if there have been multiple text operations
diff --git a/Resource/Init/pdf_rbld.ps b/Resource/Init/pdf_rbld.ps
index b018c5c7..037f10b7 100644
--- a/Resource/Init/pdf_rbld.ps
+++ b/Resource/Init/pdf_rbld.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
@@ -444,7 +444,7 @@
pdfformaterror
( **** The file has been damaged. This may have been caused\n)
pdfformaterror
- ( **** by a problem while converting or transfering the file.\n)
+ ( **** by a problem while converting or transferring the file.\n)
pdfformaterror
( **** Ghostscript will attempt to recover the data.\n)
pdfformaterror
diff --git a/Resource/Init/pdf_sec.ps b/Resource/Init/pdf_sec.ps
index 0f77e556..b6f2bfce 100644
--- a/Resource/Init/pdf_sec.ps
+++ b/Resource/Init/pdf_sec.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
@@ -454,6 +454,63 @@ systemdict /check_r6_password .forceundef
printProducer
/pdf_process_Encrypt cvx /undefined signalerror
} if
+
+ % Bug 702598: We can have a trailer dictionary with an /Encrypt entry, and if the
+ % Encrypt dictionary is V 4 or greater we can (should ?) have StrF and stmF entries.
+ %
+ % The code below checks for the existence of StmF and StrF entries. Its possible
+ % that both may be /Identity (which means no encryption) in which case we don't need to check
+ % the password, as we won't need to decrypt any streams or strings. Note that the dict may still
+ % have a non-Identity /EFF (embedded files) key, but Ghostscript doesn't process embedded
+ % files so we don't have to worry about that.
+ Trailer /Encrypt oget dup
+ /V get 4 ge {
+ % NB: Entries in the Encrypt dictionary cannot be indirect references
+ dup /StmF .knownget {
+ /Identity eq not
+ } {
+ false % default StmF is Identity
+ }ifelse
+ 1 index /StrF .knownget {
+ /Identity eq not
+ } {
+ false % default StrF is Identity
+ }ifelse
+ or
+ % ...still in the V4 or above checking...
+ % Even if StmF and StrF are Identity, if the StdCF is missing AuthEvent
+ % or it is DocOpen, we require the password. Check for that.
+ 1 index /CF .knownget {
+ /StdCF .knownget {
+ /AuthEvent .knownget {
+ /DocOpen eq
+ or
+ } {
+ pop true % no AuthEvent, default is DocOpen, require password
+ } ifelse
+ } {
+ pop true % no StdCF, require password
+ } ifelse
+ } {
+ pop true % no CF, require password
+ } ifelse
+ exch pop % discard Encrypt dict
+ }{
+ % Not V4 or later
+ pop true % discard Encrypt dict, require password
+ } ifelse
+ % If we were given a PDFPassword, check it anyway, even if the
+ % code above said we didn't need one. This will allow us to process
+ % PDF files with an initial CryptFilter which has StrF=StmF=Identity,
+ % but contains streams which themselves have non-Identity StmF or StrF.
+ /PDFPassword where {
+ pop true
+ }
+ {
+ false
+ } ifelse
+ or
+ {
() pdf_check_password
{
/FileKey exch def
@@ -504,13 +561,13 @@ systemdict /check_r6_password .forceundef
/pdf_process_Encrypt cvx /invalidfileaccess signalerror
} ifelse
} ifelse
-
-% Trailer /Encrypt oget /P oget 4 and 0 eq #? and
-% { ( ****This owner of this file has requested you do not print it.\n)
-% pdfformaterror printProducer
-% /pdf_process_Encrypt cvx /invalidfileaccess signalerror
-% }
-% if
+ }
+ {
+ ( **** This file has an Encryption dictionary, but both the StmF and StrF entries\n) pdfformatwarning
+ ( **** are /Identity, and AuthEvent allows the document to be opened. It is possible\n) pdfformatwarning
+ ( **** that embedded streams may still use encryption, if the file fails to process\n) pdfformatwarning
+ ( **** you may need to supply a User or Owner password by setting -sPDFPassword=\n) pdfformatwarning
+ } ifelse
} bind executeonly def
% Calculate the key used to decrypt an object (to pass to .decpdfrun or
diff --git a/Resource/SubstCID/CNS1-WMode b/Resource/SubstCID/CNS1-WMode
index 2ff67d52..cc0e9bbd 100644
--- a/Resource/SubstCID/CNS1-WMode
+++ b/Resource/SubstCID/CNS1-WMode
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/SubstCID/GB1-WMode b/Resource/SubstCID/GB1-WMode
index bc82cc99..22da0829 100644
--- a/Resource/SubstCID/GB1-WMode
+++ b/Resource/SubstCID/GB1-WMode
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/SubstCID/Japan1-WMode b/Resource/SubstCID/Japan1-WMode
index bfdbe321..9f85a86e 100644
--- a/Resource/SubstCID/Japan1-WMode
+++ b/Resource/SubstCID/Japan1-WMode
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
diff --git a/Resource/SubstCID/Korea1-WMode b/Resource/SubstCID/Korea1-WMode
index 472a5738..ff59b9dc 100644
--- a/Resource/SubstCID/Korea1-WMode
+++ b/Resource/SubstCID/Korea1-WMode
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or