diff options
author | Thomas Deutschmann <whissi@gentoo.org> | 2020-03-19 13:53:45 +0100 |
---|---|---|
committer | Thomas Deutschmann <whissi@gentoo.org> | 2020-08-13 11:28:25 +0200 |
commit | dc2ba49207af71193f1390d84bba4e15aeea0ce0 (patch) | |
tree | 79c2a51cb5fa2b87800b1113e0015a7108cd2eb3 /Resource/Init/pdf_main.ps | |
parent | Import Ghostscript 9.50 (diff) | |
download | ghostscript-gpl-patches-dc2ba49207af71193f1390d84bba4e15aeea0ce0.tar.gz ghostscript-gpl-patches-dc2ba49207af71193f1390d84bba4e15aeea0ce0.tar.bz2 ghostscript-gpl-patches-dc2ba49207af71193f1390d84bba4e15aeea0ce0.zip |
Import Ghostscript 9.52ghostscript-9.52
Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
Diffstat (limited to 'Resource/Init/pdf_main.ps')
-rw-r--r-- | Resource/Init/pdf_main.ps | 178 |
1 files changed, 128 insertions, 50 deletions
diff --git a/Resource/Init/pdf_main.ps b/Resource/Init/pdf_main.ps index 7690bae0..5cd90556 100644 --- a/Resource/Init/pdf_main.ps +++ b/Resource/Init/pdf_main.ps @@ -47,7 +47,7 @@ userdict /GS_PDF_ProcSet undef % PDF 1.1 operators /BX { /BXlevel BXlevel 1 add store } bind executeonly /EX { /BXlevel BXlevel 1 sub store } bind executeonly - /PS { cvx exec } bind executeonly + /PS { DOPS { cvx exec } { pop } ifelse } bind executeonly % PS disabled by default, as in pdf_draw.ps DoPS % PDF 1.2 operators /BMC { /BMClevel BMClevel 1 add store @@ -2339,8 +2339,20 @@ end readonly def /get_media_box { % <pagedict> get_media_box <box> <bool> /MediaBox pget { - oforce_array //true - } { + oforce_array + dup length 4 eq { + //true + } + { + pop + ( **** Error: Page has an invalid /MediaBox attribute. Using the current page size.\n) + pdfformaterror + ( Output may be incorrect.\n) pdfformaterror + [ 0 0 currentpagedevice /PageSize get aload pop ] + //false + }ifelse + } + { ( **** Error: Page has no /MediaBox attribute. Using the current page size.\n) pdfformaterror ( Output may be incorrect.\n) pdfformaterror @@ -2493,9 +2505,26 @@ end readonly def 1 } { 1 index /UserUnit knownoget { - PDFDEBUG { (Scaling due to UserUnit by ) print dup = flush } if + /PassUserUnit /GetDeviceParam .special_op { + exch pop dup { + [ /UserUnit 4 -1 roll .pdfputparams pop pop 1 exch + } if + }{ + //false + }ifelse + + not { + PDFDEBUG { (Scaling due to UserUnit by ) print dup = flush } if + } if } { - 1 + /PassUserUnit /GetDeviceParam .special_op { + exch pop { + [ /UserUnit 1 .pdfputparams pop pop + } if + 1 + }{ + 1 + } ifelse } ifelse } ifelse } ifelse @@ -2573,8 +2602,23 @@ currentdict /PDF2PS_matrix_key undef % Set the page size. //systemdict /NoUserUnit .knownget not { //false } if not { 3 index /UserUnit knownoget { - dup 4 -1 roll mul 3 1 roll mul - } if + /PassUserUnit /GetDeviceParam .special_op { + exch pop dup { + [ /UserUnit 4 -1 roll .pdfputparams pop pop + } if + }{ + //false + }ifelse + not { + dup 4 -1 roll mul 3 1 roll mul + } if + } { + /PassUserUnit /GetDeviceParam .special_op { + exch pop { + [ /UserUnit 1 .pdfputparams pop pop + } if + }if + } ifelse } if } ifelse 2 array astore /PageSize exch def @@ -2740,7 +2784,7 @@ currentdict /PDF2PS_matrix_key undef .poppdf14devicefilter % NB: reset to DefaultQstate will also restore transfer function /DefaultQstate qstate store % device has changed -- reset DefaultQstate } { - /setup_trans { pop } def % no-op this if the page doesn't use transparency + /setup_trans { pop pop } def % no-op this if the page doesn't use transparency % NB: original will be restored from PDFsave showpagecontents } ifelse @@ -2856,7 +2900,19 @@ currentdict /PDF2PS_matrix_key undef % Draw the annotations //systemdict /ShowAnnots .knownget not { //true } if { /Annots knownoget { - { oforce + { + /AnnotDrawCheck exch % marker to clean up stack on error + {oforce} stopped + { + ( **** Error: Unable to draw an annotation.\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 + /AnnotDrawCheck eq {exit} if % remove object and check if its the marker, exit if it is + } for + } + { + exch pop dup //null ne { .writepdfmarks %% @@ -2878,6 +2934,7 @@ currentdict /PDF2PS_matrix_key undef } { pop } ifelse + } ifelse } forall } if } if @@ -3063,33 +3120,45 @@ currentdict /PDF2PS_matrix_key undef //false exch % Assume no transparency /Annots knownoget { % Get Annots array { - oforce - dup //null ne { - dup /Subtype knownoget { - /Highlight eq { % Highlight annotation is always implemented - pop pop //true exit % as transparency. + /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 - } 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 + 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 - } if % If AP dict known - dup /BM knownoget { - //true exit - } if - dup /CA knownoget { - 1 le { - pop pop //true exit + dup /CA knownoget { + 1 le { + pop pop //true exit + } if } if - } if - /ca knownoget { - 1 le { - pop //true exit + /ca knownoget { + 1 le { + pop //true exit + } if } if - } if - } { - pop + } { + pop + } ifelse } ifelse } forall % For all annots on the page } if @@ -3545,24 +3614,33 @@ end % pdfdict /.setfillcolor /.setfillcolorspace /.setstrokecolor /.setstrokecolorspace /.currentrenderingintent /.setrenderingintent /.currenttextrenderingmode /.settextspacing /.currenttextspacing /.settextleading /.currenttextleading /.settextrise /.currenttextrise /.setwordspacing /.currentwordspacing /.settexthscaling /.currenttexthscaling -/.settextlinematrix /.currenttextlinematrix /.currenttextmatrix /.settextmatrix /.currentblendmode -/.currentopacityalpha /.currentshapealpha /.currenttextknockout -/.pushextendedgstate /.popextendedgstate /.begintransparencytextgroup -/.endtransparencytextgroup /.begintransparencymaskgroup /.begintransparencymaskimage /.endtransparencymask /.image3x -/.abortpdf14devicefilter /.pdfinkpath /.pdfFormName /.setstrokeconstantalpha -/.setfillconstantalpha /.setalphaisshape /.currentalphaisshape -/.settextspacing /.currenttextspacing /.settextleading /.currenttextleading /.settextrise /.currenttextrise -/.setwordspacing /.currentwordspacing /.settexthscaling /.currenttexthscaling /.setPDFfontsize /.currentPDFfontsize -/.setdistillerparams - -% 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 +/.settextlinematrix /.currenttextlinematrix /.currenttextmatrix /.settextmatrix /.pushextendedgstate +/.popextendedgstate + +/.pdfinkpath /.pdfFormName /.settextspacing /.currenttextspacing /.settextleading /.currenttextleading +/.settextrise /.currenttextrise /.setwordspacing /.currentwordspacing /.settexthscaling /.currenttexthscaling +/.setPDFfontsize /.currentPDFfontsize /.setdistillerparams % undefining these causes errors/incorrect output -%/.settextrenderingmode /.setblendmode /.begintransparencygroup /.settextknockout /.setstrokeoverprint /.setfilloverprint -%/.currentstrokeoverprint /.currentfilloverprint /.currentfillconstantalpha /.currentstrokeconstantalpha +%/.settextrenderingmode ] systemdict .undefinternalnames + +% The following are split out allowing control via ALLOWPSTRANSPARENCY command line param +[ + /.currentblendmode /.currentopacityalpha /.currentshapealpha /.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 + + % undefining these causes errors/incorrect output + %/.setblendmode /.begintransparencygroup /.settextknockout /.setstrokeoverprint /.setfilloverprint + %/.currentstrokeoverprint /.currentfilloverprint /.currentfillconstantalpha /.currentstrokeconstantalpha + %/.setstrokeconstantalpha /.setfillconstantalpha /.setSMask /.currentSMask + +] systemdict dup /ALLOWPSTRANSPARENCY get {pop pop}{.undefinternalnames}ifelse |