diff options
author | 2020-09-10 18:10:49 +0200 | |
---|---|---|
committer | 2020-09-11 20:06:36 +0200 | |
commit | acfc02c1747065fe450c7cfeb6f1844b62335f08 (patch) | |
tree | 5887806a2e6b99bbb0255e013a9028810e230a7f | |
parent | Import Ghostscript 9.52 (diff) | |
download | ghostscript-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>
1844 files changed, 75557 insertions, 34633 deletions
diff --git a/.lgtm.yml b/.lgtm.yml new file mode 100644 index 00000000..97d679ef --- /dev/null +++ b/.lgtm.yml @@ -0,0 +1,33 @@ +path_classifiers: + docs: + - docs + - examples + + # Libraries that we maintain are explicitly given their own groups + # They will be checked, and will contribute to our error/warning counts, + # but we can easily enable/disable them in the web frontend. + openjpeg: + - openjpeg + lcms2mt: + - lcms2mt + jbig2dec: + - jbig2dec + + # Other libraries that we take unchanged are listed here. These will + # be scanned, but won't contribute to our counts. + library: + - expat + - freetype + - jpeg + - jpegxr + - libpng + - tiff + - zlib + + devices: + - devices + contrib: + - contrib + tools: + - toolbin + - pcl/tools diff --git a/Makefile.in b/Makefile.in index 0e5bd094..8fc446d6 100644 --- a/Makefile.in +++ b/Makefile.in @@ -418,7 +418,7 @@ CCAUXLD=$(CCAUX) # Define the default gcc flags. GCFLAGS=@CPPFLAGS@ @GCFLAGS@ @CFLAGS@ @HAVE_POPEN_PROTO@ -GCFLAGSAUX=@GCFLAGSAUX@ @HAVE_POPEN_PROTO@ +GCFLAGSAUX=@GCFLAGSAUX@ @CFLAGSAUX@ @HAVE_POPEN_PROTO@ # Define the added flags for standard, debugging, profiling # and shared object builds. @@ -462,6 +462,8 @@ DBUS_LIBS=@DBUS_LIBS@ # defines from autoconf; note that we don't use all of these at present. ACDEFS=@DEFS@ +CFLAGS_VISIBILITY=@CFLAGS_VISIBILITY@ + CFLAGS=$(CFLAGS_STANDARD) $(GCFLAGS) $(AC_CFLAGS) $(XCFLAGS) @CLUSTER_CFLAGS@ CFLAGSAUX=$(CFLAGSAUX_STANDARD) $(GCFLAGSAUX) $(XCFLAGSAUX) @@ -506,7 +508,7 @@ AUXEXTRALIBS=@AUXEXTRALIBS@ @AUX_SHARED_ZLIB@ # All reasonable platforms require -lm, but Rhapsody and perhaps one or # two others fold libm into libc and don't require any additional library. -STDLIBS=@PTHREAD_LIBS@ -lm +STDLIBS=@PTHREAD_LIBS@ -lm @TESSERACT_LIBS@ # Define the include switch(es) for the X11 header files. # This can be null if handled in some other way (e.g., the files are @@ -665,7 +667,7 @@ DEVICE_DEVS12= DEVICE_DEVS13= DEVICE_DEVS14= DEVICE_DEVS15= -DEVICE_DEVS16= +DEVICE_DEVS16=@OCR_DEVS@ DEVICE_DEVS17= DEVICE_DEVS18= DEVICE_DEVS19= @@ -718,6 +720,16 @@ LD_SET_DT_SONAME=@SET_DT_SONAME@ MAKEDIRS=@ORDER_ONLY@ directories MAKEDIRSTOP= +OCR_VERSION=@OCR_VERSION@ +LEPTONICADIR=@LEPTONICADIR@ +TESSAVX=@TESS_AVX@ +TESSAVX2=@TESS_AVX2@ +TESSFMA=@TESS_FMA@ +TESSSSE41=@TESS_SSE4_1@ +TESSNEON=@TESS_NEON@ +TESSCXXFLAGS=@TESS_CXXFLAGS@ +TESSERACTDIR=@TESSERACTDIR@ + # ---------------- End of platform-specific section ---------------- # INSTALL_CONTRIB=@INSTALL_CONTRIB@ @@ -752,6 +764,9 @@ include $(GLSRCDIR)/ldf_jb2.mak include $(GLSRCDIR)/lwf_jp2.mak include $(GLSRCDIR)/openjpeg.mak include $(GLSRCDIR)/cal.mak +@LEPTONICAINCLUDE@ +@TESSERACTINCLUDE@ +include $(GLSRCDIR)/ocr.mak include $(GLSRCDIR)/jpegxr.mak include $(GLSRCDIR)/expat.mak @@ -761,7 +776,7 @@ include $(GLSRCDIR)/ijs.mak @LCUPSINCLUDE@ @LCUPSIINCLUDE@ include $(DEVSRCDIR)/devs.mak -include $(DEVSRCDIR)/contrib.mak +include $(DEVSRCDIR)/dcontrib.mak include $(GLSRCDIR)/unix-aux.mak include $(GLSRCDIR)/unixlink.mak include $(GLSRCDIR)/unix-dll.mak diff --git a/Resource/CIDFont/ArtifexBullet b/Resource/CIDFont/ArtifexBullet Binary files differindex ce579f06..18c98f16 100644 --- a/Resource/CIDFont/ArtifexBullet +++ b/Resource/CIDFont/ArtifexBullet 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 Binary files differindex a031ac9c..dc1dad0a 100644 --- a/Resource/Font/NimbusSans-BoldItalic +++ b/Resource/Font/NimbusSans-BoldItalic diff --git a/Resource/Font/NimbusSans-Italic b/Resource/Font/NimbusSans-Italic Binary files differindex 989210f6..2fcec067 100644 --- a/Resource/Font/NimbusSans-Italic +++ b/Resource/Font/NimbusSans-Italic 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 diff --git a/arch/arch_autoconf.h.in b/arch/arch_autoconf.h.in index 34ec8678..87fa50b9 100644 --- a/arch/arch_autoconf.h.in +++ b/arch/arch_autoconf.h.in @@ -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/arch/windows-arm-msvc.h b/arch/windows-arm-msvc.h index a814f753..b347381e 100644 --- a/arch/windows-arm-msvc.h +++ b/arch/windows-arm-msvc.h @@ -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/arch/windows-x64-msvc.h b/arch/windows-x64-msvc.h index 934d60cc..3be724f3 100644 --- a/arch/windows-x64-msvc.h +++ b/arch/windows-x64-msvc.h @@ -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/arch/windows-x86-msvc.h b/arch/windows-x86-msvc.h index 23b8d618..76b6e806 100644 --- a/arch/windows-x86-msvc.h +++ b/arch/windows-x86-msvc.h @@ -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/base/all-arch.mak b/base/all-arch.mak index 4263d01b..cb9b56b5 100644 --- a/base/all-arch.mak +++ b/base/all-arch.mak @@ -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/base/assert_.h b/base/assert_.h index a00007f9..6be404ed 100644 --- a/base/assert_.h +++ b/base/assert_.h @@ -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/base/bench.c b/base/bench.c index 170c8d9b..6ff8aca9 100644 --- a/base/bench.c +++ b/base/bench.c @@ -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/base/bobbin.c b/base/bobbin.c index 2994bd46..63720f3e 100644 --- a/base/bobbin.c +++ b/base/bobbin.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2016-2018 Artifex Software, Inc. +/* Copyright (C) 2016-2020 Artifex Software, Inc. All Rights Reserved. This software is provided AS-IS with no warranty, either express or diff --git a/base/bobbin.h b/base/bobbin.h index 01863c5a..04c6d9aa 100644 --- a/base/bobbin.h +++ b/base/bobbin.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2016-2018 Artifex Software, Inc. +/* Copyright (C) 2016-2020 Artifex Software, Inc. All Rights Reserved. This software is provided AS-IS with no warranty, either express or diff --git a/base/cal.mak b/base/cal.mak index 2e18077b..8a718a29 100644 --- a/base/cal.mak +++ b/base/cal.mak @@ -56,6 +56,8 @@ cal_OBJS = \ $(CAL_OBJ)$(CAL_PREFIX)blendavx2.$(OBJ) \ $(CAL_OBJ)$(CAL_PREFIX)blendsse42.$(OBJ)\ $(CAL_OBJ)$(CAL_PREFIX)blend.$(OBJ) \ + $(CAL_OBJ)$(CAL_PREFIX)skew.$(OBJ) \ + $(CAL_OBJ)$(CAL_PREFIX)deskew.$(OBJ) \ $(CAL_OBJ)$(CAL_PREFIX)cmsavx2.$(OBJ) \ $(CAL_OBJ)$(CAL_PREFIX)cmssse42.$(OBJ) \ $(CAL_OBJ)$(CAL_PREFIX)cmsneon.$(OBJ) \ @@ -121,6 +123,12 @@ $(CAL_OBJ)$(CAL_PREFIX)blendsse42.$(OBJ) : $(CAL_SRC)blendsse42.c $(cal_HDRS) $( $(CAL_OBJ)$(CAL_PREFIX)blend.$(OBJ) : $(CAL_SRC)blend.c $(cal_HDRS) $(CAL_DEP) $(gsmemory_h) $(CAL_CC) $(I_)$(GLSRC) $(CAL_O)blend.$(OBJ) $(C_) $(CAL_SRC)blend.c +$(CAL_OBJ)$(CAL_PREFIX)skew.$(OBJ) : $(CAL_SRC)skew.c $(cal_HDRS) $(CAL_DEP) $(gsmemory_h) + $(CAL_CC) $(CAL_SSE4_2_CFLAGS) $(I_)$(GLSRC) $(CAL_O)skew.$(OBJ) $(C_) $(CAL_SRC)skew.c + +$(CAL_OBJ)$(CAL_PREFIX)deskew.$(OBJ) : $(CAL_SRC)deskew.c $(cal_HDRS) $(CAL_DEP) $(gsmemory_h) + $(CAL_CC) $(CAL_SSE4_2_CFLAGS) $(CAL_NEON_CFLAGS) $(I_)$(GLSRC) $(CAL_O)deskew.$(OBJ) $(C_) $(CAL_SRC)deskew.c + cal_ets_h=$(CAL_SRC)cal_ets.h ca_ets_tm_h=$(CAL_SRC)cal_ets_tm.h $(GLOBJ)ets_1.$(OBJ) : $(CAL_SRC)cal_ets.c $(CAL_SRC)ets_template.c \ diff --git a/base/claptrap-impl.h b/base/claptrap-impl.h index dc9cca30..f758d5e0 100644 --- a/base/claptrap-impl.h +++ b/base/claptrap-impl.h @@ -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/base/claptrap-init.c b/base/claptrap-init.c index f32e2712..3e20d3ed 100644 --- a/base/claptrap-init.c +++ b/base/claptrap-init.c @@ -45,8 +45,8 @@ ClapTrap *ClapTrap_Init(gs_memory_t *mem, ct->y = 0; ct->span = width * num_comps; - ct->linebuf = gs_alloc_bytes(mem, ct->span * ct->lines_in_buf, "ClapTrap linebuf"); - ct->process = gs_alloc_bytes(mem, ct->width * ct->lines_in_buf, "ClapTrap process"); + ct->linebuf = gs_alloc_bytes(mem, (size_t)ct->span * ct->lines_in_buf, "ClapTrap linebuf"); + ct->process = gs_alloc_bytes(mem, (size_t)ct->width * ct->lines_in_buf, "ClapTrap process"); if (ct->linebuf == NULL || ct->process == NULL) { gs_free_object(mem, ct->linebuf, "ClapTrap linebuf"); diff --git a/base/claptrap-planar.c b/base/claptrap-planar.c index 9b06b184..e77233ae 100644 --- a/base/claptrap-planar.c +++ b/base/claptrap-planar.c @@ -44,7 +44,7 @@ inline static void process_at_pixel(ClapTrap * gs_restrict ct, int width = ct->width; int height = ct->height; #ifndef NDEBUG - int num_comp_lim = ct->num_comps; + int num_comp_lim = ct->num_comps-1; #endif int max_x_offset = ct->max_x_offset; int max_y_offset = ct->max_y_offset; @@ -152,7 +152,7 @@ int ClapTrap_GetLinePlanar(ClapTrap * gs_restrict ct, int x; int line_offset; unsigned char *process; - int num_comp_lim = ct->num_comps; + int num_comp_lim = ct->num_comps-1; /* Read in as many lines as we need */ max_y = ct->y + ct->max_y_offset; diff --git a/base/claptrap.c b/base/claptrap.c index 1ca57370..5829f09e 100644 --- a/base/claptrap.c +++ b/base/claptrap.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2015-2018 Artifex Software, Inc. +/* Copyright (C) 2015-2020 Artifex Software, Inc. All Rights Reserved. This software is provided AS-IS with no warranty, either express or diff --git a/base/claptrap.h b/base/claptrap.h index 64902fee..2b28c04f 100644 --- a/base/claptrap.h +++ b/base/claptrap.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2019 Artifex Software, Inc. +/* Copyright (C) 2015-2020 Artifex Software, Inc. All Rights Reserved. This software is provided AS-IS with no warranty, either express or diff --git a/base/ctype_.h b/base/ctype_.h index 0123c6b9..32e8f9a6 100644 --- a/base/ctype_.h +++ b/base/ctype_.h @@ -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/base/dirent_.h b/base/dirent_.h index dc1e8b40..6eae53d2 100644 --- a/base/dirent_.h +++ b/base/dirent_.h @@ -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/base/dos_.h b/base/dos_.h index ffc8b05e..29f92aa5 100644 --- a/base/dos_.h +++ b/base/dos_.h @@ -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/base/echogs.c b/base/echogs.c index ae68402c..b8e93d9f 100644 --- a/base/echogs.c +++ b/base/echogs.c @@ -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/base/endianness.h b/base/endianness.h new file mode 100644 index 00000000..a609e622 --- /dev/null +++ b/base/endianness.h @@ -0,0 +1,17 @@ +#ifndef LEPTONICA_ENDIANNESS_H +#define LEPTONICA_ENDIANNESS_H + +#include "arch.h" + +#if ARCH_IS_BIG_ENDIAN +#define L_BIG_ENDIAN +#endif + +#ifdef L_BIG_ENDIAN +#else +# ifndef L_LITTLE_ENDIAN +# define L_LITTLE_ENDIAN +# endif +#endif + +#endif diff --git a/base/errno_.h b/base/errno_.h index f7ed62dc..5f05c616 100644 --- a/base/errno_.h +++ b/base/errno_.h @@ -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 @@ -1,4 +1,4 @@ - /* +/* * Testbed implementation of Even Better Screening. Please see * http://www.artofcode.com/eventone/ for more details. * @@ -9,7 +9,18 @@ * of ETS is for commercial licensees and is governed by the licensing * agreement between artofcode LLC and the licensee. Please see * http://www.artofcode.com/eventone/ for information on licensing. -*/ + * + * Subsequent Changes: Copyright (C) 2013-2020 Artifex Software, Inc. + * + * All Rights Reserved. + * + * This software is provided AS-IS with no warranty, either express or + * implied. + * + * This software is distributed under license and may not be copied, + * modified or distributed except as expressly authorized under the terms + * of the license contained in the file LICENSE in this distribution. + */ #include <stdlib.h> #include <string.h> @@ -101,7 +112,7 @@ typedef struct { * on an input line. Called to generate optimised versions. */ static inline void -ets_line_template(unsigned char * gs_restrict * gs_restrict dest, const ETS_SrcPixel * const gs_restrict * gs_restrict src, int n_planes, int levels, int aspect_x, int aspect_y, int elo, int ehi, int ets_bias, int r_style, int old_quant, int fancy_coupling, int * gs_restrict c_line, +ets_line_template(unsigned char * gs_restrict * gs_restrict dest, const ETS_SrcPixel * const gs_restrict * gs_restrict src, int n_planes, int levels, int aspect_x, int aspect_y, int elo, int ehi, int ets_biasing_mode, int r_style, int old_quant, int fancy_coupling, int * gs_restrict c_line, const signed char * gs_restrict tmmat, unsigned int tmwidth, unsigned int tmheight, unsigned int y, int xd, ETS_PlaneCtx * gs_restrict * gs_restrict planes, uint32 *seeds, int in_plane_step, int out_plane_step) { ETS_PixelInternals pi[M]; @@ -260,7 +271,7 @@ ets_line_template(unsigned char * gs_restrict * gs_restrict dest, const ETS_SrcP * 3 like 1, but same shift either side of 0. * 4+ scale the modulation down. */ - switch (ets_bias) + switch (ets_biasing_mode) { case ETS_BIAS_ZERO: ets_bias = 0; @@ -1,17 +1,26 @@ -/* Copyright (C) 2001-2019 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, - CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ +/* + * Testbed implementation of Even Better Screening. Please see + * http://www.artofcode.com/eventone/ for more details. + * + * Copyright 2001-2004 Raph Levien <raph@acm.org> + * + * Code in this module is covered by US Patents 5,055,942 and + * 5,917,614, and corresponding international patents. This version + * of ETS is for commercial licensees and is governed by the licensing + * agreement between artofcode LLC and the licensee. Please see + * http://www.artofcode.com/eventone/ for information on licensing. + * + * Subsequent Changes: Copyright (C) 2013-2020 Artifex Software, Inc. + * + * All Rights Reserved. + * + * This software is provided AS-IS with no warranty, either express or + * implied. + * + * This software is distributed under license and may not be copied, + * modified or distributed except as expressly authorized under the terms + * of the license contained in the file LICENSE in this distribution. + */ #ifndef ets_h_INCLUDED # define ets_h_INCLUDED diff --git a/base/ets_tm.h b/base/ets_tm.h index 62e13e95..5decb9c3 100644 --- a/base/ets_tm.h +++ b/base/ets_tm.h @@ -1,17 +1,26 @@ -/* Copyright (C) 2001-2019 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, - CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ +/* + * Testbed implementation of Even Better Screening. Please see + * http://www.artofcode.com/eventone/ for more details. + * + * Copyright 2001-2004 Raph Levien <raph@acm.org> + * + * Code in this module is covered by US Patents 5,055,942 and + * 5,917,614, and corresponding international patents. This version + * of ETS is for commercial licensees and is governed by the licensing + * agreement between artofcode LLC and the licensee. Please see + * http://www.artofcode.com/eventone/ for information on licensing. + * + * Subsequent Changes: Copyright (C) 2013-2020 Artifex Software, Inc. + * + * All Rights Reserved. + * + * This software is provided AS-IS with no warranty, either express or + * implied. + * + * This software is distributed under license and may not be copied, + * modified or distributed except as expressly authorized under the terms + * of the license contained in the file LICENSE in this distribution. + */ #ifndef ets_tm_h_INCLUDED diff --git a/base/expat.mak b/base/expat.mak index 3cb3c3c8..08db2a1d 100644 --- a/base/expat.mak +++ b/base/expat.mak @@ -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/base/fapi_bs.mak b/base/fapi_bs.mak index afc0fa2f..894bcb82 100644 --- a/base/fapi_bs.mak +++ b/base/fapi_bs.mak @@ -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/base/fapi_ft.c b/base/fapi_ft.c index 60f69f64..46f865ef 100644 --- a/base/fapi_ft.c +++ b/base/fapi_ft.c @@ -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 @@ -1114,7 +1114,7 @@ gs_fapi_ft_get_scaled_font(gs_fapi_server * a_server, gs_fapi_font * a_font, ff_server *s = (ff_server *) a_server; ff_face *face = (ff_face *) a_font->server_font_data; FT_Error ft_error = 0; - int i, j; + int i, j, code; FT_CharMap cmap = NULL; bool data_owned = true; @@ -1183,7 +1183,6 @@ gs_fapi_ft_get_scaled_font(gs_fapi_server * a_server, gs_fapi_font * a_font, /* Load a typeface from a file. */ else if (a_font->font_file_path) { FT_Open_Args args; - int code; memset(&args, 0x00, sizeof(args)); @@ -1215,9 +1214,12 @@ gs_fapi_ft_get_scaled_font(gs_fapi_server * a_server, gs_fapi_font * a_font, if (a_font->is_type1) { long length; - int type = - a_font->get_word(a_font, gs_fapi_font_feature_FontType, - 0); + unsigned short type = 0; + + code = a_font->get_word(a_font, gs_fapi_font_feature_FontType, 0, &type); + if (code < 0) { + return code; + } /* Tell the FAPI interface that we need to decrypt the /Subrs data. */ a_font->need_decrypt = true; @@ -1230,6 +1232,7 @@ gs_fapi_ft_get_scaled_font(gs_fapi_server * a_server, gs_fapi_font * a_font, length = gs_fapi_serialize_type1_font(a_font, NULL, 0); else length = gs_fapi_serialize_type2_font(a_font, NULL, 0); + open_args.memory_base = own_font_data = FF_alloc(s->ftmemory, length); if (!open_args.memory_base) @@ -1237,14 +1240,14 @@ gs_fapi_ft_get_scaled_font(gs_fapi_server * a_server, gs_fapi_font * a_font, own_font_data_len = length; if (type == 1) open_args.memory_size = - gs_fapi_serialize_type1_font(a_font, own_font_data, - length); + gs_fapi_serialize_type1_font(a_font, own_font_data, length); else open_args.memory_size = - gs_fapi_serialize_type2_font(a_font, own_font_data, - length); + gs_fapi_serialize_type2_font(a_font, own_font_data, length); + if (open_args.memory_size != length) return_error(gs_error_unregistered); /* Must not happen. */ + ft_inc_int = new_inc_int(a_server, a_font); if (!ft_inc_int) { FF_free(s->ftmemory, own_font_data); @@ -1255,11 +1258,16 @@ gs_fapi_ft_get_scaled_font(gs_fapi_server * a_server, gs_fapi_font * a_font, /* It must be type 42 (see code in FAPI_FF_get_glyph in zfapi.c). */ else { /* Get the length of the TrueType data. */ - open_args.memory_size = - a_font->get_long(a_font, gs_fapi_font_feature_TT_size, 0); - if (open_args.memory_size == 0) + unsigned long ms; + + code = a_font->get_long(a_font, gs_fapi_font_feature_TT_size, 0, &ms); + if (code < 0) + return code; + if (ms == 0) return_error(gs_error_invalidfont); + open_args.memory_size = (FT_Long)ms; + /* Load the TrueType data into a single buffer. */ open_args.memory_base = own_font_data = FF_alloc(s->ftmemory, open_args.memory_size); @@ -1268,10 +1276,10 @@ gs_fapi_ft_get_scaled_font(gs_fapi_server * a_server, gs_fapi_font * a_font, own_font_data_len = open_args.memory_size; - if (a_font-> - serialize_tt_font(a_font, own_font_data, - open_args.memory_size)) - return_error(gs_error_invalidfont); + code = a_font->serialize_tt_font(a_font, own_font_data, + open_args.memory_size); + if (code < 0) + return code; /* We always load incrementally. */ ft_inc_int = new_inc_int(a_server, a_font); diff --git a/base/fapibstm.c b/base/fapibstm.c index 73c1d08f..0eb120c2 100644 --- a/base/fapibstm.c +++ b/base/fapibstm.c @@ -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 @@ -103,8 +103,9 @@ InitFont(Bitstream_server * server, FAPI_font * ff) own_font_data = gs_malloc(mem, 1, length, "Type 42 fotn copy"); if (!own_font_data) return_error(gs_error_VMerror); - if (ff->serialize_tt_font(ff, own_font_data, length)) - return_error(gs_error_invalidfont); + error = ff->serialize_tt_font(ff, own_font_data, length); + if (error < 0) + return error; } } face->font_data = own_font_data; diff --git a/base/fapiufst.c b/base/fapiufst.c index 59aeb134..4089e905 100644 --- a/base/fapiufst.c +++ b/base/fapiufst.c @@ -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 @@ -79,14 +79,14 @@ #include "gxfapiu.h" -#if UFST_VERSION_MAJOR >= 6 && UFST_VERSION_MINOR >= 2 +#if (UFST_VERSION_MAJOR >= 6 && UFST_VERSION_MINOR >= 2) || UFST_VERSION_MAJOR >= 7 #include "t1itype1.h" #endif #define ufst_emprintf(m,s) { outflush(m); emprintf(m, s); outflush(m); } #define ufst_emprintf1(m,s,d) { outflush(m); emprintf1(m, s, d); outflush(m); } -#if UFST_VERSION_MAJOR >= 6 && UFST_VERSION_MINOR >= 2 +#if (UFST_VERSION_MAJOR >= 6 && UFST_VERSION_MINOR >= 2) || UFST_VERSION_MAJOR >= 7 #undef true #undef false @@ -720,74 +720,170 @@ pack_float(LPUB8 * p, float v) #define PACK_ZERO(p) *(p++) = 0 #define PACK_BYTE(p, c) *(p++) = c -#define PACK_WORD(p, i, var) pack_word(&p, ff->get_word(ff, var, i)) -#define PACK_LONG(p, i, var) pack_long(&p, ff->get_long(ff, var, i)) -static void +static inline int +pack_feature_word(gs_fapi_font * ff, LPUB8 * p, gs_fapi_font_feature var, int ind) +{ + UW16 val; + int code = ff->get_word(ff, var, ind, (unsigned short *)&val); + if (code < 0) + return code; + pack_word(p, val); + + return code; +} + +static inline int +pack_feature_long(gs_fapi_font * ff, LPUB8 * p, gs_fapi_font_feature var, int ind) +{ + UL32 val; + unsigned long lv; + int code = ff->get_long(ff, var, ind, &lv); + if (code < 0) + return code; + val = (UL32)lv; + pack_word(p, val); + + return code; +} + +static int pack_pseo_word_array(fapi_ufst_server * r, gs_fapi_font * ff, UB8 ** p, UW16 max_count, gs_fapi_font_feature count_id, gs_fapi_font_feature array_id) { - UW16 k = min(ff->get_word(ff, count_id, 0), max_count), j; + UW16 k, k2, j; + int code; + + code = ff->get_word(ff, count_id, 0, (unsigned short *)&k2); + if (code < 0) + return code; + k = min(k2, max_count); pack_word(p, k); for (j = 0; j < k; j++) - PACK_WORD(*p, j, array_id); + code = pack_feature_word(ff, p, j, array_id); for (; j < max_count; j++) pack_word(p, 0); + + return code; } -static void +static int pack_pseo_fhdr(fapi_ufst_server * r, gs_fapi_font * ff, UB8 * p) { ushort j, n, skip = 0; + int code; while (((uint64_t) p) & 0x03) /* align to QUADWORD */ PACK_ZERO(p); pack_long(&p, 1); /* format = 1 */ - for (j = 0; j < 6; j++) - pack_float(&p, ff->get_float(ff, gs_fapi_font_feature_FontMatrix, j)); + for (j = 0; j < 6; j++) { + float f; + code = ff->get_float(ff, gs_fapi_font_feature_FontMatrix, j, &f); + if (code < 0) + return code; + pack_float(&p, f); + } while (((uint64_t) p) & 0x03) /* align to QUADWORD */ PACK_ZERO(p); /* UFST has no definition for PSEO structure, so implement serialization : */ - PACK_LONG(p, 0, gs_fapi_font_feature_UniqueID); |