diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2018-09-08 03:37:12 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2018-09-08 03:37:12 +0000 |
commit | a595d6b4d64cebb81abbd93dcbad84d35a117c32 (patch) | |
tree | 2f2b75e6f5153e0f7b8c5d2740dea417359c27b3 /Master/tlpkg/tlgs | |
parent | 1c29476b23544769439ddfb973d197ead277bfaa (diff) |
recover previous Resource/Init
git-svn-id: svn://tug.org/texlive/trunk@48622 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/tlgs')
-rw-r--r-- | Master/tlpkg/tlgs/Resource/Init/gs_dps.ps | 2 | ||||
-rw-r--r-- | Master/tlpkg/tlgs/Resource/Init/gs_fntem.ps | 2 | ||||
-rw-r--r-- | Master/tlpkg/tlgs/Resource/Init/gs_init.ps | 338 | ||||
-rw-r--r-- | Master/tlpkg/tlgs/Resource/Init/gs_lev2.ps | 58 | ||||
-rw-r--r-- | Master/tlpkg/tlgs/Resource/Init/gs_ll3.ps | 7 | ||||
-rw-r--r-- | Master/tlpkg/tlgs/Resource/Init/gs_pdfwr.ps | 7 | ||||
-rw-r--r-- | Master/tlpkg/tlgs/Resource/Init/gs_setpd.ps | 6 | ||||
-rw-r--r-- | Master/tlpkg/tlgs/Resource/Init/gs_typ32.ps | 2 | ||||
-rw-r--r-- | Master/tlpkg/tlgs/Resource/Init/pdf_base.ps | 152 | ||||
-rw-r--r-- | Master/tlpkg/tlgs/Resource/Init/pdf_draw.ps | 738 | ||||
-rw-r--r-- | Master/tlpkg/tlgs/Resource/Init/pdf_font.ps | 154 | ||||
-rw-r--r-- | Master/tlpkg/tlgs/Resource/Init/pdf_main.ps | 432 | ||||
-rw-r--r-- | Master/tlpkg/tlgs/Resource/Init/pdf_ops.ps | 377 | ||||
-rw-r--r-- | Master/tlpkg/tlgs/Resource/Init/pdf_rbld.ps | 22 | ||||
-rw-r--r-- | Master/tlpkg/tlgs/Resource/Init/pdf_sec.ps | 50 |
15 files changed, 1036 insertions, 1311 deletions
diff --git a/Master/tlpkg/tlgs/Resource/Init/gs_dps.ps b/Master/tlpkg/tlgs/Resource/Init/gs_dps.ps index cad7056230d..3ebd0a33172 100644 --- a/Master/tlpkg/tlgs/Resource/Init/gs_dps.ps +++ b/Master/tlpkg/tlgs/Resource/Init/gs_dps.ps @@ -70,7 +70,7 @@ % Save a copy of the initial gstate. //systemdict /savedinitialgstate gstate readonly .forceput .setglobal -} .bind executeonly def % must be bound and hidden for .forceput +} .bind def % Initialize local dictionaries and gstate when creating a new context. % Note that until this completes, we are in the anomalous situation of diff --git a/Master/tlpkg/tlgs/Resource/Init/gs_fntem.ps b/Master/tlpkg/tlgs/Resource/Init/gs_fntem.ps index 3ceee18d396..0f7c3153a7b 100644 --- a/Master/tlpkg/tlgs/Resource/Init/gs_fntem.ps +++ b/Master/tlpkg/tlgs/Resource/Init/gs_fntem.ps @@ -408,7 +408,7 @@ currentdict end def exit } loop exch setglobal -} .bind executeonly def % must be bound and hidden for .forceput +} bind def currentdict end /ProcSet defineresource pop diff --git a/Master/tlpkg/tlgs/Resource/Init/gs_init.ps b/Master/tlpkg/tlgs/Resource/Init/gs_init.ps index cac0e37c239..6c8da532ca0 100644 --- a/Master/tlpkg/tlgs/Resource/Init/gs_init.ps +++ b/Master/tlpkg/tlgs/Resource/Init/gs_init.ps @@ -29,7 +29,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! -924 +923 % Check the interpreter revision. dup revision ne @@ -767,6 +767,23 @@ userdict /.currentresourcefile //null put { /run .systemvar exec } .execasresource } bind def +% Define procedures for getting and setting the current device resolution. + +/gsgetdeviceprop % <device> <propname> gsgetdeviceprop <value> + { 2 copy mark exch //null .dicttomark .getdeviceparams + dup mark eq % if true, not found + { pop dup /undefined signalerror } + { 5 1 roll pop pop pop pop } + ifelse + } bind def +/gscurrentresolution % - gscurrentresolution <[xres yres]> + { currentdevice /HWResolution gsgetdeviceprop + } bind def +/gssetresolution % <[xres yres]> gssetresolution - + { 2 array astore mark exch /HWResolution exch + currentdevice copydevice putdeviceprops setdevice + } bind def + % Define auxiliary procedures needed for the above. /shellarguments % -> shell_arguments true (or) false { /ARGUMENTS where @@ -1504,14 +1521,6 @@ setpacking dup 150 lt //systemdict /DITHERPPI known not and } bind def -/.gsgetdeviceprop % <device> <propname> gsgetdeviceprop <value> - { 2 copy mark exch //null .dicttomark .getdeviceparams - dup mark eq % if true, not found - { pop dup /undefined signalerror } - { 5 1 roll pop pop pop pop } - ifelse - } bind def - % The following implementation uses LL2 extensions, but only in stopped % contexts so that with LL1, the .set??reshalftone will be used. % @@ -1519,7 +1528,7 @@ setpacking % false /.getdefaulthalftone { % try the device to see if it has a default halftone - { currentdevice /HalftoneDefault //.gsgetdeviceprop exec } .internalstopped + { currentdevice /HalftoneDefault gsgetdeviceprop } .internalstopped { pop pop //false } % no device property { dup type /dicttype eq { //true } { pop //false } ifelse } ifelse @@ -1532,7 +1541,6 @@ setpacking } if } bind def -currentdict /.gsgetdeviceprop .forceundef /.setdefaulthalftone { .getdefaulthalftone @@ -2004,30 +2012,15 @@ systemdict /EPSBoundingBoxInit known { EPSBoundingBoxInit } if .currentglobal //true .setglobal /SAFETY 2 dict dup /safe //false put - dup /tempfiles 10 dict noaccess put + dup /tempfiles 10 dict readonly put readonly def .setglobal -/tempfilepaths -[ - (TMPDIR) getenv not - { - (TEMP) getenv not - { - (TMP) getenv not - { - (/temp) (/tmp) - } if - } if - } if -] def - /.locksafe_userparams { SAFETY /safe get not { << /PermitFileReading [ currentuserparams /PermitFileReading get aload pop - //tempfilepaths aload pop /FONTPATH .systemvar (*) .generate_dir_list_templates % Library files : /LIBPATH .systemvar (*) .generate_dir_list_templates @@ -2043,22 +2036,12 @@ readonly def concatstrings concatstrings .generate_dir_list_templates } if ] - /PermitFileWriting [ - currentuserparams /PermitFileWriting get aload pop - //tempfilepaths aload pop - ] - /PermitFileControl [ - currentuserparams /PermitFileControl get aload pop - //tempfilepaths aload pop - ] /LockFilePermissions //true >> setuserparams } if } bind def -currentdict /tempfilepaths undef - /.locksafe { .locksafe_userparams systemdict /getenv {pop //false} .forceput @@ -2120,145 +2103,151 @@ currentdict /tempfilepaths undef .locksafeglobal } bind executeonly odef -% If we are running in SAFER mode, lock things down -SAFER { .setsafeglobal } if - -/SAFERUndefinePostScriptOperators { - [ - % 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 - /.setdotlength % Bug687720.ps - /.sort /.setdebug /.mementolistnewblocks /getenv - - /.makeoperator /.setCPSImode % gs_cet.ps, this won't work on cluster with -dSAFER +/deletefile { + dup { deletefile } stopped { + pop //deletefile $error /errorname get signalerror + } { + % deletefile succeeded. Remove from tempfile list if present + //SAFETY /tempfiles get exch cvn 2 copy known { + .forceundef + } { + pop pop + } + ifelse + } + ifelse +} .bind executeonly odef - /unread - ] - {systemdict exch .forceundef} forall +% If a file is opened with .tempfile with SAFER not (yet) set, +% the file can be deleted later, even if SAFER is set. +/.tempfile { + .tempfile % filename file + //SAFETY /tempfiles get 2 .argindex //true .forceput +} .bind executeonly odef - //systemdict /SAFERUndefinePostScriptOperators .forceundef -} .bind executeonly def % must be bound and hidden for .forceundef +% If we are running in SAFER mode, lock things down +SAFER { .setsafeglobal } if /UndefinePostScriptOperators { - %% This list is of Display PostScript operators. We believe that Display PostScript - %% was never fully implemented and the only known user, GNUStep, is no longer - %% using it. So lets remove it. - [ - /condition /currentcontext /detach /.fork /join /.localfork /lock /monitor /notify - /wait /yield /.currentscreenphase /.setscreenphase /.image2 /eoviewclip /initviewclip - /viewclip /viewclippath /defineusername - %% NeXT DPS extensions - /currentalpha /setalpha /.alphaimage /composite /compositerect /dissolve /sizeimagebox /.sizeimageparams - ] - {systemdict exch .forceundef} forall - - %% This list is of operators which no longer appear to be used, and which we do not believe - %% to have any real use. For now we will undefine the operstors so they cannot easily be used - %% but can be easily restored (just delete the name from the list in the array). In future - %% we may remove the operator and the code implementation entirely. - [ - /.bitadd /.charboxpath /.cond /.countexecstack /.execstack /.runandhide /.popdevicefilter - /.execfile /.filenamesplit /.file_name_parent - /.setdefaultmatrix /.isprocfilter /.unread /.psstringencode - /.buildsampledfunction /.isencapfunction /.currentaccuratecurves /.currentcurvejoin /.currentdashadapt /.currentdotlength - /.currentlimitclamp /.dotorientation /.setaccuratecurves /.setcurvejoin /.setdashadapt /.setdotorientation - /.setlimitclamp /.currentscreenlevels /.dashpath /.pathbbox /.identeq /.identne /.tokenexec /.forgetsave /.pantonecallback - - %% Used by our own test suite files - %%/.setdotlength % Bug687720.ps - ] - {systemdict exch .forceundef} forall - - %% This list of operators are used internally by various parts of the Ghostscript startup code. - %% Since each operator is a potential security vulnerability, and any operator listed here - %% is not required once the initislisation is complete and functions are bound, we undefine - %% the ones that aren't needed at runtime. - [ - /.callinstall /.callbeginpage /.callendpage - /.currentstackprotect /.setstackprotect /.errorexec /.finderrorobject /.installsystemnames /.bosobject /.fontbbox - /.type1execchar /.type2execchar /.type42execchar /.setweightvector /.getuseciecolor /processcolors /.includecolorspace - /.execn /.instopped /.stop /.stopped /.setcolorrendering /.setdevicecolorrendering /.buildcolorrendering1 /.builddevicecolorrendering1 - /.TransformPQR_scale_WB0 /.TransformPQR_scale_WB1 /.TransformPQR_scale_WB2 /.currentoverprintmode /.copydevice2 - /.devicename /.doneshowpage /.getbitsrect /.getdevice /.getdefaultdevice /.getdeviceparams /.gethardwareparams - /makewordimagedevice /.outputpage /.putdeviceparams /.setdevice /.currentshowpagecount - /.setpagedevice /.currentpagedevice /.knownundef /.setmaxlength /.rectappend /.initialize_dsc_parser /.parse_dsc_comments - /.fillCIDMap /.fillIdentityCIDMap /.buildcmap /.filenamelistseparator /.libfile /.getfilename - /.file_name_combine /.file_name_is_absolute /.file_name_separator /.file_name_directory_separator /.file_name_current /.filename - /.peekstring /.writecvp /.subfiledecode /.setupUnicodeDecoder /.jbig2makeglobalctx /.registerfont /.parsecff - /.getshowoperator /.getnativefonts /.beginform /.endform /.get_form_id /.repeatform /.reusablestream /.rsdparams - /.buildfunction /.currentfilladjust2 /.setfilladjust2 /.sethpglpathmode /.currenthpglpathmode - /.currenthalftone /.sethalftone5 /.image1 /.imagemask1 /.image3 /.image4 - /.getiodevice /.getdevparms /.putdevparams /.bbox_transform /.matchmedia /.matchpagesize /.defaultpapersize - /.oserrno /.setoserrno /.oserrorstring /.getCPSImode - /.getscanconverter /.setscanconverter /.type1encrypt /.type1decrypt/.languagelevel /.setlanguagelevel /.eqproc /.fillpage /.buildpattern1 /.saslprep - /.buildshading1 /.buildshading2 /.buildshading3 /.buildshading4 /.buildshading5 /.buildshading6 /.buildshading7 /.buildshadingpattern - /.shfill /.argindex /.bytestring /.namestring /.stringbreak /.stringmatch /.globalvmarray /.globalvmdict /.globalvmpackedarray /.globalvmstring - /.localvmarray /.localvmdict /.localvmpackedarray /.localvmstring /.systemvmarray /.systemvmdict /.systemvmpackedarray /.systemvmstring /.systemvmfile /.systemvmlibfile - /.systemvmSFD /.settrapparams /.currentsystemparams /.currentuserparams /.getsystemparam /.getuserparam /.setsystemparams /.setuserparams - /.checkpassword /.locale_to_utf8 /.currentglobal /.gcheck /.imagepath - - % Used by a free user in the Library of Congress. Apparently this is used to - % draw a partial page, which is then filled in by the results of a barcode - % scanner and SQL database lookup. Its not clear to us exactly why this needs to be - % done as a partial page, but its easiest to restore the operator, and it seems like - % its a reasonably safe operator to restore, for the *very* few devices on which - % it will have any effect. Currently this uses the 'sync_outptu' device method - % to transfer the partial page, in future we may use a spec_op instead. - %/flushpage - - % Used by our own test suite files - %/.fileposition %image-qa.ps - %/.makeoperator /.setCPSImode % gs_cet.ps - - % Either our code uses these in ways which mean they can't be undefined, or they are used directly by - % test files/utilities, or engineers expressed a desire to keep them visible. - % - %/currentdevice /.sort /.buildfont0 /.buildfont1 /.buildfont2 /.buildfont3 /.buildfont4 /.buildfont9 /.buildfont10 /.buildfont11 - %/.buildfotn32 /.buildfont42 /.type9mapcid /.type11mapcid /.swapcolors - %/currentdevice /.quit /.setuseciecolor /.needinput /.setoverprintmode /.special_op /.dicttomark /.knownget - %/.FAPIavailable /.FAPIpassfont /.FAPIrebuildfont /.FAPIBuildGlyph /.FAPIBuildChar /.FAPIBuildGlyph9 - %/.tempfile /.numicc_components /.set_outputintent /.max /.min /.vmreclaim /.getpath /.setglobal - %/.setdebug /.mementolistnewblocks /getenv - ] - {systemdict exch .forceundef} forall - - //systemdict /UndefinePostScriptOperators .forceundef -} .bind executeonly def % must be bound and hidden for .forceundef +%% This list is of Display PostScript operators. We believe that Display PostScript +%% was never fully implemented and the only known user, GNUStep, is no longer +%% using it. So lets remove it. +[ +/condition /currentcontext /detach /.fork /join /.localfork /lock /monitor /notify +/wait /yield /.currentscreenphase /.setscreenphase /.image2 /eoviewclip /initviewclip +/viewclip /viewclippath /defineusername +%% NeXT DPS extensions +/currentalpha /setalpha /.alphaimage /composite /compositerect /dissolve /sizeimagebox /.sizeimageparams +] +{systemdict exch .forceundef} forall + +%% This list is of operators which no longer appear to be used, and which we do not believe +%% to have any real use. For now we will undefine the operstors so they cannot easily be used +%% but can be easily restored (just delete the name from the list in the array). In future +%% we may remove the operator and the code implementation entirely. +[ +/.bitadd /.charboxpath /.cond /.countexecstack /.execstack /.runandhide /.popdevicefilter +/.execfile /.filenamesplit /.file_name_parent +/.setdefaultmatrix /.isprocfilter /.unread /.psstringencode +/.buildsampledfunction /.isencapfunction /.currentaccuratecurves /.currentcurvejoin /.currentdashadapt /.currentdotlength +/.currentlimitclamp /.dotorientation /.setaccuratecurves /.setcurvejoin /.setdashadapt /.setdotorientation +/.setlimitclamp /.currentscreenlevels /.dashpath /.pathbbox /.identeq /.identne /.tokenexec /.forgetsave /.pantonecallback + +%% Used by our own test suite files +%%/.setdotlength % Bug687720.ps +] +{systemdict exch .forceundef} forall + +%% This list of operators are used internally by various parts of the Ghostscript startup code. +%% Since each operator is a potential security vulnerability, and any operator listed here +%% is not required once the initislisation is complete and functions are bound, we undefine +%% the ones that aren't needed at runtime. +[ +/.callinstall /.callbeginpage /.callendpage +/.currentstackprotect /.setstackprotect /.errorexec /.finderrorobject /.installsystemnames /.bosobject /.fontbbox +/.type1execchar /.type2execchar /.type42execchar /.setweightvector /.getuseciecolor /processcolors /.includecolorspace +/.execn /.instopped /.stop /.stopped /.setcolorrendering /.setdevicecolorrendering /.buildcolorrendering1 /.builddevicecolorrendering1 +/.TransformPQR_scale_WB0 /.TransformPQR_scale_WB1 /.TransformPQR_scale_WB2 /.currentoverprintmode /.copydevice2 +/.devicename /.doneshowpage /.getbitsrect /.getdevice /.getdefaultdevice /.getdeviceparams /.gethardwareparams +/makewordimagedevice /.outputpage /.putdeviceparams /.setdevice /.currentshowpagecount +/.setpagedevice /.currentpagedevice /.knownundef /.setmaxlength /.rectappend /.initialize_dsc_parser /.parse_dsc_comments +/.fillCIDMap /.fillIdentityCIDMap /.buildcmap /.filenamelistseparator /.libfile /.getfilename +/.file_name_combine /.file_name_is_absolute /.file_name_separator /.file_name_directory_separator /.file_name_current /.filename +/.peekstring /.writecvp /.subfiledecode /.setupUnicodeDecoder /.jbig2makeglobalctx /.registerfont /.parsecff +/.getshowoperator /.getnativefonts /.beginform /.endform /.get_form_id /.repeatform /.reusablestream /.rsdparams +/.buildfunction /.currentfilladjust2 /.setfilladjust2 /.sethpglpathmode /.currenthpglpathmode +/.currenthalftone /.sethalftone5 /.image1 /.imagemask1 /.image3 /.image4 +/.getiodevice /.getdevparms /.putdevparams /.bbox_transform /.matchmedia /.matchpagesize /.defaultpapersize +/.oserrno /.setoserrno /.oserrorstring /.getCPSImode +/.getscanconverter /.setscanconverter /.type1encrypt /.type1decrypt/.languagelevel /.setlanguagelevel /.eqproc /.fillpage /.buildpattern1 /.saslprep +/.buildshading1 /.buildshadin2 /.buildshading3 /.buildshading4 /.buildshading5 /.buildshading6 /.buildshading7 /.buildshadingpattern +/.argindex /.bytestring /.namestring /.stringbreak /.stringmatch /.globalvmarray /.globalvmdict /.globalvmpackedarray /.globalvmstring +/.localvmarray /.localvmdict /.localvmpackedarray /.localvmstring /.systemvmarray /.systemvmdict /.systemvmpackedarray /.systemvmstring /.systemvmfile /.systemvmlibfile +/.systemvmSFD /.settrapparams /.currentsystemparams /.currentuserparams /.getsystemparam /.getuserparam /.setsystemparams /.setuserparams +/.checkpassword /.locale_to_utf8 /.currentglobal /.gcheck /.imagepath + +% Used by a free user in the Library of Congress. Apparently this is used to +% draw a partial page, which is then filled in by the results of a barcode +% scanner and SQL database lookup. Its not clear to us exactly why this needs to be +% done as a partial page, but its easiest to restore the operator, and it seems like +% its a reasonably safe operator to restore, for the *very* few devices on which +% it will have any effect. Currently this uses the 'sync_outptu' device method +% to transfer the partial page, in future we may use a spec_op instead. +%/flushpage + +% Used by our own test suite files +%/.fileposition %image-qa.ps +%/.makeoperator /.setCPSImode % gs_cet.ps + +% Either our code uses these in ways which mean they can't be undefined, or they are used directly by +% test files/utilities, or engineers expressed a desire to keep them visible. +% +%/currentdevice /.sort /.buildfont0 /.buildfont1 /.buildfont2 /.buildfont3 /.buildfont4 /.buildfont9 /.buildfont10 /.buildfont11 +%/.buildfotn32 /.buildfont42 /.type9mapcid /.type11mapcid /.swapcolors +%/currentdevice /.quit /.setuseciecolor /.needinput /.setoverprintmode /.special_op /.dicttomark /.knownget +%/.FAPIavailable /.FAPIpassfont /.FAPIrebuildfont /.FAPIBuildGlyph /.FAPIBuildChar /.FAPIBuildGlyph9 +%/.tempfile /.numicc_components /.set_outputintent /.max /.min /.shfill /.vmreclaim /.getpath /.setglobal +%/.setdebug /.mementolistnewblocks /getenv +] +{systemdict exch .forceundef} forall + +//systemdict /UndefinePostScriptOperators .forceundef +} bind def /UndefinePDFOperators { - %% This list of operators are used internally by various parts of the Ghostscript PDF interpreter. - %% Since each operator is a potential security vulnerability, and any operator listed here - %% is not required once the initislisation is complete and functions are bound, we undefine - %% the ones that aren't needed at runtime. - %% This function is only called if DELAYBIND is true. It is a copy of the code at the end of pdf_main.ps - %% and must be maintained in parallel with it. - [ - /.pdfawidthshow /.pdfwidthshow /.currentblackptcomp /.setblackptcomp - /.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 - - % undefining these causes errors/incorrect output - %/.settextrenderingmode /.setblendmode /.begintransparencygroup /.settextknockout /check_r6_password /.setstrokeoverprint /.setfilloverprint - %/.currentstrokeoverprint /.currentfilloverprint /.currentfillconstantalpha /.currentstrokeconstantalpha - ] - {systemdict exch .forceundef} forall - //systemdict /UndefinePDFOperators .forceundef -} .bind executeonly def % must be bound and hidden for .forceundef +%% This list of operators are used internally by various parts of the Ghostscript PDF interpreter. +%% Since each operator is a potential security vulnerability, and any operator listed here +%% is not required once the initislisation is complete and functions are bound, we undefine +%% the ones that aren't needed at runtime. +[ +/.pdfawidthshow /.pdfwidthshow /.currentblackptcomp /.setblackptcomp +/.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 + +% 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 +%/.settextrenderingmode /.setblendmode /.begintransparencygroup /.settextknockout /check_r6_password /.setstrokeoverprint /.setfilloverprint +%/.currentstrokeoverprint /.currentfilloverprint /.currentfillconstantalpha /.currentstrokeconstantalpha +] +{systemdict exch .forceundef} forall +//systemdict /UndefinePDFOperators .forceundef +} bind def % If we delayed binding, make it possible to do it later. /.bindnow { @@ -2273,11 +2262,8 @@ SAFER { .setsafeglobal } if //systemdict /.delaybind {} .forceput % reclaim the space //systemdict /.bindnow .forceundef % ditto put - SAFER { - //systemdict /SAFERUndefinePostScriptOperators get exec - } if - //systemdict /UndefinePostScriptOperators get exec - //systemdict /UndefinePDFOperators get exec +% //systemdict /UndefinePostScriptOperators get exec +% //systemdict /UndefinePDFOperators get exec //systemdict /.forcecopynew .forceundef % remove temptation //systemdict /.forcedef .forceundef % ditto //systemdict /.forceput .forceundef % ditto @@ -2389,9 +2375,6 @@ currentdict /.renderingintentdict .undef %% If we are using DELAYBIND we have to defer the undefinition %% until .bindnow. DELAYBIND not { - SAFER { - //systemdict /SAFERUndefinePostScriptOperators get exec - } if //systemdict /UndefinePostScriptOperators get exec //systemdict /UndefinePDFOperators .forceundef } if @@ -2402,7 +2385,6 @@ end { pop NOGC not { 2 .vmreclaim 0 vmreclaim } if } if DELAYBIND not { - systemdict /.bindnow .undef % We only need this for DELAYBIND systemdict /.forcecopynew .undef % remove temptation systemdict /.forcedef .undef % ditto systemdict /.forceput .undef % ditto diff --git a/Master/tlpkg/tlgs/Resource/Init/gs_lev2.ps b/Master/tlpkg/tlgs/Resource/Init/gs_lev2.ps index eee0b9f6175..72c11edb4a1 100644 --- a/Master/tlpkg/tlgs/Resource/Init/gs_lev2.ps +++ b/Master/tlpkg/tlgs/Resource/Init/gs_lev2.ps @@ -163,8 +163,7 @@ end % Set them again to the new values. From here on, we are safe, % since a context switch will consult userparams. .setuserparams -} .bind executeonly def % must be bound and hidden for .forceput - +} .bind def /setuserparams { % <dict> setuserparams - .setuserparams2 } .bind odef @@ -1073,10 +1072,10 @@ def % the values given into an array. This is consistent with what we see when % testing with Adobe Distiller 6.0. % <cyan> <magenta> <yellow> <black> <key> findcmykcustomcolor <array> -/findcmykcustomcolor { 5 array astore } bind executeonly def +/findcmykcustomcolor { 5 array astore } bind def % The following isn't documented by Adobe, but was found in Adobe Illustrator (R) % Version 7.0 Full Prolog -/findrgbcustomcolor { 4 array astore } bind executeonly def +/findrgbcustomcolor { 4 array astore } bind def % Build a tint transform function for use by setcustomcolor. This function % is for a Separation color space which has either a DeviceCMYK base color space @@ -1105,7 +1104,7 @@ def ] } ifelse cvx bind exch pop % Make executable and remove the input array -} bind executeonly def +} bind def % Construct the colorspace array to be used by setcolorspace from the array % result of either findcmykcustomcolor or findrgbcustomcolor. @@ -1125,7 +1124,7 @@ def ] } ifelse exch pop % remove the input array -} bind executeonly def +} bind def % Set a custom color based upon a tint and array which describes the custom % color. See findcmykcustomcolor. First we create and then set a Separation @@ -1134,51 +1133,14 @@ def % for some reason, so an alternate operational mode is tolerated: % null setcustomcolor - /setcustomcolor % <array> <tint> setcustomcolor - -{ - dup //null eq { - pop pop - }{ - % Check that the tint is a number between 0 and 1 - dup type dup /integertype eq exch /realtype eq or not { - /setcustomcolor /typecheck cvx signalerror - } if - dup 1 le not { - /setcustomcolor /rangecheck cvx signalerror - } if - dup 0 ge not { - /setcustomcolor /rangecheck cvx signalerror - } if - - % The array is supposed to be the result of fundcmykcustomcolor. Our - % implementation just pushes all the arguments into the array and that's - % what buildcolorspacearray expects. So check that now. - % Starting with the first N-1 elemenst which must be numbers where 0 <= x <= 1 - 1 index - 0 1 2 index length 2 sub - { - 1 index exch get dup - type dup /integertype eq exch /realtype eq or not { - /setcustomcolor /typecheck cvx signalerror - } if - dup - 1 le not { - /setcustomcolor /rangecheck cvx signalerror - } if - 0 ge not { - /setcustomcolor /rangecheck cvx signalerror - } if - } for - - % Finally, check the last element of the array, which must be a string. - dup length 1 sub get type /stringtype eq not { - /setcustomcolor /typecheck cvx signalerror - } if - +{ dup //null ne { exch //buildcolorspacearray exec setcolorspace % Set the Separation color space as current setcolor % Set the tint as the current color - } ifelse -} bind executeonly def + } + { pop pop } % 'null' as the tint is ignored. pop tint and array + ifelse +} bind def % This proc is supposed to implement a version of overprinting. TN 5044 says % that this proc is not used by any shipping host-based application. We have diff --git a/Master/tlpkg/tlgs/Resource/Init/gs_ll3.ps b/Master/tlpkg/tlgs/Resource/Init/gs_ll3.ps index 1d37e536165..5aa56a36833 100644 --- a/Master/tlpkg/tlgs/Resource/Init/gs_ll3.ps +++ b/Master/tlpkg/tlgs/Resource/Init/gs_ll3.ps @@ -440,11 +440,6 @@ systemdict /.reuseparamdict mark /shfill .systemvar /undefined signalerror } ifelse } bind def - -/.buildshading_and_shfill { - .buildshading .shfill -} bind def - systemdict /.reuseparamdict undef /.buildpattern2 { % <template> <matrix> .buildpattern2 @@ -469,7 +464,7 @@ systemdict /.reuseparamdict undef % Currently, .shfill requires that the color space % in the pattern be the current color space. % Disable overprintmode for shfill - { dup gsave 0 .setoverprintmode .buildshading_and_shfill } stopped + { dup gsave 0 .setoverprintmode .buildshading .shfill } stopped grestore { /$error .systemvar /errorinfo 2 copy known { pop pop diff --git a/Master/tlpkg/tlgs/Resource/Init/gs_pdfwr.ps b/Master/tlpkg/tlgs/Resource/Init/gs_pdfwr.ps index fb1c4191c4d..3da5306223e 100644 --- a/Master/tlpkg/tlgs/Resource/Init/gs_pdfwr.ps +++ b/Master/tlpkg/tlgs/Resource/Init/gs_pdfwr.ps @@ -197,7 +197,7 @@ languagelevel 2 .setlanguagelevel /ColorConversionStrategy /UseDeviceIndependentColor /ColorImageDownsampleType /Average /ColorImageResolution 300 - /CompatibilityLevel 1.7 + /CompatibilityLevel 1.5 /CreateJobTicket //true /DoThumbnails //false /EmbedAllFonts //true @@ -224,7 +224,7 @@ languagelevel 2 .setlanguagelevel /ColorConversionStrategy /LeaveColorUnchanged /ColorImageDownsampleType /Bicubic /ColorImageResolution 300 - /CompatibilityLevel 1.7 + /CompatibilityLevel 1.5 /CreateJobTicket //true /DoThumbnails //true /EmbedAllFonts //true @@ -660,7 +660,8 @@ currentdict /.pdfmarkparams .undef { pop } ifelse -} .bind executeonly def % must be bound and hidden for .forceput +} +bind def % Use the DSC processing hook to pass DSC comments to the driver. % We use a pseudo-parameter named DSC whose value is an array: diff --git a/Master/tlpkg/tlgs/Resource/Init/gs_setpd.ps b/Master/tlpkg/tlgs/Resource/Init/gs_setpd.ps index bba3c8c0e10..0fc72300f39 100644 --- a/Master/tlpkg/tlgs/Resource/Init/gs_setpd.ps +++ b/Master/tlpkg/tlgs/Resource/Init/gs_setpd.ps @@ -204,8 +204,8 @@ level2dict begin mark % First put the device's default page size in slot 0 % This satifies those that have devices built with a4 as the default - 0 mark /PageSize /GetDeviceParam .special_op - not {/setpagedevice .systemvar /configurationerror signalerror} if .dicttomark + 0 mark /PageSize currentdevice /PageSize gsgetdeviceprop .dicttomark + % Only populate the other entries if we aren't FIXEDMEDIA FIXEDMEDIA not { statusdict /.pagetypenames get { @@ -624,7 +624,7 @@ SETPDDEBUG { (Rolling back.) = pstack flush } if { 4 index 3 1 roll .forceput } { 3 index exch .undef } ifelse - } .bind executeonly % must be bound and hidden for .forceput + } .bind 7 { % For PageSize only, just impose the request. 1 index /PageSize eq { pop pop 1 index /PageSize 7 put } diff --git a/Master/tlpkg/tlgs/Resource/Init/gs_typ32.ps b/Master/tlpkg/tlgs/Resource/Init/gs_typ32.ps index b6600b0ce81..747196f48c8 100644 --- a/Master/tlpkg/tlgs/Resource/Init/gs_typ32.ps +++ b/Master/tlpkg/tlgs/Resource/Init/gs_typ32.ps @@ -85,7 +85,7 @@ systemdict /.removeglyphs .undef { dup /FontType 32 .forceput dup /CharStrings 20 dict .forceput 1 index exch .buildfont32 exch pop -} .bind executeonly def % must be bound and hidden for .forceput +} bind def end % .cidfonttypes diff --git a/Master/tlpkg/tlgs/Resource/Init/pdf_base.ps b/Master/tlpkg/tlgs/Resource/Init/pdf_base.ps index a82a2a3adfc..0218bab0a1e 100644 --- a/Master/tlpkg/tlgs/Resource/Init/pdf_base.ps +++ b/Master/tlpkg/tlgs/Resource/Init/pdf_base.ps @@ -28,14 +28,14 @@ pdfdict begin % Define the name interpretation dictionary for reading values. /valueopdict mark - (<<) cvn { mark } bind executeonly % don't push an actual mark! + (<<) cvn { mark } bind % don't push an actual mark! (>>) cvn { { .dicttomark } stopped { ( **** Error: File has an unbalanced >> \(close dictionary\).\n) pdfformaterror ( Output may be incorrect.\n) pdfformaterror } if - } bind executeonly - ([) cvn { mark } bind executeonly % ditto + } bind + ([) cvn { mark } bind % ditto (]) cvn dup load % /true true % see .pdfexectoken below % /false false % ibid. @@ -62,7 +62,7 @@ pdfdict begin pop } ifelse } if -} bind executeonly def +} bind def /name#escape % <post> <(#)> <pre> name#escape <string> { exch pop 1 index 2 () /SubFileDecode filter dup (x) readhexstring @@ -77,7 +77,7 @@ pdfdict begin exch 2 1 index length 2 sub getinterval } ifelse (#) search { name#escape } if concatstrings -} bind executeonly def +} bind def /num-chars-dict mark (0123456789-.) {dup} forall .dicttomark readonly def @@ -124,7 +124,7 @@ pdfdict begin pop pop count exch sub { pop } repeat % pop all the operands } if ( Output may be incorrect.\n) pdfformaterror -} bind executeonly def +} bind def currentdict /num-chars-dict .undef @@ -218,7 +218,7 @@ currentdict /num-chars-dict .undef } ifelse } ifelse } ifelse -} bind executeonly def +} bind def /PDFScanRules_true << /PDFScanRules //true >> def /PDFScanRules_null << /PDFScanRules //null >> def /.pdfrun { % <file> <opdict> .pdfrun - @@ -278,7 +278,7 @@ currentdict /num-chars-dict .undef .packtomark cvx % file { { {cnt <<>> file ... } loop } stopped /PDFsource PDFsource store {...} if} /PDFsource 3 -1 roll store % {...} exec -} bind executeonly def +} bind def % Execute a file, like .pdfrun, for a marking context. % This temporarily rebinds LocalResources and DefaultQstate. @@ -289,7 +289,7 @@ currentdict /num-chars-dict .undef 3 .execn /DefaultQstate exch store /LocalResources exch store -} bind executeonly def +} bind def % Get the depth of the PDF operand stack. The caller sets pdfemptycount % before calling .pdfrun or .pdfruncontext. It is initially set by @@ -298,7 +298,7 @@ currentdict /num-chars-dict .undef % of .pdfrun{context} which have not been checked for opstack depth. /.pdfcount { % - .pdfcount <count> count pdfemptycount sub -} bind executeonly def +} bind def % Read a token, but simply return false (no token read) in the case of an % error. This is messy because 'token' either may or may not pop its operand @@ -306,12 +306,12 @@ currentdict /num-chars-dict .undef % on whether the source is a file or a string. To avoid closing the file % check for '{' before trying 'token'. /token_nofail_dict mark - ( ) { dup ( ) readstring pop pop } bind executeonly + ( ) { dup ( ) readstring pop pop } bind (\t) 1 index (\r) 1 index (\n) 1 index (\000) 1 index - ({) { //null //true exit } bind executeonly + ({) { //null //true exit } bind .dicttomark def /token_nofail { % <file|string> token_nofail false @@ -341,7 +341,7 @@ currentdict /num-chars-dict .undef ifelse } ifelse } ifelse -} bind executeonly def +} bind def currentdict /token_nofail_dict .undef @@ -384,7 +384,7 @@ currentdict /token_nofail_dict .undef /GlobalObjects 20 dict def .setglobal /IsGlobal 0 string def -} bind executeonly def +} bind def % Grow the tables to a specified size. /growPDFobjects { % <minsize> growPDFobjects - @@ -401,7 +401,7 @@ currentdict /token_nofail_dict .undef dup IsGlobal exch string dup 3 1 roll copy pop /IsGlobal exch def } if pop -} bind executeonly def +} bind def % We represent an unresolved object reference by a procedure of the form % {obj# gen# resolveR}. This is not a possible PDF object, because PDF has @@ -429,7 +429,7 @@ currentdict /token_nofail_dict .undef } { % Else object is not executable. exch pop //true % Therefore it must have been resolved. } ifelse -} bind executeonly def +} bind def /oforce /exec load def /oget { % <array> <index> oget <object> % <dict> <key> oget <object> @@ -437,15 +437,15 @@ currentdict /token_nofail_dict .undef % object back into the referring slot. In order to support % PDF linearization, we no longer do this. get oforce -} bind executeonly def +} bind def /oforce_array { % <array> oforce_array <array> [ exch { oforce } forall ] -} bind executeonly def +} bind def /oforce_elems { % <array> oforce_elems <first> ... <last> { oforce } forall -} bind executeonly def +} bind def %% Safe recursion maintain a dicitonary in which we record all the object numbers %% of objects which we resolve. Whenever it resolves a new one, it checks all the @@ -485,11 +485,11 @@ currentdict /token_nofail_dict .undef << exch 2 index <<>> copy exch { 3 -1 roll exch safe_recursive 3 -1 roll oforce 3 1 roll exch } forall pop>> } if } ifelse -} bind executeonly def +} bind def /oforce_recursive { << >> exch safe_recursive exch pop -} bind executeonly def +} bind def % A null value in a dictionary is equivalent to an omitted key; % we must check for this specially. @@ -501,26 +501,26 @@ currentdict /token_nofail_dict .undef } { //false } ifelse -} bind executeonly def +} bind def % See /knownoget above. /oknown { % <dict> <key> oknown <bool> .knownget { oforce //null ne } { //false } ifelse -} bind executeonly def +} bind def /knownogetdict { % <dict> <key> knownogetdict <dict> true % <dict> <key> knownogetdict false //knownoget exec dup { 1 index type /dicttype ne { pop pop //false } if } if -} bind executeonly def +} bind def % PDF 1.1 defines a 'foreign file reference', but not its meaning. % Per the specification, we convert these to nulls. /F { % <file#> <object#> <generation#> F <object> % Some PDF 1.1 files use F as a synonym for f! .pdfcount 3 lt { f } { pop pop pop //null } ifelse -} bind executeonly def +} bind def % Verify the generation number for a specified object % Note: The values in Generations is the generation number plus 1. @@ -550,7 +550,7 @@ currentdict /token_nofail_dict .undef % Ghostscript tolerant of of bad generation numbers. //true } ifelse -} bind executeonly def +} bind def /R { % <object#> <generation#> R <object> %% Parameter validation; this should not be required but we have found files %% (Bug 697351) which are corrupted in ways that mean we see a 'R' in a stream @@ -567,7 +567,7 @@ currentdict /token_nofail_dict .undef ( **** Error: indirect object reference \(R\) encountered with invalid arguments.) pdfformaterror ( Output may be incorrect.\n) pdfformaterror } ifelse -} bind executeonly def +} bind def % If we encounter an object definition while reading sequentially, % we just store it away and keep going. @@ -578,7 +578,7 @@ currentdict /token_nofail_dict .undef /obj { % <object#> <generation#> obj <object> PDFfile objopdict .pdfrun -} bind executeonly def +} bind def /endobj { % <object#> <generation#> <object> endobj <object> @@ -631,19 +631,19 @@ currentdict /token_nofail_dict .undef pop pop //null } ifelse }ifelse -} bind executeonly def +} bind def % When resolving an object reference in an object stream, we stop at % the end of file. Note: Objects in an object stream do not have either % a starting 'obj' or and ending 'endobj'. /resolveobjstreamopdict mark valueopdict { } forall - (%%EOF) cvn { exit } bind executeonly + (%%EOF) cvn { exit } bind /endobj { % bug 689795 ( **** Error: Objects in an object stream should not have 'endobj'.\n) pdfformaterror ( Output may be incorrect.\n) pdfformaterror - } bind executeonly + } bind .dicttomark readonly def % Note: This version of this function is not currently being used. @@ -722,7 +722,7 @@ currentdict /token_nofail_dict .undef Objects exch 2 index exch put % Put object into Objects array } if pop pop pop pop % Clear stack -} bind executeonly def +} bind def /no_debug_dict << /PDFDEBUG //false @@ -792,7 +792,7 @@ currentdict /token_nofail_dict .undef pop % Remove loop index } for pop pop pop pop pop % Remove strm# objstream, N, (obj#], and [objects] -} bind executeonly def +} bind def currentdict /no_debug_dict undef @@ -803,26 +803,26 @@ currentdict /no_debug_dict undef ( **** Error: Encountered 'xref' while expecting 'endobj'.\n) pdfformaterror ( Treating this as a missing 'endobj', output may be incorrect.\n) pdfformaterror endobj exit - } bind executeonly + } bind /endstream { endobj exit } bind /endobj { endobj exit } bind /endjobj { % Bug 689876. ( **** Error: Operator 'endobj' is misspelled as 'endjobj'.\n) pdfformaterror ( Output may be incorrect.\n) pdfformaterror endobj exit - } bind executeonly + } bind /enbobj { % Bug 690397. ( **** Error: Operator 'endobj' is misspelled as 'enbobj'.\n) pdfformaterror ( Output may be incorrect.\n) pdfformaterror endobj exit - } bind executeonly + } bind /obj { % OmniForm generates PDF file with endobj missing in some % objects. AR ignores this. So we have to do it too. ( **** Error: Encountered 'obj' while expecting 'endobj'.\n) pdfformaterror ( Treating this as a missing 'endobj', output may be incorrect.\n) pdfformaterror pop pop endobj exit - } bind executeonly + } bind .dicttomark readonly def /resolveR { % <object#> <generation#> resolveR <object> @@ -896,7 +896,7 @@ currentdict /no_debug_dict undef } {exch pop} ifelse -} bind executeonly def +} bind def % ================================ Streams ================================ % @@ -1010,11 +1010,11 @@ currentdict /no_debug_dict undef } if } ifelse cvx -} bind executeonly def +} bind def /endstream { exit -} bind executeonly def +} bind def % Contrary to the published PDF (1.3) specification, Acrobat Reader % accepts abbreviated filter names everywhere, not just for in-line images, @@ -1053,7 +1053,7 @@ currentdict /no_debug_dict undef % No filters: ignore parameters, if any. pop //null { } } ifelse -} bind executeonly def +} bind def /filtername { % <filtername> filtername <filtername'> //unabbrevfilterdict 1 index .knownget { exch pop } if dup /Filter resourcestatus { pop pop } { @@ -1067,7 +1067,7 @@ currentdict /no_debug_dict undef % provide a filter that returns EOF (no data) /.EOFDecode } ifelse -} bind executeonly def +} bind def /pdf_rules_dict << /PDFRules //true >> readonly def @@ -1084,7 +1084,7 @@ currentdict /no_debug_dict undef //pdf_rules_dict exch } ifelse } if -} bind executeonly def +} bind def currentdict /pdf_rules_dict undef @@ -1114,7 +1114,7 @@ currentdict /pdf_rules_dict undef } ifelse } ifelse forall exch pop -} bind executeonly def +} bind def % JBIG2 streams have an optional 'globals' stream obj for % sharing redundant data between page images. Here we resolve @@ -1136,7 +1136,7 @@ currentdict /pdf_rules_dict undef 1 index exch /.jbig2globalctx exch put } if -} bind executeonly def +} bind def % Resolve a stream dictionary to a PostScript stream. % Streams with no filters require special handling: @@ -1197,17 +1197,17 @@ currentdict /pdf_rules_dict undef } ifelse % Stack: readdata? dict file exch pop exch pop -} bind executeonly def +} bind def % ============================ Name/number trees ============================ % /nameoget { % <nametree> <key> nameoget <obj|null> exch /Names exch .treeget -} bind executeonly def +} bind def /numoget { % <numtree> <key> numoget <obj|null> exch /Nums exch .treeget -} bind executeonly def +} bind def /.treeget { % <key> <leafkey> <tree> .treeget <obj|null> dup /Kids knownoget { @@ -1215,7 +1215,7 @@ currentdict /pdf_rules_dict undef } { exch oget .leafget } ifelse -} bind executeonly def +} bind def /.branchget { % <key> <leafkey> <kids> .branchget <obj|null> dup length 0 eq { @@ -1237,7 +1237,7 @@ currentdict /pdf_rules_dict undef } ifelse } ifelse } ifelse -} bind executeonly def +} bind def /.leafget { % <key> <pairs> .leafget <obj|null> dup length 2 eq { @@ -1249,57 +1249,7 @@ currentdict /pdf_rules_dict undef 3 index gt { 0 exch } { 1 index length 1 index sub } ifelse getinterval .leafget } ifelse -} bind executeonly def - -% The following variants return tree entry whose key is closest but -% less or equal to the given key. - -/numogetle { % <numtree> <key> numogetle <key obj true|false> - exch /Nums exch .treegetle -} bind executeonly def - -/.treegetle { % <key> <leafkey> <tree> .treegetle <key obj true|false> - dup /Kids knownoget { - exch pop .branchgetle - } { - exch oget .leafgetle - } ifelse -} bind executeonly def - -/.branchgetle { % <key> <leafkey> <kids> .branchgetle <key obj true|false> - dup length 0 eq { - pop pop pop false - } { - dup length -1 bitshift 2 copy oget - dup /Limits oget aload pop - % Stack: key leafkeyb kids mid kids[mid] min max - 6 index ge { - 5 index le { - exch pop exch pop .treegetle - } { - pop 0 exch getinterval .branchgetle - } ifelse - } { - pop 2 index length 2 index sub 1 gt { - pop 1 index length 1 index sub getinterval .branchgetle - } { - exch pop exch pop .treegetle - } ifelse - } ifelse - } ifelse -} bind executeonly def - -/.leafgetle { % <key> <pairs> .leafget <obj|null> - dup length 2 eq { - dup 0 get - 2 index le { exch pop aload pop true } { pop pop false } ifelse - } { - dup length -1 bitshift -2 and 2 copy oget - % Stack: key pairs mid pairs[mid] - 3 index gt { 0 exch } { 1 index length 1 index sub } ifelse - getinterval .leafgetle - } ifelse -} bind executeonly def +} bind def end % pdfdict .setglobal diff --git a/Master/tlpkg/tlgs/Resource/Init/pdf_draw.ps b/Master/tlpkg/tlgs/Resource/Init/pdf_draw.ps index d1b6ac909d3..e8ca213bbae 100644 --- a/Master/tlpkg/tlgs/Resource/Init/pdf_draw.ps +++ b/Master/tlpkg/tlgs/Resource/Init/pdf_draw.ps @@ -68,14 +68,14 @@ pdfdict begin % Stack: filepos fndict data exch dup /DataSource 4 -1 roll put exch PDFfile exch setfileposition -} bind executeonly def +} bdef /.resolvefn2 { dup length dict .copydict dup /C0 2 copy knownoget { put } { pop pop } ifelse dup /C1 2 copy knownoget { put } { pop pop } ifelse dup /N 2 copy knownoget { put } { pop pop } ifelse -} bind executeonly def +} bdef /.resolvefn3 { dup length dict .copydict @@ -85,7 +85,7 @@ pdfdict begin oforce .resolvefn } forall counttomark -1 roll astore exch pop put -} bind executeonly def +} bdef /.resolvefn4 { PDFfile fileposition exch % filepos fndict @@ -102,31 +102,31 @@ pdfdict begin .bind 1 index /Function 3 -1 roll put exch PDFfile exch setfileposition -} bind executeonly def +} bdef /.resolvefn { % <fndict> .resolvefn <fndict'> dup length dict .copydict dup /Domain 2 copy knownoget { put } { pop pop } ifelse dup /Range 2 copy knownoget { put } { pop pop } ifelse dup /FunctionType oget //fnrdict exch get exec -} bind executeonly def +} bdef /resolvefunction { % <fndict> resolvefunction <function> .resolvefn PDFDEBUG { pdfdict /PDFSTEPcount .knownget { 1 le } { //true } ifelse { (%Function: ) print dup === flush } if } if -} bind executeonly def +} bdef /resolvefnproc { % <fndict> resolvefnproc <proc> resolvefunction .buildfunction -} bind executeonly def +} bdef /resolveidfnproc { % <fndict> resolveidfnproc <proc> dup /Identity eq { pop { } } { resolvefnproc } ifelse -} bind executeonly def +} bdef /resolvedefaultfnproc { % <fndict> <default> resolved'fnproc <proc> 1 index /Default eq { exch pop } { pop resolveidfnproc } ifelse -} bind executeonly def +} bdef %% A BBox where width or height (or both) is 0 should still paint one pixel %% See the ISO 32000-2:2017 spec, section 8.7.4.3, p228 'BBox' and 8.7.3.1 @@ -140,7 +140,7 @@ pdfdict begin 2 index 0.000001 add exch pop }if 5 -1 roll astore -}bind executeonly def +}bind def % ---------------- Shadings ---------------- % @@ -159,25 +159,25 @@ pdfdict begin } repeat 5 -1 roll astore - } bind executeonly + } bind /BBox { dup dup dup aload pop normrect_elems 5 -1 roll astore FixPatternBBox - } bind executeonly + } bind /ColorSpace { resolvecolorspace - } bind executeonly + } bind /Function { dup type /dicttype eq { resolvefunction } { [ exch { oforce resolvefunction } forall ] } ifelse - } bind executeonly + } bind /Extend { mark exch {oforce} forall ] - } bind executeonly + } bind .dicttomark readonly def /resolveshading { % <shadingstream> resolveshading <shading> @@ -201,7 +201,7 @@ pdfdict begin exch PDFfile exch setfileposition dup 3 1 roll /.shading_dict exch put } ifelse -} bind executeonly def +} bdef /resolvesh { % <shname> resolvesh <shading> % <shname> resolvesh <null> Page /Shading rget { @@ -218,7 +218,7 @@ pdfdict begin } { //null }ifelse -} bind executeonly def +} bdef % ---------------- Halftones ---------------- % @@ -229,7 +229,7 @@ pdfdict begin } { 1 sub dup mul exch 1 sub dup mul add 1 sub } ifelse - } bind executeonly + } bind /Diamond { abs exch abs 2 copy add .75 le { dup mul exch dup mul add 1 exch sub @@ -240,7 +240,7 @@ pdfdict begin 1 sub dup mul exch 1 sub dup mul add 1 sub } ifelse } ifelse - } bind executeonly + } bind /Ellipse { abs exch abs 2 copy 3 mul exch 4 mul add 3 sub dup 0 lt { pop dup mul exch .75 div dup mul add 4 div 1 exch sub @@ -252,27 +252,27 @@ pdfdict begin .5 exch sub exch pop exch pop } ifelse } ifelse - } bind executeonly - /EllipseA { dup mul .9 mul exch dup mul add 1 exch sub } bind executeonly - /InvertedEllipseA { dup mul .9 mul exch dup mul add 1 sub } bind executeonly - /EllipseB { dup 5 mul 8 div mul exch dup mul exch add sqrt 1 exch sub } bind executeonly - /EllipseC { dup mul .9 mul exch dup mul add 1 exch sub } bind executeonly - /InvertedEllipseC { dup mul .9 mul exch dup mul add 1 sub } bind executeonly - /Line { exch pop abs neg } bind executeonly - /LineX { pop } bind executeonly - /LineY { exch pop } bind executeonly - /Square { abs exch abs 2 copy lt { exch } if pop neg } bind executeonly - /Cross { abs exch abs 2 copy gt { exch } if pop neg } bind executeonly - /Rhomboid { abs exch abs 0.9 mul add 2 div } bind executeonly - /DoubleDot { 2 {360 mul sin 2 div exch } repeat add } bind executeonly - /InvertedDoubleDot { 2 {360 mul sin 2 div exch } repeat add neg } bind executeonly - /SimpleDot { dup mul exch dup mul add 1 exch sub } bind executeonly - /InvertedSimpleDot { dup mul exch dup mul add 1 sub } bind executeonly - /CosineDot { 180 mul cos exch 180 mul cos add 2 div } bind executeonly - /Double { exch 2 div exch 2 { 360 mul sin 2 div exch } repeat add } bind executeonly + } bind + /EllipseA { dup mul .9 mul exch dup mul add 1 exch sub } bind + /InvertedEllipseA { dup mul .9 mul exch dup mul add 1 sub } bind + /EllipseB { dup 5 mul 8 div mul exch dup mul exch add sqrt 1 exch sub } bind + /EllipseC { dup mul .9 mul exch dup mul add 1 exch sub } bind + /InvertedEllipseC { dup mul .9 mul exch dup mul add 1 sub } bind + /Line { exch pop abs neg } bind + /LineX { pop } bind + /LineY { exch pop } bind + /Square { abs exch abs 2 copy lt { exch } if pop neg } bind + /Cross { abs exch abs 2 copy gt { exch } if pop neg } bind + /Rhomboid { abs exch abs 0.9 mul add 2 div } bind + /DoubleDot { 2 {360 mul sin 2 div exch } repeat add } bind + /InvertedDoubleDot { 2 {360 mul sin 2 div exch } repeat add neg } bind + /SimpleDot { dup mul exch dup mul add 1 exch sub } bind + /InvertedSimpleDot { dup mul exch dup mul add 1 sub } bind + /CosineDot { 180 mul cos exch 180 mul cos add 2 div } bind + /Double { exch 2 div exch 2 { 360 mul sin 2 div exch } repeat add } bind /InvertedDouble { exch 2 div exch 2 { 360 mul sin 2 div exch } repeat add neg - } bind executeonly + } bind .dicttomark readonly def /.resolveht1 { @@ -309,13 +309,13 @@ pdfdict begin } if } ifelse } forall .dicttomark -} bind executeonly def +} bdef /.resolveht5 { mark exch { oforce dup type /dicttype eq { resolvehalftone } if } forall .dicttomark -} bind executeonly def +} bdef /.resolveht6 { %% resolvestream will reposition PDFfile. If we are in the middle @@ -332,7 +332,7 @@ pdfdict begin 1 index exch /TransferFunction exch put } if exch PDFfile exch setfileposition -} bind executeonly def +} bdef /htrdict mark 1 //.resolveht1 @@ -357,15 +357,15 @@ currentdict /.resolveht6 undef ( Output may be incorrect.\n) pdfformaterror gsave .setdefaulthalftone currenthalftone grestore } ifelse -} bind executeonly def +} bdef % ---------------- Graphics state management ---------------- % /cmmatrix matrix def drawopdict begin % Graphics state stack - /q { q } executeonly def - /Q { Q } executeonly def + /q { q } def + /Q { Q } def % Graphics state setting /cm { //cmmatrix astore .getpath @@ -380,25 +380,25 @@ drawopdict begin currentdict /qTextSaveMatrix .knownget { //cmmatrix exch dup concatmatrix pop } if - } bind executeonly def + } bdef - /i { 1 .min setflat } bind executeonly def + /i { 1 .min setflat } bdef /J { setlinecap } bind 0 get def /d { setdash } bind 0 get def /j { setlinejoin } bind 0 get def /w { setlinewidth } bind 0 get def - /M { 1 .max setmiterlimit } bind executeonly def - /gs { gs } executeonly def + /M { 1 .max setmiterlimit } bdef + /gs { gs } def end % Each entry in this dictionary is % <gsres> <value> -proc- <gsres> /gsbg { /BGDefault load resolvedefaultfnproc setblackgeneration -} bind executeonly def +} bdef /gsucr { /UCRDefault load resolvedefaultfnproc setundercolorremoval -} bind executeonly def +} bdef /gstr { dup type /arraytype eq { { oforce /TRDefault load resolvedefaultfnproc } forall @@ -406,17 +406,17 @@ end } { /TRDefault load resolvedefaultfnproc settransfer } ifelse -} bind executeonly def +} bdef /gsparamdict mark - /SA { setstrokeadjust } executeonly - /OP { 1 index /op known not { dup op } if OP } executeonly + /SA { setstrokeadjust } + /OP { 1 index /op known not { dup op } if OP } % The PDF 1.3 specification says that the name /Default is only % recognized for {BG,UCR,TR}2. However, PDF 1.3 files produced % by Adobe Acrobat Distiller 4.0 for Windows use the name /Default % with the older keys, so we have to implement this. - /BG { 1 index /BG2 known { pop } { gsbg } ifelse } executeonly - /UCR { 1 index /UCR2 known { pop } { gsucr } ifelse } executeonly - /TR { 1 index /TR2 known { pop } { gstr } ifelse } executeonly + /BG { 1 index /BG2 known { pop } { gsbg } ifelse } + /UCR { 1 index /UCR2 known { pop } { gsucr } ifelse } + /TR { 1 index /TR2 known { pop } { gstr } ifelse } % Some functions used to implement phases of HT and HTP /sethalftones { @@ -425,10 +425,10 @@ end } { resolvehalftone sethalftone } ifelse - } bind executeonly def + } bdef /sethalftonephases { /sethalftonephase where { pop aload pop sethalftonephase } { pop } ifelse - } bind executeonly def + } bdef /HT { dup sethalftones .swapcolors sethalftones .swapcolors @@ -442,51 +442,51 @@ end /dup /Default eq { oforce gsparamdict /TR get exec } { pop } ifelse } if } ifelse - } executeonly + } /HTP { % HTP may be present even if this isn't a DPS interpreter. dup sethalftonephases .swapcolors sethalftonephases .swapcolors - } executeonly + } % PDF 1.3 % The font is an indirect reference, not a resource name /Font { aload pop exch oforce resourcefont exch Tf } - /LW { setlinewidth } executeonly - /LC { setlinecap } executeonly - /LJ { setlinejoin } executeonly - /ML { 1 .max setmiterlimit } executeonly - /D { aload pop setdash } executeonly - /RI { ri } executeonly - /op { op } executeonly - /OPM { OPM } executeonly - /BG2 { gsbg } executeonly - /UCR2 { gsucr } executeonly - /TR2 { gstr } executeonly - /FL { 1 .min setflat } executeonly + /LW { setlinewidth } + /LC { setlinecap } + /LJ { setlinejoin } + /ML { 1 .max setmiterlimit } + /D { aload pop setdash } + /RI { ri } + /op { op } + /OPM { OPM } + /BG2 { gsbg } + /UCR2 { gsucr } + /TR2 { gstr } + /FL { 1 .min setflat } /SM { % SM may be present even if this is only a Level 2 interpreter. /setsmoothness where { pop setsmoothness } { pop } ifelse - } executeonly + } % PDF 1.4 % All of these require the "transparency" feature in the interpreter. - /ca { ca } executeonly - /CA { CA } executeonly + /ca { ca } + /CA { CA } /SMask { {gssmask} PDFSTOPONERROR { exec //false } { stopped } ifelse { pop (\n **** Error in SMask during ExtGState. Ignoring the mask, output may be incorrect.\n) pdfformaterror } if - } executeonly - /AIS { AIS } executeonly - /BM { BM } executeonly - /TK { TK } executeonly - /UseBlackPtComp { UseBlackPtComp } executeonly + } + /AIS { AIS } + /BM { BM } + /TK { TK } + /UseBlackPtComp { UseBlackPtComp } /HTO { % PDF 2.0, supposed to be 'similar' to halftone phase but using a different % co-ordiate system. Treat the same for now and fix if anyone ever complains. aload pop transform cvi exch cvi exch 2 array astore dup sethalftonephases .swapcolors sethalftonephases .swapcolors - } executeonly + } .dicttomark readonly def /gs { % <gsres> gs - Page /ExtGState rget { @@ -496,7 +496,7 @@ end oforce exch gsparamdict exch .knownget { exec } { pop } ifelse } forall pop } if -} bind executeonly def +} bdef % ------ Transparency support ------ % @@ -583,7 +583,7 @@ end exit } loop SMask -} bind executeonly def +} bdef % Functions specific to the Device* colorspaces to force the switch to % the Device* colorspace so that the SMask will not get a CIEBased* colorspace @@ -592,7 +592,7 @@ end /forceDefaultCS << { currentcolorspace setcolorspace % this will switch to Device colorspace - } bind executeonly + } bind /DeviceGray exch /DeviceRGB 1 index /DeviceCMYK 1 index @@ -664,7 +664,7 @@ def setmatrix end % restore colorspace, color and ExtGState (end) .currentSMask /Processed //true put % special setting to tell us it has been rendered -} bind executeonly def +} bdef % Paint a Form+Group XObject, either for a transparency mask or for a Do. /.execgroup { % [colour values] <colour space> <resdict> <stream> .execgroup - @@ -699,7 +699,7 @@ def .pdfruncontext end grestore /pdfemptycount exch store -} bind executeonly def +} bdef /.beginformgroup { % groupdict bbox .beginformgroup - exch mark exch % bbox mark groupdict @@ -710,7 +710,7 @@ def % Stack: bbox paramdict exch aload pop .begintransparencygroup -} bind executeonly def +} bdef % .paintgroupform implements the Form PaintProc in the case where the % Form XObject dictionary includes a Group key. See .paintform below. @@ -725,7 +725,7 @@ def .beginformgroup .execgroup .endtransparencygroup -} bind executeonly def +} bdef % Make an ImageType 103 (soft-masked) image. /makesoftmaskimage { % <datasource> <imagemask> <SMask> makesoftmaskimage @@ -759,7 +759,7 @@ def .currentalphaisshape { /ShapeMaskDict } { /OpacityMaskDict } ifelse exch def /ColorSpace DataDict /ColorSpace get def -} bind executeonly def +} bdef % ---------------- Color setting ---------------- % @@ -769,17 +769,17 @@ def % The keys here are resolved (PostScript, not PDF) color space names. /csncompdict 9 dict begin - /DeviceGray { pop 1 } bind executeonly def - /DeviceRGB { pop 3 } bind executeonly def - /DeviceCMYK { pop 4 } bind executeonly def + /DeviceGray { pop 1 } bdef + /DeviceRGB { pop 3 } bdef + /DeviceCMYK { pop 4 } bdef /CIEBasedA //DeviceGray def /CIEBasedABC //DeviceRGB def /CalGray //DeviceGray def /CalRGB //DeviceRGB def /Lab //DeviceRGB def - /ICCBased { 1 oget /N oget } bind executeonly def + /ICCBased { 1 oget /N oget } bdef /Separation //DeviceGray def - /DeviceN { 1 oget length } bind executeonly def + /DeviceN { 1 oget length } bdef /Indexed //DeviceGray def currentdict end readonly def @@ -787,7 +787,7 @@ currentdict end readonly def /csncomp { dup dup type /arraytype eq { 0 oget } if //csncompdict exch get exec -} bind executeonly def +} bdef currentdict /csncompdict undef @@ -832,26 +832,26 @@ currentdict /csncompdict undef } { pop % remove colorspace dictionary } ifelse -} bind executeonly def +} bdef /csrdict 13 dict begin - /DeviceGray { } bind executeonly def - /DeviceRGB { } bind executeonly def - /DeviceCMYK { } bind executeonly def + /DeviceGray { } bdef + /DeviceRGB { } bdef + /DeviceCMYK { } bdef - /CalGray { 1 oget [ exch /CalGray exch ] } bind executeonly def - /CalRGB { 1 oget [ exch /CalRGB exch ] } bind executeonly def - /Lab { 1 oget [ exch /Lab exch ] } bind executeonly def + /CalGray { 1 oget [ exch /CalGray exch ] } bdef + /CalRGB { 1 oget [ exch /CalRGB exch ] } bdef + /Lab { 1 oget [ exch /Lab exch ] } bdef /CalCMYK { pop /DeviceCMYK % not defined by Adobe - } bind executeonly def + } bdef /ICCBased { dup 1 get type /dicttype ne { % don't resolve more than once ICCBased-resolve } if - } bind executeonly def + } bdef /Separation { aload pop exch oforce resolvecolorspace @@ -863,7 +863,7 @@ currentdict /csncompdict undef 3 -1 roll oforce 3 1 roll 4 array astore - } bind executeonly def + } bdef /DeviceN { [ exch aload pop ] % Copy into a new array @@ -890,7 +890,7 @@ currentdict /csncompdict undef } if 4 exch put % Put resolved or new attributes dict } if - } bind executeonly def + } bdef /Indexed { aload pop @@ -959,7 +959,7 @@ currentdict /csncompdict undef } if } if } if pop - } bind executeonly def + } bdef /I { % Bug 689815 ( **** Error: The name /Indexed cannot be abbreviated to /I in the color space\n) @@ -967,7 +967,7 @@ currentdict /csncompdict undef ( Output may be incorrect.\n) pdfformaterror dup 0 /Indexed put //Indexed exec - } bind executeonly def + } bdef /Pattern { dup type /nametype ne { @@ -976,7 +976,7 @@ currentdict /csncompdict undef /Pattern exch 2 array astore } if } if - } bind executeonly def + } bdef currentdict end readonly def @@ -984,7 +984,7 @@ currentdict end readonly def % <csname> cssubst false dup resolvecolorspace dup 1 index ne { exch pop //true } { pop pop //false } ifelse -} bind executeonly def +} bdef /csnames mark /DeviceGray dup /DeviceRGB dup /DeviceCMYK dup /Pattern dup @@ -1012,7 +1012,7 @@ currentdict end readonly def } ifelse } ifelse } ifelse -} bind executeonly def +} bdef /resolvecolorspace { % <cspace> resolvecolorspace <cspace'> dup type /dicttype eq { @@ -1043,7 +1043,7 @@ currentdict end readonly def } ifelse } ifelse } if -} bind executeonly def +} bdef /scresolve { % <c0> ... scresolve <multi> % We can't really make sc[n] and SC[N] work, because @@ -1061,7 +1061,7 @@ currentdict end readonly def } { .pdfcount 1 gt } ifelse -} bind executeonly def +} bdef %% Bug #696017 When we begin a text block, we switch to a special set of marking operations %% for paths, these ops don't use the current CTM, but the 'SavedTextMatrix', in order to @@ -1158,24 +1158,19 @@ currentdict end readonly def Q PDFDEBUG { pdfdict /PDFSTEPcount .knownget { 1 le } { //true } ifelse { (%End PaintProc) print dup === flush } if } if PDFfile exch setfileposition -} bind executeonly def +} bdef /.pdfpaintproc { %% Get the /m from pdfopdict (must be present) %% and check its a packedarray pdfopdict /m get dup type /packedarraytype eq { - %% The non-text version of /m is executeonly, so if we can't read it, its not a text block. - dup rcheck { - %% get the initial element of the packedarray - %% and check its a name - 0 get dup type /nametype eq { - %% If the name is inside_text_m then we are in a text block - /inside_text_m eq - }{ - pop false - } ifelse + %% get the initial element of the packedarray + %% and check its a name + 0 get dup type /nametype eq { + %% If the name is inside_text_m then we are in a text block + /inside_text_m eq }{ - pop false + pop false } ifelse }{ pop false @@ -1189,7 +1184,7 @@ currentdict end readonly def { switch_to_text_marking_ops } if -}bind executeonly def +}bdef /resolvepattern { % <patternstreamdict> resolvepattern <patterndict> % Don't do the resolvestream now: just capture the data @@ -1228,7 +1223,7 @@ currentdict end readonly def dup /BBox 2 copy knownoget { normrect FixPatternBBox put } { pop pop } ifelse dup /.pattern_uses_transparency 1 index patternusestransparency put PDFDEBUG { pdfdict /PDFSTEPcount .knownget { 1 le } { //true } ifelse { (%Pattern: ) print dup === flush } if } if -} bind executeonly def +} bdef /ignore_color_op ( **** Error: Ignoring a color operation in a cached context.\n Output may be incorrect.\n) readonly def @@ -1238,28 +1233,28 @@ drawopdict begin } { /DeviceGray cssubst { cs sc1 } { g } ifelse } ifelse - } bind executeonly def + } bdef /rg { .incachedevice { pop pop pop //ignore_color_op pdfformaterror } { /DeviceRGB cssubst { cs sc* } { rg } ifelse } ifelse - } bind executeonly def + } bdef /k { .incachedevice { pop pop pop pop //ignore_color_op pdfformaterror } { k } ifelse - } bind executeonly def + } bdef /cs { .incachedevice { pop //ignore_color_op pdfformaterror } { csresolve { cs } if } ifelse - } bind executeonly def + } bdef /sc { .incachedevice { .pdfcount { pop } repeat //ignore_color_op pdfformaterror @@ -1271,7 +1266,7 @@ drawopdict begin { sc*_and_set } { sc1_and_set } ifelse } ifelse } ifelse - } bind executeonly def + } bdef /scn /sc load def @@ -1280,35 +1275,35 @@ drawopdict begin } { /DeviceGray cssubst { CS SC1 } { G } ifelse } ifelse - } bind executeonly def + } bdef /RG { .incachedevice { pop pop pop //ignore_color_op pdfformaterror } { /DeviceRGB cssubst { CS SC* } { RG } ifelse } ifelse - } bind executeonly def + } bdef /K { .incachedevice { pop pop pop pop //ignore_color_op pdfformaterror } { K } ifelse - } bind executeonly def + } bdef /CS { .incachedevice { pop //ignore_color_op pdfformaterror } { csresolve { CS } if } ifelse - } bind executeonly def + } bdef /ri { .incachedevice { pop //ignore_color_op pdfformaterror } { ri } ifelse - } bind executeonly def + } bdef /SC { .incachedevice { .pdfcount { pop } repeat //ignore_color_op pdfformaterror @@ -1320,7 +1315,7 @@ drawopdict begin { SC*_and_set } { SC1_and_set } ifelse }ifelse } ifelse - } bind executeonly def + } bdef /SCN /SC load def end @@ -1331,36 +1326,36 @@ currentdict /ignore_color_op undef drawopdict begin % Path construction - /m { { moveto } stopped { count pdfemptycount sub 2 .min { pop } repeat 0 0 moveto } if } bind executeonly def - /l { { lineto } stopped { count pdfemptycount sub 2 .min { pop } repeat } if } bind executeonly def - /c { { curveto } stopped { count pdfemptycount sub 6 .min { pop } repeat } if } bind executeonly def + /m { { moveto } stopped { count pdfemptycount sub 2 .min { pop } repeat 0 0 moveto } if } bdef + /l { { lineto } stopped { count pdfemptycount sub 2 .min { pop } repeat } if } bdef + /c { { curveto } stopped { count pdfemptycount sub 6 .min { pop } repeat } if } bdef /v { count pdfemptycount sub 4 ge { { currentpoint 6 2 roll curveto } stopped { count pdfemptycount sub 6 .min { pop } repeat } if } { count pdfemptycount sub { pop } repeat } ifelse - } bind executeonly def - /y { { 2 copy curveto } stopped { count pdfemptycount sub 6 .min { pop } repeat } if } bind executeonly def + } bdef + /y { { 2 copy curveto } stopped { count pdfemptycount sub 6 .min { pop } repeat } if } bdef /re { 4 2 roll moveto exch dup 0 rlineto 0 3 -1 roll rlineto neg 0 rlineto closepath - } bind executeonly def + } bdef /h { closepath } bind 0 get def % Path painting and clipping - /n { n } executeonly def - /S { S } executeonly def - /s { s } executeonly def - /f { f } executeonly def - /f* { f* } executeonly def - /B { B } executeonly def - /b { b } executeonly def - /B* { B* } executeonly def - /b* { b* } executeonly def - /W { W } executeonly def - /W* { W* } executeonly def + /n { n } def + /S { S } def + /s { s } def + /f { f } def + /f* { f* } def + /B { B } def + /b { b } def + /B* { B* } def + /b* { b* } def + /W { W } def + /W* { W* } def /sh_save 1 array def /sh_group << /Subtype /Group /Isolated //true >> readonly def @@ -1370,14 +1365,15 @@ drawopdict begin { dup /.shading .knownget { exch pop } { - .buildshading_and_shfill + .buildshading } ifelse + .shfill } stopped { pop ( **** Error: Ignoring invalid smooth shading object, output may be incorrect.\n) pdfformaterror } if - } bind executeonly def + } bdef /sh { OFFlevels length 0 eq { @@ -1421,43 +1417,43 @@ drawopdict begin } { pop } ifelse - } bind executeonly def + } bdef currentdict dup /sh_save undef /sh_group undef end % ---------------- XObjects ---------------- % /xobjectprocs mark % <dict> -proc- - - /Image { DoImage } executeonly - /Form { DoForm } executeonly - /PS { DoPS } executeonly + /Image { DoImage } + /Form { DoForm } + /PS { DoPS } .dicttomark readonly def % Note that the keys in defaultdecodedict are resolved (PostScript, not PDF) % color space names. /defaultdecodedict mark - /DeviceGray { pop //01_1 } bind executeonly - /DeviceRGB { pop //01_3 } bind executeonly - /DeviceCMYK { pop //01_4 } bind executeonly - /CIEBasedA { 1 get /RangeA knownoget not { //01_1 } if } bind executeonly - /CIEBasedABC { 1 get /RangeABC knownoget not { //01_3 } if } bind executeonly - /CalGray { pop //01_1 } bind executeonly - /CalRGB { pop //01_3 } bind executeonly - /Lab { 1 get /Range knownoget not { [-100 100 -100 100] } {aload pop 0 100 6 2 roll 6 array astore}ifelse } bind executeonly + /DeviceGray { pop //01_1 } bind + /DeviceRGB { pop //01_3 } bind + /DeviceCMYK { pop //01_4 } bind + /CIEBasedA { 1 get /RangeA knownoget not { //01_1 } if } bind + /CIEBasedABC { 1 get /RangeABC knownoget not { //01_3 } if } bind + /CalGray { pop //01_1 } bind + /CalRGB { pop //01_3 } bind + /Lab { 1 get /Range knownoget not { [-100 100 -100 100] } {aload pop 0 100 6 2 roll 6 array astore}ifelse } bind /ICCBased { 1 oget dup /Range knownoget { exch pop }{ /N get [ exch {0 1} repeat ] readonly } ifelse - } bind executeonly - /Separation { pop //01_1 } bind executeonly + } bind + /Separation { pop //01_1 } bind /DeviceN { 1 oget length [ exch {0 1} repeat ] readonly - } bind executeonly + } bind /Indexed { pop [ 0 1 BitsPerComponent bitshift 1 sub ] - } bind executeonly + } bind .dicttomark readonly def /checkaltimage { % <resdict> checkaltimage <resdict[']> @@ -1476,23 +1472,23 @@ end } forall } if } if -} bind executeonly def +} bdef % <string> <index> getu16 <integer> /getu16 { 2 copy get 8 bitshift 3 1 roll 1 add get add -} bind executeonly def +} bind def % <string> <index> getu32 <integer> /getu32 { 2 copy getu16 16 bitshift 3 1 roll 2 add getu16 add -} bind executeonly def +} bind def /jp2_csp_dict mark 12 { /DeviceCMYK } % CMYK 14 { [ /Lab << /WhitePoint [ 0.9505 1 1.0890 ] readonly >> ] } % LAB, WhitePoint == D65 - 16 { /sRGBICC /ColorSpace findresource } bind executeonly - 17 { /sGrayICC /ColorSpace findresource } bind executeonly + 16 { /sRGBICC /ColorSpace findresource } bind + 17 { /sGrayICC /ColorSpace findresource } bind 18 3 index % YCC is converted to RGB % 19 % CIEJab not supportec by PDF 1.7 % 20 % e-sRGB @@ -1506,7 +1502,7 @@ end /jp2h { % descend into a sub-stream, don't return. () /SubFileDecode filter 0 - } bind executeonly def + } bdef /ihdr { 14 sub % file len-14 @@ -1523,7 +1519,7 @@ end dup 12 eq { pop 16 } if /BitsPerComponent exch def % file len-14 } {pop} ifelse - } bind executeonly def + } bdef %% if the ihdr has a BPC of 255 then we get a bpcc box which %% gives the bpc for each component individually. We cannot @@ -1544,7 +1540,7 @@ end pop /BitsPerComponent BitsPerComponent 1 add def - } bind executeonly def + } bdef /colr { currentdict /ColorSpace known not { @@ -1573,7 +1569,7 @@ end } ifelse } ifelse } if - } bind executeonly def + } bdef % Palette colors are decoded by the library. /pclr { @@ -1581,7 +1577,7 @@ end 1 index (1234) readstring pop 3 get 16#7F and 1 add /BitsPerComponent exch def - } bind executeonly def + } bdef /cdef { pop @@ -1597,7 +1593,7 @@ end } ifelse } repeat 0 - } bind executeonly def + } bdef currentdict end readonly def @@ -1639,7 +1635,7 @@ currentdict end readonly def } ifelse } loop pop -} bind executeonly def +} bind def currentdict /jp2_tag_dict .undef currentdict /jp2_csp_dict .undef @@ -1681,7 +1677,7 @@ currentdict /jp2_csp_dict .undef } ifelse 1 index exch /DecodeParms exch put % <resdict> -} bind executeonly def +} bdef /last-ditch-bpc-csp { currentdict /BitsPerComponent oknown not { @@ -1753,7 +1749,7 @@ currentdict /jp2_csp_dict .undef } if } if /ColorSpace exch def -} bind executeonly def +} bdef /get-smask-in-data { % <dict> -> <int> /SMaskInData knownoget { @@ -1763,7 +1759,7 @@ currentdict /jp2_csp_dict .undef } { 0 } ifelse -} bind executeonly def +} bdef /makeimagedict { % <resdict> <newdict> makeimagedict <imagemask?> % On return, newdict' is currentdict @@ -1774,7 +1770,7 @@ currentdict /jp2_csp_dict .undef /BitsPerComponent 2 copy knownoget { cvi def } { pop } ifelse /Interpolate 2 copy knownoget { def } { pop } ifelse makeimagekeys -} bind executeonly def +} bdef /makeimagekeys { % <resdict> makeimagekeys <imagemask> % newdict is currentdict @@ -2038,7 +2034,7 @@ currentdict /jp2_csp_dict .undef //false resolvestream /DataSource exch def //false } ifelse -} bind executeonly def +} bdef currentdict /add-to-last-param undef currentdict /last-ditch-bpc-csp undef @@ -2076,7 +2072,7 @@ currentdict /last-ditch-bpc-csp undef } if 1 index /Mask knownoget { 1 index exch /Mask exch put } if makeimagedict doimagesmask -} bind executeonly def +} bdef /makemaskimage { % <datasource> <imagemask> <Mask> makemaskimage % <datasource> <imagemask>, updates currentdict = % imagedict @@ -2178,7 +2174,7 @@ currentdict /last-ditch-bpc-csp undef /MaskDict exch def /ColorSpace DataDict /ColorSpace get def } ifelse -} bind executeonly def +} bdef /doimagesmask { % <imagemask> doimagesmask - PDFusingtransparency { @@ -2228,14 +2224,14 @@ currentdict /last-ditch-bpc-csp undef { doimage } ifelse } ifelse -} bind executeonly def +} bdef % For development needs we define a special option for running with a new handler % for images with a soft mask. //systemdict /NEW_IMAGE3X .knownget not { //false } if { /doimagesmask { % <imagemask> doimagesmask - doimage - } bind executeonly def + } bdef } if /ValidateDecode { % <<image dict>> -imagemask- ValidateDecode <<image dict>> @@ -2274,7 +2270,7 @@ currentdict /last-ditch-bpc-csp undef } { exch pop }ifelse -}bind executeonly def +}bdef /doimage { % <imagemask> doimage - % imagedict is currentdict, gets popped from dstack @@ -2336,7 +2332,7 @@ currentdict /last-ditch-bpc-csp undef .endtransparencygroup OPsavedict dup /saveOA get .setopacityalpha /saveBM get .setblendmode } if -} bind executeonly def +} bdef /.paintform { % <formdict> <resdict> <stream> .paintform - 1 index /FormResDict gput % For broken forms that inherit resources from the context. @@ -2345,7 +2341,7 @@ currentdict /last-ditch-bpc-csp undef } { pop pdfopdict .pdfruncontext } ifelse -} bind executeonly def +} bdef /IncrementAppearanceNumber { pdfdict /AppearanceNumber .knownget { @@ -2353,7 +2349,7 @@ currentdict /last-ditch-bpc-csp undef }{ pdfdict /AppearanceNumber 0 .forceput } ifelse -}bind executeonly def +}bdef /MakeAppearanceName { pdfdict /AppearanceNumber get @@ -2362,12 +2358,12 @@ currentdict /last-ditch-bpc-csp undef dup 3 -1 roll 9 exch putinterval dup dup length 1 sub (\}) putinterval -} bind executeonly def +} bdef /MakeNewAppearanceName { IncrementAppearanceNumber MakeAppearanceName -}bind executeonly def +}bdef /DoAppearance { %% Might need to rethink this. The problem is that if the page has a CropBox, we apply @@ -2382,7 +2378,7 @@ currentdict /last-ditch-bpc-csp undef DoForm pdfdict /.PreservePDFForm 3 -1 roll .forceput grestore -} bind executeonly def +} bdef /DoForm { %% save the current value, if its true we will set it to false later, in order @@ -2541,7 +2537,7 @@ currentdict /last-ditch-bpc-csp undef end } if pdfdict /.PreservePDFForm 3 -1 roll .forceput -} bind executeonly def +} bdef /_dops_save 1 array def @@ -2554,7 +2550,7 @@ currentdict /last-ditch-bpc-csp undef } { pop } ifelse -} bind executeonly def +} bdef currentdict /_dops_save undef @@ -2567,7 +2563,7 @@ currentdict /_dops_save undef pop } ifelse } forall - } bind executeonly def + } bdef /AnyOn { //false exch { oforce dup type /dicttype eq { @@ -2576,13 +2572,13 @@ currentdict /_dops_save undef pop } ifelse } forall - } bind executeonly def + } bdef /AnyOff { //AllOn exec not - } bind executeonly def + } bdef /AllOff { //AnyOn exec not - } bind executeonly def + } bdef currentdict end readonly def % Check whether OCG or OCMD is visible @@ -2658,7 +2654,7 @@ currentdict end readonly def } { /OFF known not % OFF is inserted by process_trailer_attrs } ifelse -} bind executeonly def +} bdef drawopdict begin /Do { % /Name @@ -2748,7 +2744,7 @@ drawopdict begin % Otherwise ignore it and tidy up the stacks pop pop } ifelse - } bind executeonly def + } bdef end currentdict /xobjectprocs .undef @@ -2782,12 +2778,12 @@ currentdict /ocg_pocs .undef .dicttomark readonly def /unabbrevvalue { % <obj> unabbrevvalue <obj'> oforce //unabbrevtypedict 1 index type .knownget { exec } if -} bind executeonly def +} bdef /is_space_dict << 0 0 9 9 10 10 12 12 13 13 32 32 >> readonly def drawopdict begin - /BI { mark } bind executeonly def + /BI { mark } bdef /ID { gsave %% Bug 696547, related to Bug 695897 (see /Do above) This file has an inline image inside @@ -2856,7 +2852,7 @@ drawopdict begin } ifelse } loop grestore - } bind executeonly def + } bdef end currentdict /is_space_dict undef @@ -2865,26 +2861,26 @@ currentdict /is_space_dict undef drawopdict begin % Text control - /BT { BT } executeonly def - /ET { ET } executeonly def - /Tc { Tc } executeonly def - /TL { TL } executeonly def - /Tr { Tr } executeonly def - /Ts { Ts } executeonly def - /Tw { Tw } executeonly def - /Tz { Tz } executeonly def + /BT { BT } def + /ET { ET } def + /Tc { Tc } def + /TL { TL } def + /Tr { Tr } def + /Ts { Ts } def + /Tw { Tw } def + /Tz { Tz } def % Text positioning - /Td { Td } executeonly def - /TD { TD } executeonly def - /Tm { Tm } executeonly def - /T* { T* } executeonly def + /Td { Td } def + /TD { TD } def + /Tm { Tm } def + /T* { T* } def % Text painting - /Tj { Tj } executeonly def - /' { ' } executeonly def - /" { " } executeonly def - /TJ { TJ } executeonly def + /Tj { Tj } def + /' { ' } def + /" { " } def + /TJ { TJ } def - /Tform { Tform } executeonly def % Text formatting and painting for AcroForm + /Tform { Tform } def % Text formatting and painting for AcroForm % without appearance streams. end @@ -2896,14 +2892,14 @@ drawopdict begin ( **** Error: invalid operator QBT processed as Q BT .\n) pdfformaterror % Bug 690089 ( Output may be incorrect.\n) pdfformaterror - } executeonly def + } def /. { 0. ( **** Error: invalid operator . processed as number 0. .\n) pdfformaterror % Bug 690730 ( Output may be incorrect.\n) pdfformaterror - } executeonly def + } def end % ============================== Annotations ============================== % @@ -2923,14 +2919,14 @@ end dup /Parent oknown not { 2 copy exch /ParentField exch put } if -} bind executeonly def +} bdef % Get and normalize an annotation's rectangle. /annotrect { % <annot> annotrect <x> <y> <w> <h> /Rect oget oforce_recursive aload pop exch 3 index sub dup 0 lt { dup 5 -1 roll add 4 1 roll neg } if exch 2 index sub dup 0 lt { dup 4 -1 roll add 3 1 roll neg } if -} bind executeonly def +} bdef % Set an annotation color. % If the /C array is empty we don't want to draw the annotation @@ -2959,7 +2955,7 @@ end } ifelse } { 0 setgray true} ifelse -} bind executeonly def +} bdef % Set an annotation color. % If the /C array is empty we don't want to draw the annotation @@ -2988,7 +2984,7 @@ end } ifelse } { 0 setgray true} ifelse -} bind executeonly def +} bdef % Draw the border. Currently, we ignore requests for beveling, and we % don't round the corners of rectangles. @@ -3009,7 +3005,7 @@ end } { pop pop pop }ifelse -} bind executeonly def +} bdef % Draw an annotation border. /drawborder { % <annot> drawborder - @@ -3053,7 +3049,7 @@ end 1 {} strokeborder } ifelse grestore -} bind executeonly def +} bdef % stroke the path of an annotation border. /strokeborderpath { % <annot> strokeborderpath - @@ -3102,7 +3098,7 @@ end } ifelse pop grestore -} bind executeonly def +} bdef /fillborderpath { % <annot> fillborderpath - gsave @@ -3110,7 +3106,7 @@ end annotsetinteriorcolor {fill} if grestore -}bind executeonly def +}bdef % % The PDF annotation F (flags) integer is bit encoded. @@ -3139,12 +3135,12 @@ end } { pop pop //false % Hidden } ifelse -} bind executeonly def +} bdef /set_bc_color << - 1 { 0 get oforce setgray } bind executeonly - 3 { { oforce } forall setrgbcolor } bind executeonly - 4 { { oforce } forall setcmykcolor } bind executeonly + 1 { 0 get oforce setgray } bind + 3 { { oforce } forall setrgbcolor } bind + 4 { { oforce } forall setcmykcolor } bind >> readonly def % Get an inherited attribute from a node through /Parent and /ParentField @@ -3168,7 +3164,7 @@ end } ifelse } ifelse } loop - } bind executeonly def + } bind def % <annot> foo <annot> /make_tx_da { @@ -3222,7 +3218,7 @@ end /File File 0 Length getinterval def closefile % <annot> end -} bind executeonly def +} bdef /can-regenerate-ap { % <annot> -> <bool> //false exch @@ -3243,7 +3239,7 @@ end } if } if pop -} bind executeonly def +} bdef /drawwidget { % <scalefactor_x> <scalefactor_y> <annot> drawwidget - @@ -3363,7 +3359,7 @@ end } if } ifelse pop pop pop -} bind executeonly def +} bdef currentdict /set_bc_color undef @@ -3413,7 +3409,7 @@ currentdict /set_bc_color undef ( Output may be incorrect.\n) pdfformaterror pop 1 1 } ifelse -} bind executeonly def +} bdef % Draw an annotation. /drawannottypes 20 dict begin @@ -3437,13 +3433,13 @@ currentdict /set_bc_color undef % } ifelse .begintransparencygroup } if - }bind executeonly def + }bdef /endannottransparency { PDFusingtransparency { .endtransparencygroup } if - }bind executeonly def + }bdef % x0 y0 x1 y1 x2 y2 x3 y3 -> x0 y0 x1-x0 y1-y0 x2-x0 y2-y0 /quadpoints2basis { @@ -3486,7 +3482,7 @@ currentdict /set_bc_color undef 4 index sub exch % x0 y0 x2-x0 y2-y0 y1-y0 x1 5 index sub exch % x0 y0 x2-x0 y2-y0 x1-x0 y1-y0 4 2 roll % x0 y0 x1-x0 y1-y0 x2-x0 y2-y0 - } bind executeonly def + } bdef /Square { dup /AP oknown { @@ -3510,7 +3506,7 @@ currentdict /set_bc_color undef //endannottransparency exec grestore }ifelse - } bind executeonly def + } bdef %% Width Height drawellipse - /drawellipse { @@ -3529,7 +3525,7 @@ currentdict /set_bc_color undef % Stack: yrad xrad xmag ymag exch neg 4 1 roll 3 -1 roll neg 3 1 roll exch neg exch neg 1 index 0 curveto % xmag neg yrad neg xrad neg ymag neg 0 curveto -}bind executeonly def +}bdef /Circle { dup /AP oknown { @@ -3546,7 +3542,7 @@ currentdict /set_bc_color undef grestore //false } ifelse - } bind executeonly def + } bdef /Polygon { dup /AP oknown { @@ -3595,7 +3591,7 @@ currentdict /set_bc_color undef //false grestore } ifelse - } bind executeonly def + } bdef /LineEnd_dict 10 dict begin %% Stack contains <annot> @@ -3628,7 +3624,7 @@ currentdict /set_bc_color undef dup neg lineto closepath strokeborderpath - } bind executeonly def + } bdef /Circle { dup /BS knownoget { @@ -3651,7 +3647,7 @@ currentdict /set_bc_color undef 0 moveto 0 0 3 -1 roll 0 360 arc strokeborderpath - } bind executeonly def + } bdef /Diamond { dup /BS knownoget { @@ -3679,7 +3675,7 @@ currentdict /set_bc_color undef 0 lineto closepath strokeborderpath - } bind executeonly def + } bdef /OpenArrow { dup gsave @@ -3696,7 +3692,7 @@ currentdict /set_bc_color undef dup 6 mul neg exch 4 mul lineto strokeborderpath grestore - } bind executeonly def + } bdef /ClosedArrow { dup gsave @@ -3722,8 +3718,8 @@ currentdict /set_bc_color undef dup /CA knownoget {.setopacityalpha} if fillborderpath grestore - } bind executeonly def - /None {} bind executeonly def + } bdef + /None {} bdef /Butt { dup /BS knownoget { @@ -3736,7 +3732,7 @@ currentdict /set_bc_color undef }ifelse 3 mul dup neg 0 exch moveto 0 exch lineto strokeborderpath - } bind executeonly def + } bdef /ROpenArrow { gsave dup @@ -3754,7 +3750,7 @@ currentdict /set_bc_color undef dup 6 mul neg exch 4 mul lineto strokeborderpath grestore - } bind executeonly def + } bdef /RClosedArrow { gsave dup @@ -3781,7 +3777,7 @@ currentdict /set_bc_color undef dup /CA knownoget {.setopacityalpha} if fillborderpath grestore - } bind executeonly def + } bdef /Slash { gsave dup @@ -3797,7 +3793,7 @@ currentdict /set_bc_color undef 3 mul dup neg 0 exch moveto 0 exch lineto strokeborderpath grestore - } bind executeonly def + } bdef currentdict end readonly def @@ -3841,7 +3837,7 @@ currentdict /set_bc_color undef //false grestore } ifelse - } bind executeonly def + } bdef /PolyLine { dup /AP oknown { @@ -3899,7 +3895,7 @@ currentdict /set_bc_color undef //false grestore } ifelse - } bind executeonly def + } bdef /Link { % <annot> -> <false> //startannottransparency exec @@ -3912,7 +3908,7 @@ currentdict /set_bc_color undef ( Output may be incorrect.\n) pdfformaterror }ifelse //endannottransparency exec - } bind executeonly def + } bdef /Ink { % <annot> -> <annot> <true> % <annot> -> <false> @@ -3964,7 +3960,7 @@ currentdict /set_bc_color undef //endannottransparency exec //false } ifelse - } bind executeonly def + } bdef /Underline { dup /AP oknown { @@ -4003,7 +3999,7 @@ currentdict /set_bc_color undef } if //false } ifelse - } bind executeonly def + } bdef /StrikeOut { dup /AP oknown { @@ -4042,7 +4038,7 @@ currentdict /set_bc_color undef } if //false } ifelse - } bind executeonly def + } bdef % Connect 2 points with an arc that has max distance from the line % segment to the ark equal 1/4 of the radius. @@ -4062,7 +4058,7 @@ currentdict /set_bc_color undef atan % x0 y0 x1 y1 xc yc r a1 a2 exch arcn % x0 y0 x1 y1 pop pop pop pop - } bind executeonly def + } bind def /emptydict 0 dict readonly def @@ -4097,7 +4093,7 @@ currentdict /set_bc_color undef } if //false % } ifelse - } bind executeonly def + } bdef currentdict /emptydict undef currentdict /highlight-arc undef @@ -4157,7 +4153,7 @@ currentdict /set_bc_color undef //endannottransparency exec //false } ifelse - } bind executeonly def + } bdef /Text { dup /AP oknown { @@ -4199,7 +4195,7 @@ currentdict /set_bc_color undef //endannottransparency exec //false } ifelse - } bind executeonly def + } bdef /FreeText { dup /AP knownoget { @@ -4386,7 +4382,7 @@ currentdict /set_bc_color undef { //true } ifelse - } bind executeonly def + } bdef /frame { { 255 div } forall setrgbcolor @@ -4410,7 +4406,7 @@ currentdict /set_bc_color undef } gsave 1 -1 translate 0.75 setgray dup exec grestore exec - } bind executeonly def + } bdef % (text) y h -> - /text { @@ -4429,7 +4425,7 @@ currentdict /set_bc_color undef PDFusingtransparency { .endtransparencytextgroup } if - } bind executeonly def + } bdef /red <ef4023> readonly def /green <3fae49> readonly def @@ -4439,44 +4435,44 @@ currentdict /set_bc_color undef /Approved { //green //frame exec (APPROVED) 13 30 //text exec - } bind executeonly def + } bdef /AsIs { //red //frame exec (AS IS) 13 30 //text exec - } bind executeonly def + } bdef /Confidential { //red //frame exec (CONFIDENTIAL) 17 20 //text exec - } bind executeonly def + } bdef /Departmental { //blue //frame exec (DEPARTMENTAL) 17 20 //text exec - } bind executeonly def + } bdef /Draft { //red //frame exec (DRAFT) 13 30 //text exec - } bind executeonly def + } bdef /Experimental { //blue //frame exec (EXPERIMENTAL) 17 20 //text exec - } bind executeonly def + } bdef /Expired { //red //frame exec (EXPIRED) 13 30 //text exec - } bind executeonly def + } bdef /Final { //red //frame exec (FINAL) 13 30 //text exec - } bind executeonly def + } bdef /ForComment { //green //frame exec (FOR COMMENT) 17 20 //text exec - } bind executeonly def + } bdef /ForPublicRelease { //green //frame exec (FOR PUBLIC) 26 18 //text exec (RELEASE) 8.5 18 //text exec - } bind executeonly def + } bdef /NotApproved { //red //frame exec (NOT APPROVED) 17 20 //text exec @@ -4485,15 +4481,15 @@ currentdict /set_bc_color undef //red //frame exec (NOT FOR) 26 18 //text exec (PUBLIC RELEASE) 8.5 18 //text exec - } bind executeonly def + } bdef /Sold { //blue //frame exec (SOLD) 13 30 //text exec - } bind executeonly def + } bdef /TopSecret { //red //frame exec (TOP SECRET) 14 26 //text exec - } bind executeonly def + } bdef currentdict end readonly def {/text/frame/red/green/blue} {currentdict exch undef} forall @@ -4528,7 +4524,7 @@ currentdict /set_bc_color undef //endannottransparency exec //false } ifelse - } bind executeonly def + } bdef /Popup { dup /Open oknown { @@ -4617,7 +4613,7 @@ currentdict /set_bc_color undef } { pop //false }ifelse - } bind executeonly def + } bdef /Redact { %% Redact annotations are part of a process, a Redact annotation is only present @@ -4629,7 +4625,7 @@ currentdict /set_bc_color undef } { //false } ifelse - } bind executeonly def + } bdef currentdict /startannottransparency undef currentdict /endannottransparency undef @@ -4654,7 +4650,7 @@ currentdict end readonly def } {pop pop //true} ifelse -} bind executeonly def +} bind def /drawannot { % <annot> drawannot - dup annotvisible { @@ -4685,7 +4681,7 @@ currentdict end readonly def } ifelse grestore } if pop % annotvisible -} bind executeonly def +} bdef currentdict /drawannottypes undef % Draw an annotation. @@ -4743,7 +4739,6 @@ currentdict /drawannottypes undef dup {oforce} stopped not {exch pop} if 2 index 3 1 roll put } forall - Removepdfobj# } if dup type /arraytype eq { 0 1 2 index length 1 sub{ @@ -4753,7 +4748,7 @@ currentdict /drawannottypes undef } if } if } forall -} bind executeonly def +} bdef /ApplyCTMToQuadPoints { @@ -4786,13 +4781,13 @@ currentdict /drawannottypes undef exch pop % the mark grestore -} bind executeonly def +} bdef /preserveannottypes 20 dict begin -/Circle {mark exch loadannot /ANN pdfmark false} bind executeonly def -/FileAttachment {mark exch loadannot /ANN pdfmark false} bind executeonly def -/FreeText {mark exch loadannot /ANN pdfmark false} bind executeonly def +/Circle {mark exch loadannot /ANN pdfmark false} bdef +/FileAttachment {mark exch loadannot /ANN pdfmark false} bdef +/FreeText {mark exch loadannot /ANN pdfmark false} bdef /Highlight { mark exch @@ -4802,9 +4797,9 @@ currentdict /drawannottypes undef put } if loadannot /ANN pdfmark false -} bind executeonly def +} bdef -/Ink {mark exch loadannot /ANN pdfmark false} bind executeonly def +/Ink {mark exch loadannot /ANN pdfmark false} bdef /Line { mark exch dup /L .knownget { @@ -4813,101 +4808,15 @@ currentdict /drawannottypes undef 1 index /L 3 -1 roll put } if loadannot /ANN pdfmark false -} bind executeonly def +} bdef -/Link { - /NO_PDFMARK_DESTS where {pop NO_PDFMARK_DESTS not}{true}ifelse - { - mark exch - dup /BS knownoget { << exch { oforce } forall >> /BS exch 3 -1 roll } if - dup /F knownoget { /F exch 3 -1 roll } if - dup /C knownoget { /Color exch 3 -1 roll } if - dup /Rect knownoget { /Rect exch 3 -1 roll } if - dup /Border knownoget { - dup type /arraytype eq { - dup length 3 lt - } { - //true - } ifelse { - pop [ 0 0 0 ] % Following AR5 use invisible border. - } if - /Border exch 3 -1 roll - } if - dup /A knownoget { - dup /URI known { - /A mark 3 2 roll % <<>> /A [ <<action>> - { oforce } forall - .dicttomark - 3 2 roll - } { - dup /S knownoget { - %% Because we process GoTo Destinations into absolute references in the PDF file - %% we need to resolve the /D or /Dest. However, we must *not* do this for - %% GoToR Destinations because (obviously) those are in a different file and - %% we cannot resolve them into absolute references. We don't need to anyway - %% because that file must already have a named destination. - dup /GoTo eq { - pop - dup /D knownoget { - exch pop exch dup length dict copy dup /Dest 4 -1 roll put - } if - }{ - dup /GoToR eq { - pop /A mark % <<..action dict..>> /A [ - 3 2 roll % /A [ <<..action dict..>> - { oforce } forall - .dicttomark - 3 2 roll - }{ - dup /Launch eq { - pop /A mark % <<..action dict..>> /A [ - 3 2 roll % /A [ <<..action dict..>> - { oforce } forall - .dicttomark - 3 2 roll - }{ - /Named eq { - /N knownoget { - namedactions exch .knownget { - exec { - pop - ( **** Warning: Ignoring a named action pointing out of the document page range.\n) - pdfformatwarning - } { - /Page exch 3 -1 roll - } ifelse - } if - } if - } if - }ifelse - } ifelse - } ifelse - } if - } ifelse - } if - { linkdest } stopped { - cleartomark - ( **** Warning: Link annotation points out of the document page range.\n) - pdfformatwarning - } { - pop - { - %% Need to remove any '/.gs.pdfobj# key/value pairs from any dictionaries - counttomark array astore dup length 1 sub 0 1 3 -1 roll { - dup 2 index exch get Removepdfobj# 2 index 3 1 roll put - } for aload pop - /LNK pdfmark - } stopped {cleartomark} if - } ifelse - }{pop} ifelse - false -} bind executeonly def +/Link {mark exch {drawannot} PDFSTOPONERROR {exec}{stopped {(Error: Ignoring invalid annotation, output may be incorrect.\n) pdfformaterror} if} ifelse cleartomark false} bdef -/Movie {mark exch loadannot /ANN pdfmark false} bind executeonly def -/Popup {mark exch loadannot /ANN pdfmark false} bind executeonly def -/Sound {mark exch loadannot /ANN pdfmark false} bind executeonly def -/Square {mark exch loadannot /ANN pdfmark false} bind executeonly def -/Stamp {mark exch loadannot /ANN pdfmark false} bind executeonly def +/Movie {mark exch loadannot /ANN pdfmark false} bdef +/Popup {mark exch loadannot /ANN pdfmark false} bdef +/Sound {mark exch loadannot /ANN pdfmark false} bdef +/Square {mark exch loadannot /ANN pdfmark false} bdef +/Stamp {mark exch loadannot /ANN pdfmark false} bdef /StrikeOut { mark exch @@ -4917,7 +4826,7 @@ currentdict /drawannottypes undef put } if loadannot /ANN pdfmark false -} bind executeonly def +} bdef /Squiggly { mark exch @@ -4927,10 +4836,10 @@ currentdict /drawannottypes undef put } if loadannot /ANN pdfmark false -} bind executeonly def +} bdef -/Text {mark exch loadannot /ANN pdfmark false} bind executeonly def -/TrapNet {mark exch loadannot /ANN pdfmark false} bind executeonly def +/Text {mark exch loadannot /ANN pdfmark false} bdef +/TrapNet {mark exch loadannot /ANN pdfmark false} bdef /Underline { mark exch @@ -4940,23 +4849,18 @@ currentdict /drawannottypes undef put } if loadannot /ANN pdfmark false -} bind executeonly def +} bdef %% Widget annotations are only used with AcroForms, and since we don't preserve AcroForms %% we don't want to preserve widget annotations either, because the consumer of the new %% PDF won't know what values they should take. So we draw widget annotations instead. If we %% ever preserve AcroForms then we should alter this to preserve Widgets as well. %% simply chane "drawannot" to "mark exch loadannot /ANN pdfmark" -/Widget {mark exch {drawannot} PDFSTOPONERROR {exec}{stopped {(Error: Ignoring invalid annotation, output may be incorrect.\n) pdfformaterror} if} ifelse cleartomark false} bind executeonly def +/Widget {mark exch {drawannot} PDFSTOPONERROR {exec}{stopped {(Error: Ignoring invalid annotation, output may be incorrect.\n) pdfformaterror} if} ifelse cleartomark false} bdef currentdict end readonly def /preserveannot { % <annot> preserveannot - - - dup /.gs.pdfobj# known { - dup /.gs.pdfobj# undef - } if - dup annotvisible { gsave dup dup /Subtype knownoget { @@ -4984,7 +4888,7 @@ currentdict end readonly def } ifelse grestore } if pop % annotvisible -} bind executeonly def +} bdef currentdict /preserveannottypes undef currentdict /.PDFDrawAnnotType? undef @@ -4998,7 +4902,7 @@ currentdict /.PDFDrawAnnotType? undef } { oget } ifelse -} bind executeonly def +} bdef % All procedures have the signature: % <acroform> <field> <annot|field> foo <acroform> <field> <annot|field> @@ -5032,7 +4936,7 @@ currentdict /.PDFDrawAnnotType? undef } ifelse } ifelse } ifelse -} bind executeonly def +} bdef /Tx { dup /AP known { @@ -5080,7 +4984,7 @@ currentdict /.PDFDrawAnnotType? undef dup 1 1 3 -1 roll drawwidget } if } ifelse -} bind executeonly def +} bdef /Ch { dup /AP known 3 index /NeedAppearances knownoget not { //true } if not and { @@ -5128,11 +5032,11 @@ currentdict /.PDFDrawAnnotType? undef dup 1 1 3 -1 roll drawwidget } if } ifelse -} bind executeonly def +} bdef /Sig { (Sig is not yet implemened ) //== exec -} bind executeonly def +} bdef currentdict end def @@ -5146,7 +5050,7 @@ currentdict end def } if } if pop pop -} bind executeonly def +} bdef % We distinguish 4 types of nodes on the form field tree: % - non-terminal field - has a kid that refers to the parent (or anywhere else) @@ -5173,14 +5077,14 @@ currentdict end def } { draw_terminal_field % merged annotation % - } ifelse -} bind executeonly def +} bdef /draw_acro_form { % <form> draw_acro_form - dup /Fields knownoget { { oforce draw_form_field } forall } if pop -} bind executeonly def +} bdef currentdict /draw_terminal_field_dict undef diff --git a/Master/tlpkg/tlgs/Resource/Init/pdf_font.ps b/Master/tlpkg/tlgs/Resource/Init/pdf_font.ps index feaf0d036ac..a9511570ec2 100644 --- a/Master/tlpkg/tlgs/Resource/Init/pdf_font.ps +++ b/Master/tlpkg/tlgs/Resource/Init/pdf_font.ps @@ -68,7 +68,7 @@ pdfdict begin { 3 copy put pop 1 add } ifelse } forall pop -} bind executeonly def +} bdef /good_encoding_names << /MacRomanEncoding 0 /MacExpertEncoding 0 /WinAnsiEncoding 0 @@ -130,7 +130,7 @@ pdfdict begin ( Output may be incorrect.\n) pdfformaterror } ifelse - } bind executeonly def + } bdef currentdict /good_encoding_names undef currentdict /known_symbolic_fonts undef @@ -146,7 +146,7 @@ currentdict /known_symbolic_fonts undef } if } if pop -} bind executeonly def +} bind def % Define a font using it's FontName as the key. % Adjust a font according to the Encoding and Widths in the font resource. @@ -166,7 +166,7 @@ currentdict /known_symbolic_fonts undef /Helvetica findfont }if } if -} bind executeonly def +} bind def % Get the (possibly modified) encoding of a font. /getfontencoding { % <font-resource> <font> getfontencoding @@ -213,7 +213,7 @@ currentdict /known_symbolic_fonts undef } ifelse } ifelse } ifelse -} bind executeonly def +} bdef % Returns true if the current glyph is in the Differences array at % the specified index value. This is needed because the Widths @@ -240,7 +240,7 @@ currentdict /known_symbolic_fonts undef % stack: true false index glyphname % or : false index glyphname at_index pop pop pop -} bind executeonly def +} bdef /unique_name { % <dict> </root> unique_name </unique> % @@ -262,7 +262,7 @@ currentdict /known_symbolic_fonts undef pop } for exch pop cvn % /root0 -} bind executeonly def +} bdef % Get the metrics of a font, if specified. /getfontmetrics { % <font-resource> <font> <Encoding|null> getfontmetrics @@ -397,7 +397,7 @@ currentdict /known_symbolic_fonts undef } { //null //null } ifelse -} bind executeonly def +} bdef currentdict /unique_name undef currentdict /match_in_diff undef @@ -408,20 +408,20 @@ currentdict /match_in_diff undef pop dup userdict exch /.lastToUnicode exch put exch pop - } bind executeonly def + } bdef /CIDSystemInfo { ( **** Warning: ToUnicode CMap has invalid syntax near CIDSystemInfo.\n) pdfformatwarning /CIDSystemInfo - } bind executeonly def % A work around a bug in Altona.Page_3.2002-09-27.pdf - a slash is missed. + } bdef % A work around a bug in Altona.Page_3.2002-09-27.pdf - a slash is missed. /CMapName { ( **** Warning: ToUnicode CMap has no CMapName.\n\ See the comment to revision 6201 in gs/doc/ps2pdf.htm#Problems .\n) pdfformatwarning /CMap1 % arbitrary, PDF defineresource tolerates non-unique names - } bind executeonly def % A work around incorrect ToUnicode CMap generated by GS before rev. 6201. + } bdef % A work around incorrect ToUnicode CMap generated by GS before rev. 6201. % Split large ranges into smaller chunks to stay withing the limits % of various PS% objects and speed up operand stack manipulation, @@ -448,7 +448,7 @@ currentdict /match_in_diff undef mark } ifelse } loop - } bind executeonly def + } bdef currentdict end readonly def /string2number % <string> string2number <number> @@ -457,7 +457,7 @@ currentdict end readonly def 3 2 roll 256 mul add exch % v+n*256 () } for pop % N -} bind executeonly def +} bind def /copy&def % <key> <value> <bool> copy&def - { @@ -474,7 +474,7 @@ currentdict end readonly def setglobal } if def -} bind executeonly def +} bind def /.convert_ToUnicode-into-g2u % <GlyphNames2Unicode> <Encoding|null> <CMap> .convert_ToUnicode-into-g2u - { @@ -578,14 +578,14 @@ currentdict end readonly def CMAPDEBUG { (.convert_ToUnicode-into-g2u end) = } if -} bind executeonly def +} bind def /.DoToUnicode? { /IgnoreToUnicode where {/IgnoreToUnicode get not} {//true} ifelse -} bind executeonly def +} bind def /.processToUnicode % <font-resource> <font-dict> <encoding|null> .processToUnicode - { @@ -718,7 +718,7 @@ currentdict end readonly def {pop pop pop} ifelse -} bind executeonly def +} bind def currentdict /.DoToUnicode? .forceundef @@ -768,7 +768,7 @@ setglobal 4 2 roll .growput } ifelse } ifelse -} bind executeonly def +} bind def % Add original font to cache to prevent adjustfont to accumulate changes. /pdfaddcachedfont { % <font_name> pdfaddcachedfont <font> @@ -776,7 +776,7 @@ setglobal dup gcheck { //.pdforigfontcache_g } {.pdforigfontcache_l} ifelse 4 2 roll % font d name font put % font -} bind executeonly def +} bind def /.remove_font_name_prefix { % <name> .remove_font_name_prefix <name> dup .namestring (+) search { @@ -792,7 +792,7 @@ setglobal } { pop } ifelse -} bind executeonly def +} bind def % Find a font (except for embedded ones), and adjust its encoding if necessary. /.pdfdfndict mark @@ -965,18 +965,18 @@ setglobal } ifelse } ifelse exch pop -} bind executeonly def +} bdef % ---------------- Type 1 fonts ---------------- % /buildType1 % <Type1-font-resource> buildType1 <font> { dup /BaseFont get pdffindfont - } bind executeonly def + } bdef % Read an embedded Type 1 font. /readfontfilter { % <proc> readfontfilter <filter> 0 () /SubFileDecode filter -} bind executeonly def +} bdef % Adobe Acrobat doesn't skip space characters after eexec /eexec_pdf_param_dict mark @@ -1051,12 +1051,12 @@ setglobal } ifelse } if prev_definefont - } bind executeonly def + } bdef /undef_proc_warning { /Repaired //true store % flag that we have warnings UndefProcList exch 2 copy .knownget { 1 add } { 1 } ifelse put - } bind executeonly def + } bdef /missing-type1-procs 6 dict begin /-| { string currentfile exch readstring pop /-| //undef_proc_warning exec } executeonly bdef @@ -1080,7 +1080,7 @@ setglobal currentfile flushfile % Skip the trailer after return from eexec, bug 690701. { currentdict end //missing-type1-procs eq { exit } if } loop { stop } if - } bind executeonly def + } bdef /readonly-op-dict << /stringtype 0 @@ -1094,7 +1094,7 @@ setglobal ( **** Warning: Type 1 font applies operator readonly to an invalid object type.\n) pdfformatwarning } if - } bind executeonly def + } bdef /prev_get /get load def @@ -1110,14 +1110,14 @@ setglobal prev_get } ifelse } ifelse - } bind executeonly def + } bdef /prev_begin /begin load def /begin { dup //systemdict eq { pop 0 dict } if prev_begin - } bind executeonly def + } bdef { /undef_proc_warning /missing-type1-procs /readonly-op-dict } { currentdict exch undef } forall @@ -1152,7 +1152,7 @@ currentdict /eexec_pdf_param_dict .undef PDFfile file-position setfileposition count stack-count sub { pop } repeat topFontDict end end - } bind executeonly def + } bdef % ---------------- Type 3 fonts ---------------- % @@ -1241,7 +1241,7 @@ currentdict /eexec_pdf_param_dict .undef } bdef dup currentdict Encoding .processToUnicode currentdict end .completefont exch pop -} bind executeonly def +} bdef /.adjustcharwidth { % <wx> <wy> .adjustcharwidth <wx'> <wy'> % Enforce the metrics, in glyph space, to the values found in the PDF Font object % - force wy == 0 (assumed, and not stored in the PDF font) @@ -1258,7 +1258,7 @@ currentdict /eexec_pdf_param_dict .undef exch pop Widths CharCode FirstChar sub get exch } if end } if -} bind executeonly def +} bdef % ---------------- TrueType fonts ---------------- % @@ -1318,7 +1318,7 @@ currentdict /eexec_pdf_param_dict .undef } { pdffindfont } ifelse -} bind executeonly def +} bdef % Read an embedded TrueType font. /readtruetype { % <font-resource> <stream-dict> readtruetype <font> @@ -1328,18 +1328,6 @@ currentdict /eexec_pdf_param_dict .undef % Stack: filepos fontres stream 1 index /CIDSystemInfo oknown { 1 index /CIDSystemInfo get dup type /packedarraytype eq {exec}if - dup /Registry known not { - ( **** Warning: a CIDFont's CIDSystemInfo is missing the required Registry entry\n) pdfformatwarning - dup /Registry (Adobe) put - } if - dup /Ordering known not { - ( **** Warning: a CIDFont's CIDSystemInfo is missing the required Ordering entry\n) pdfformatwarning - dup /Ordering (Identity) put - } if - dup /Supplement known not { - ( **** Warning: a CIDFont's CIDSystemInfo is missing the required Supplement entry\n) pdfformatwarning - dup /Supplement 0 put - } if 3 1 roll 1 index /Subtype knownoget { /CIDFontType2 ne { @@ -1383,7 +1371,7 @@ currentdict /eexec_pdf_param_dict .undef PDFfile 3 -1 roll setfileposition % Ignore both the Encoding and the Widths. exch pop -} bind executeonly def +} bdef % ---------------- Type 0 fonts ---------------- % @@ -1425,7 +1413,7 @@ currentdict /eexec_pdf_param_dict .undef end % CMap end % CIDInit ProcSet exch .setglobal -} bind executeonly def +} bdef /CMap_read_dict 3 dict begin /defineresource % <name> <dict> <cat-name> defineresource <dict> @@ -1433,20 +1421,20 @@ currentdict /eexec_pdf_param_dict .undef pop /.last_CMap_def 1 index store exch pop - } bind executeonly def + } bdef /CIDSystemInfo { ( **** Error: CMap has invalid syntax near CIDSystemInfo.\n) pdfformaterror ( Output may be incorrect.\n) pdfformaterror /CIDSystemInfo - } bind executeonly def % A work around a bug in Altona.Page_3.2002-09-27.pdf - a slash is missed. + } bdef % A work around a bug in Altona.Page_3.2002-09-27.pdf - a slash is missed. /CMapName { ( **** Error: CMap has no CMapName.\n\ See the comment to revision 6201 in gs/doc/ps2pdf.htm#Problems .\n) pdfformaterror ( Output may be incorrect.\n) pdfformaterror /CMap1 % arbitrary, PDF defineresource tolerates non-unique names - } bind executeonly def % A work around incorrect ToUnicode CMap generated by GS before rev. 6201. + } bdef % A work around incorrect ToUnicode CMap generated by GS before rev. 6201. currentdict end readonly def % Read an embedded stream that we *hope* is a PostScript CMap. According @@ -1463,7 +1451,7 @@ currentdict end readonly def currentdict end dup /CMapName get exch /CMap defineresource end -} bind executeonly def +} bdef % Read embedded CMap stream. % if the <wmode> parameter is null, it indicates there is no WMode, and we @@ -1487,7 +1475,7 @@ currentdict end readonly def { currentdict end //CMap_read_dict eq { exit } if } loop dup /.last_CMap_def undef /CMap defineresource -} bind executeonly def +} bdef currentdict /CMap_read_dict undef @@ -1548,7 +1536,7 @@ currentdict /CMap_read_dict undef pop } ifelse } if exch pop -} bind executeonly def +} bdef % ---------------- CIDFontType0/2 fonts ---------------- % @@ -1601,7 +1589,7 @@ currentdict /CMap_read_dict undef dup /CDevProc 1 index /CIDWProc load /exec load 3 packedarray cvx put exch pop -} bind executeonly def +} bdef /.pdfMakeInternalMTXArray { % <mtx_array> <item_size> .pdfConvertInternalW <mtx_array'> % convert /W or /W2 to internal expression @@ -1657,10 +1645,10 @@ currentdict /CMap_read_dict undef [ { putMTXEntry Mi1 type get exec i Msize ge { exit } if } loop ] end -} executeonly def +} def -/.pdfMakeInternalW { dup length 0 gt { oforce_recursive 1 .pdfMakeInternalMTXArray } if } executeonly def -/.pdfMakeInternalW2 { dup length 0 gt { oforce_recursive 3 .pdfMakeInternalMTXArray } if } executeonly def +/.pdfMakeInternalW { dup length 0 gt { oforce_recursive 1 .pdfMakeInternalMTXArray } if } def +/.pdfMakeInternalW2 { dup length 0 gt { oforce_recursive 3 .pdfMakeInternalMTXArray } if } def /.pdfGetMTXByCID { % <internalMTXArray> <cid> % .pdfGetMTXByCID @@ -1680,7 +1668,7 @@ currentdict /CMap_read_dict undef { exit } if } forall dup type /arraytype eq { exch pop //true } { pop //false } ifelse -} executeonly def +} def % Apply the [D]W[2] metrics to a character before displaying. /CIDWProc { % <w0x> <w0y> <llx> <lly> <urx> <ury> @@ -1788,7 +1776,7 @@ currentdict /CMap_read_dict undef 11 -1 roll pop % Stack: <w0x'> <w0y'> <llx> <lly> <urx> <ury> <w1x'> <w1y'> <vx'> <vy'> end % recover currentdict -} executeonly def +} def % <string> <match> tailmatch ==> <pre> true % ==> <string> false @@ -1801,7 +1789,7 @@ currentdict /CMap_read_dict undef } { pop //false } ifelse -} bind executeonly def +} bind def /makeboldfont { 16 dict begin @@ -1842,7 +1830,7 @@ currentdict /CMap_read_dict undef currentdict end dup /CIDFontName get exch /CIDFont defineresource -} bind executeonly def +} bind def % <CIDFont-resource> <CIDFontName> findCIDFont <CIDFont-resource> <font> % CIDFont-resource is not modified. @@ -2026,15 +2014,15 @@ currentdict /CMap_read_dict undef } if /findresource cvx /undefined signalerror } loop -} bind executeonly def +} bdef /buildCIDType0 { % <CIDFontType0-font-resource> buildCIDType0 <font> dup /BaseFont get findCIDFont exch pop -} bind executeonly def +} bdef /buildCIDType2 { % <CIDFontType2-font-resource> buildCIDType2 <font> dup /BaseFont get findCIDFont exch pop -} bind executeonly def +} bdef /processCIDToGIDMap { % <fontres> <cidfont> processCIDToGIDMap <fontres> <cidfont> 1 index /CIDToGIDMap knownoget { @@ -2067,7 +2055,7 @@ currentdict /CMap_read_dict undef } ifelse 3 2 roll PDFfile exch setfileposition } if -} bind executeonly def +} bdef % Adjust a CIDFontType0 DW[2] in the font resource. /adjustCIDType0 { % <font-resource> <font> adjustfont <font'> @@ -2079,7 +2067,7 @@ currentdict /CMap_read_dict undef addCIDmetrics dup /CIDFontName get exch /CIDFont defineresource } ifelse -} bind executeonly def +} bind def % Adjust a CIDFontType2 DW[2] and CIDToGIDMap in the font resource. /adjustCIDType2 { % <font-resource> <font> adjustfont <font'> @@ -2094,7 +2082,7 @@ currentdict /CMap_read_dict undef } if dup /CIDFontName get exch /CIDFont defineresource } ifelse -} bind executeonly def +} bind def % ---------------- Other embedded fonts ---------------- % @@ -2120,7 +2108,7 @@ currentdict /CMap_read_dict undef closefile closefile pop PDFfile 3 -1 roll setfileposition pop pop -} bind executeonly def +} bdef % Read an embedded CFF CIDFont. /readCIDFontType0C { % <font-resource> <stream-dict> readCIDFontType0C <font> @@ -2138,7 +2126,7 @@ currentdict /CMap_read_dict undef % Use the FontName, rather than the BaseFont, here. dup /FontDescriptor oget /FontName oget /CIDFont findresource addCIDmetrics dup /CIDFontName get exch /CIDFont defineresource -} bind executeonly def +} bdef % Read an embedded OpenType font. /readOTTOfont { % <font-resource> <stream-dict> readOTTOfont <font> @@ -2196,7 +2184,7 @@ currentdict /CMap_read_dict undef closefile closefile pop pop % font res pos PDFfile exch setfileposition % font res pop % font -} bind executeonly def +} bdef % ---------------- Font lookup ---------------- % @@ -2228,10 +2216,10 @@ currentdict /CMap_read_dict undef % Bind a proc and define n names % /name ... /name {proc} n bndef - /bndef - { exch bind executeonly exch + { exch bind exch { dup 3 1 roll def } repeat pop - } bind executeonly def + } bdef % <res> run-fonttypeproc <font> /run-fonttypeproc { @@ -2244,7 +2232,7 @@ currentdict /CMap_read_dict undef 2 copy /Subtype exch put } if //fonttypeprocs exch get exec -} bind executeonly def +} bdef % Prototype for all procedures: <res> <desc> <stream> foo <font> /font_tag_dict 13 dict begin @@ -2253,19 +2241,19 @@ currentdict /CMap_read_dict undef /no_stream { pop pop run-fonttypeproc - } bind executeonly def + } bdef /bad_stream { ( **** Error: Error reading font stream, attempting to load the font using its name\n) pdfformaterror ( Output may be incorrect.\n) pdfformaterror //no_stream exec - } bind executeonly def + } bdef <8001> % PFB { dup /PFB //true put exch pop readtype1 - } bind executeonly def + } bdef (%!PS) (%!Fo) % Type1 { exch pop readtype1 @@ -2288,7 +2276,7 @@ currentdict /CMap_read_dict undef (OTTO) { exch pop readOTTOfont - } bind executeonly def + } bdef currentdict end readonly def currentdict /bndef undef @@ -2323,7 +2311,7 @@ currentdict /bndef undef 16#7FFFFFFF and xor % object_number CRC<newhash> xor % final hashed value -}bind executeonly def +}bind def % Either patch or create a new XUID based on the existing % XUID or UniqueID and incorporating the PDF object number @@ -2356,7 +2344,7 @@ currentdict /bndef undef .completefont } ifelse } ifelse -} bind executeonly def +} bind def /resourcefont % <font-resource> resourcefont <font> { @@ -2501,7 +2489,7 @@ currentdict /bndef undef dup 3 1 roll /PSFont exch put } ifelse dup checkGlyphNames2Unicode -} bind executeonly def +} bdef currentdict /font_tag_dict .undef currentdict /fonttypeprocs .undef @@ -2511,7 +2499,7 @@ drawopdict begin /d0 { currentcolor currentcolorspace .swapcolors setcolorspace setcolor .swapcolors .adjustcharwidth setcharwidth - } bind executeonly def + } bdef /d1 { 2 copy % ... llx lly urx ury | urx ury 0 ne exch 0 ne % ... llx lly urx ury | ury!=0 urx!=0 @@ -2523,7 +2511,7 @@ drawopdict begin } { 6 -2 roll .adjustcharwidth 6 2 roll setcachedevice } ifelse - } bind executeonly def + } bdef /Tf { 1 index Page /Font rget { dup type /dicttype eq { @@ -2562,7 +2550,7 @@ drawopdict begin Tf } ifelse } ifelse - } bind executeonly def + } bdef end end % pdfdict diff --git a/Master/tlpkg/tlgs/Resource/Init/pdf_main.ps b/Master/tlpkg/tlgs/Resource/Init/pdf_main.ps index 01af26af198..1e3fae2e589 100644 --- a/Master/tlpkg/tlgs/Resource/Init/pdf_main.ps +++ b/Master/tlpkg/tlgs/Resource/Init/pdf_main.ps @@ -30,28 +30,28 @@ pdfdict begin currentdevice //.writepdfmarkdict .getdeviceparams mark eq { //false } { pop pop //true } ifelse systemdict /DOPDFMARKS known or -} bind executeonly def +} bind def % For simplicity, we use a single interpretation dictionary for all % PDF graphics execution, even though this is too liberal. /pdfopdict mark objopdict { } forall drawopdict { } forall - /endstream { exit } bind executeonly - (%%EOF) cvn { exit } bind executeonly % for filters + /endstream { exit } bind + (%%EOF) cvn { exit } bind % for filters /obj { ( **** Error: Content stream is not terminated by 'endstream'.\n) pdfformaterror ( Output may be incorrect.\n) pdfformaterror - } bind executeonly + } bind % 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 + /BX { /BXlevel BXlevel 1 add store } bind + /EX { /BXlevel BXlevel 1 sub store } bind + /PS { cvx exec } bind % PDF 1.2 operators /BMC { /BMClevel BMClevel 1 add store pop - } bind executeonly + } bind /BDC { /BMClevel BMClevel 1 add store exch /OC eq { @@ -69,7 +69,7 @@ pdfdict begin } { pop } ifelse - } bind executeonly + } bind /EMC { OFFlevels BMClevel 2 copy known { @@ -77,118 +77,19 @@ pdfdict begin } if 1 sub /BMClevel exch store pop - } bind executeonly + } bind /MP { pop } bind /DP { pop pop } bind /- { 0 % Bug 690016 ( **** Error: Invalid operator '-' is assumed to be the number 0.\n) pdfformaterror ( Output may be incorrect.\n) pdfformaterror - } bind executeonly + } bind /Recursive_XObject_D 1 dict def .dicttomark readonly def - -% This dictionaty encapsulates all that is needed to generate pagelabel pdfmarks. -% -% This is provided by Leon Bottou for the benefit of the djvudigital device -% which is a device developed and maintained outside of Artifex, and which is -% not a contributed device. -% -% This device does not cope with the method used by pdfwrite to pass the pagelabels -% number tree as a 'blob' of data, but requires that the page labels be passed using -% a PAGELABEL pdfmark. -% -% We don't want to do that with pdfwrite because there is no mechanism in pdfmark syntax -% to pass a tree, which means we'd have to laboriously disassemble the pdfmarks for the -% page labels and rebuild a number tree for it. This would mean pattern matching each -% string passed via PAGELABEL to see if it could be defined as a continuation -% of the preceding string, uing prefixes. Its much easier for us just to pass the tree. -% -% Note that this code simply translates the PageLabels Number tree into a number of -% individual PAGELABEL pdfmarks, if used for pdfwrite this would result in a number -% tree which consists solely of leaf nodes, where each node has a string for its label. -% This can be considerably more verbose than the shorthand possible with a Page Label -% dictionary. -% -/pagelabeldict mark - % (TEXT) .toLower (text) - /.toLower { - dup length 1 sub -1 0 { - 1 index exch 2 copy get 2#00100000 or put - } for - } bind executeonly - % int .cvAlpha (int in alphabetic base 26) - /.cvAlpha { - [ exch % construct an array of ASCII values, in reverse - { % the remainder stays on the top of stack - dup 0 eq { pop exit } if % quit if the value is zero - dup 26 mod dup 0 eq { 26 add } if % so that the division is correct - dup 64 add 3 1 roll sub 26 idiv % save the ASCII value and iterate - } loop ] - dup length dup string 3 1 roll - dup -1 1 { % put the letters in a string - 4 copy sub exch 4 -1 roll 1 sub get put - } for pop pop - } bind executeonly - % int .cvRoman (int in capital Roman numerals) - % convert a positive integer to capital Roman numerals - % return a decimal string if >= 4000 - /.cvRoman { - dup 255 string cvs % start with the decimal representation - exch 4000 lt { % convert only if Roman numerals can represent this - dup length - [ [ () (I) (II) (III) (IV) (V) (VI) (VII) (VIII) (IX) ] - [ () (X) (XX) (XXX) (XL) (L) (LX) (LXX) (LXXX) (XC) ] - [ () (C) (CC) (CCC) (CD) (D) (DC) (DCC) (DCCC) (CM) ] - [ () (M) (MM) (MMM) ] ] % Roman equivalents - () % append the Roman equivalent of each decimal digit to this string - 2 index -1 1 { - 2 index 1 index 1 sub get - 5 index 5 index 4 -1 roll sub get - 48 sub get concatstrings - } for - 4 1 roll pop pop pop - } if - } bind executeonly - % style printers - /PageStyle << - /D { 255 string cvs } bind executeonly - /R { .cvRoman } executeonly - /r { .cvRoman .toLower } executeonly - /A { .cvAlpha } executeonly - /a { .cvAlpha .toLower } executeonly >> - % check whether we want to generate pdfmarks - /wantpagelabelmarks { - % WantsPageLabels means that pagelabels will be passed - % using .pdfpagelabels and not using pdfmarks - /WantsPageLabels /GetDeviceParam .special_op - {pop pop false}{true} ifelse - } bind executeonly - % generate pagelabel pdfmark - /dopagelabel { % -- dopagelabel -- - << /S null /P () /O 0 >> begin - wantpagelabelmarks { - Trailer /Root knownoget { - oforce /PageLabels knownoget { - oforce Page# 1 sub - numogetle - { oforce - dup /S knownoget not { //false } if /S exch def - dup /P knownoget not { 0 string } if /P exch def - /St knownoget not { 1 } if exch sub /O exch def - } if - P Page# 1 sub O add PageStyle S knownoget { exec concatstrings } if - mark /Label 3 -1 roll /PAGELABEL pdfmark - } if - } if - } if - end - } bind executeonly -.dicttomark readonly def - % ======================== Main program ======================== % end % pdfdict @@ -298,7 +199,7 @@ currentdict /runpdfstring .undef pdfdict begin pdfopen begin /CumulativePageCount currentpagedevice /PageCount get def -} bind executeonly def +} bind def /runpdfpagerange { % - runpdfpagerange <firstpage#> <lastpage#> <</DisablePageHandler true>> setpagedevice @@ -485,7 +386,7 @@ currentdict /runpdfstring .undef } ifelse } ifelse }ifelse -} bind executeonly def +} bind def /dopdfpages { % firstpage# lastpage# dopdfpages - << /PDFScanRules //true >> setuserparams % set scanning rules for PDF vs. PS @@ -511,7 +412,7 @@ currentdict /runpdfstring .undef % imaged is a PS file. currentpagedevice /PageSpotColors known { << /PageSpotColors -1 >> setpagedevice } if << /PDFScanRules //null >> setuserparams % restore scanning rules for PS -} bind executeonly def +} bind def /runpdfend { RepairedAnError @@ -527,7 +428,7 @@ currentdict /runpdfstring .undef PDFTopSave restore end % userdict 2 vmreclaim % couldn't hurt -} bind executeonly def +} bind def % Copy stream to an external temporary file and % return the file name as PS name. @@ -558,7 +459,7 @@ currentdict /runpdfstring .undef } { closefile } ifelse -} bind executeonly def +} bind def % Recursively enumerate /Names entries % <node> pdf_collection_names /temp_file_name ... @@ -587,7 +488,7 @@ currentdict /runpdfstring .undef } forall } if } ifelse -} bind executeonly def +} bind def % Copy selected subfiles to temporary files and return the file names % as a PostScript names to protect them from restore. @@ -607,7 +508,7 @@ currentdict /runpdfstring .undef pop } ifelse } if -} bind executeonly def +} bind def /runpdf { % <file> runpdf - %% Get the PDF filename (it *must* be a file even if it came from stdin it gets @@ -650,7 +551,7 @@ currentdict /runpdfstring .undef } forall pop } ifelse -} bind executeonly def +} bind def currentdict /pdf_collection_files .undef @@ -659,7 +560,7 @@ end % systemdict % It is OK to use { (%stdin) run } here, because a startjob cannot occur. /.runstdin { { (%stdin) run } execute0 -} bind executeonly def +} bind def end % userdict pdfdict begin @@ -676,14 +577,14 @@ pdfdict begin % they are invalid, the PDF file is probably unreadable anyway. /traileropdict mark - (<<) cvn { /dictlevelcount dictlevelcount 1 add store mark } bind executeonly + (<<) cvn { /dictlevelcount dictlevelcount 1 add store mark } bind (>>) cvn { { .dicttomark } stopped { ( **** Warning: File has unbalanced >> in trailer.\n) pdfformatwarning } if /dictlevelcount dictlevelcount 1 sub def dictlevelcount 0 eq { exit } if - } bind executeonly - ([) cvn { mark } bind executeonly % ditto + } bind + ([) cvn { mark } bind % ditto (]) cvn dup load % /true true % see .pdfexectoken in pdf_base.ps % /false false % ibid. @@ -695,7 +596,7 @@ pdfdict begin ( **** Error: indirect object reference \(R\) encountered with invalid arguments.) pdfformaterror ( Output may be incorrect.\n) pdfformaterror } ifelse - } bind executeonly % see Objects below + } bind % see Objects below .dicttomark readonly def % After reading entry count: skip whitespace, exit on a digit @@ -876,22 +777,22 @@ pdfdict begin pdfformatwarning } if PDFfile traileropdict .pdfrun - } bind executeonly def + } bind def currentdict /xref-char-dict undef % This dicitonary is used to read the xref dictionary. It should work for % reading any dictionary. dictlevelcount must contain 0. /xrefopdict mark - (<<) cvn { /dictlevelcount dictlevelcount 1 add def mark } bind executeonly + (<<) cvn { /dictlevelcount dictlevelcount 1 add def mark } bind (>>) cvn { .dicttomark /dictlevelcount dictlevelcount 1 sub def - dictlevelcount 0 eq { exit} if } bind executeonly - ([) cvn { mark } bind executeonly % ditto + dictlevelcount 0 eq { exit} if } bind + ([) cvn { mark } bind % ditto (]) cvn dup load % /true true % see .pdfexectoken in pdf_base.ps % /false false % ibid. % /null null % ibid. - /R { /resolveR cvx 3 packedarray cvx } bind executeonly % see Objects below + /R { /resolveR cvx 3 packedarray cvx } bind % see Objects below .dicttomark readonly def % Get a variable length positive integer value from a stream. A value @@ -899,7 +800,7 @@ currentdict /xref-char-dict undef /getintn { % <stream> <count> getintn int 0 exch { 256 mul 1 index read pop add } repeat exch pop % Discard stream -} bind executeonly def +} bind def % This array contains handlers for processing the different types of % entries in the XRef stream. @@ -912,7 +813,7 @@ currentdict /xref-char-dict undef % (obj num: ) print 2 index pdfstring cvs print ( ) print % (loc: ) print 1 index pdfstring cvs print ( ) print % (gen: ) print dup === flush - } bind executeonly % Do nothing for free xref entries + } bind % Do nothing for free xref entries % XRef entry type 1 - normal or n type xref entry { % field 2 = obj loc, field 3 = gen num % (normal ) print @@ -922,7 +823,7 @@ currentdict /xref-char-dict undef 0 3 1 roll % set stream number = 0 //false setxrefentry 3 -1 roll pop % remove stream number - } bind executeonly + } bind % XRef entry type 2 - compressed object type xref entry { % field 2 = object stream num, field 3 = index into object stream % (Compressed objects: ) print @@ -930,7 +831,7 @@ currentdict /xref-char-dict undef % (field 2: ) print 1 index pdfstring cvs print ( ) print % (field 3: ) print dup === flush 0 //false setxrefentry pop % set generation number = 0 - } bind executeonly + } bind ] def % Read the PDF 1.5 version of the xref table. @@ -1012,7 +913,7 @@ currentdict /xref-char-dict undef pop % Remove Index array pair loc } for % Loop through Index array entries pop pop % Remove Index array and xref stream - } bind executeonly def + } bind def % Read the cross-reference table. % <pos> is the position either from the startxref statement or the /Prev @@ -1066,7 +967,7 @@ currentdict /xref-char-dict undef } { readpdf15xref } % otherwise assume PDF 1.5 xref stream ifelse - } bind executeonly def + } bind def % Open a PDF file and read the header, trailer, and cross-reference. /pdfopen { % <file> pdfopen <dict> @@ -1096,7 +997,7 @@ currentdict /xref-char-dict undef pdfopenfile begin pdfopencache currentdict end -} bind executeonly def +} bind def /process_trailer_attrs { % - process_trailer_attrs - writeoutputintents @@ -1315,7 +1216,7 @@ currentdict /xref-char-dict undef } ifelse } if } if -} bind executeonly def +} bind def % Verify that each entry in the xref table is pointing at an object with % the correct object number and generation number. @@ -1377,7 +1278,7 @@ currentdict /xref-char-dict undef /PageCount pdfpagecount def /PageNumbers PageCount 65534 .min dict def /PageIndex PageCount 65534 .min array def -} bind executeonly def +} bind def /pdfopenfile { % <file> pdfopenfile <dict> pdfdict readonly pop % can't do it any earlier than this @@ -1540,7 +1441,7 @@ currentdict /xref-char-dict undef verify_page_tree currentdict end - } bind executeonly def + } bind def %% Executing token on a file will close the file if we reach EOF while %% processing. When repairing broken files (or searching for startxref @@ -1567,7 +1468,7 @@ currentdict /xref-char-dict undef } { token } ifelse -} bind executeonly def +} bind def % Look for the last (startxref) from the current position % of the file. Return the position after (startxref) if found or -1 . @@ -1577,7 +1478,7 @@ currentdict /xref-char-dict undef bytesavailable 9 lt { exit } if pop dup fileposition } loop -} bind executeonly def +} bind def % Search for the last 'startxfer' and read a following token, which % must be a number. Don't pay any attention to %%EOF because it's @@ -1609,30 +1510,30 @@ currentdict /xref-char-dict undef ( Output may be incorrect.\n) pdfformaterror /findxref cvx /syntaxerror signalerror } if -} bind executeonly def +} bind def /stderrfile (%stderr) (w) file def /stdoutfile (%stdout) (w) file def /stderrprint { % <string> stderrprint - //stderrfile dup 3 -1 roll writestring flushfile -} bind executeonly def +} bind def /stdoutprint { % <string> stderrprint - //stdoutfile dup 3 -1 roll writestring flushfile -} bind executeonly def +} bind def /pdfformaterror { % <string> pdfformaterror - stdoutprint /Repaired //true store /RepairedAnError //true store -} bind executeonly def +} bind def /pdfformatwarning { % <string> pdfformaterror - QUIET not {stdoutprint}{pop}ifelse /Repaired //true store PDFSTOPONWARNING {/warning cvx /undefined signalerror} if -} bind executeonly def +} bind def /knownoget_safe { 2 copy knownoget { 3 1 roll pop pop //true } { pop pop //false } ifelse @@ -1658,7 +1559,7 @@ currentdict /xref-char-dict undef stderrprint ( <<<<\n) stderrprint } ifelse -} bind executeonly def +} bind def % The UndefProcList collects noisy warnings. % This gets rid of many multiple warnings from pdf_font.ps /printCollectedWarnings { @@ -1670,7 +1571,7 @@ currentdict /xref-char-dict undef } forall (\n) stderrprint } if -} bind executeonly def +} bind def /printrepaired { QUIET not @@ -1686,7 +1587,7 @@ currentdict /xref-char-dict undef ( **** specification.\n\n) stdoutprint } if -} bind executeonly def +} bind def /printrepairederror { QUIET not @@ -1695,7 +1596,7 @@ currentdict /xref-char-dict undef ( **** The rendered output from this file may be incorrect.\n) stdoutprint } if -} bind executeonly def +} bind def % Write the outline structure for a file. Uses linkdest (below). % omit links to pages that don't exist. @@ -1776,14 +1677,14 @@ currentdict /xref-char-dict undef /First knownoget { { dup writeoutline /Next knownoget not { exit } if } loop } if - } bind executeonly def + } bind def % Close a PDF file. /pdfclose % <dict> pdfclose - { begin PDFfile closefile end - } bind executeonly def + } bind def % ======================== Page accessing ======================== % @@ -1829,7 +1730,7 @@ currentdict /xref-char-dict undef ifelse } ifelse - } bind executeonly def + } bind def /obj_get { LocalResources 1 index knownoget { @@ -1853,7 +1754,7 @@ currentdict /xref-char-dict undef pop pop pop 0 }ifelse }ifelse -}bind executeonly def +}bind def % Get the value of a resource on a given page. /rget { % <resname> <pagedict> <restype> rget <value> -true- @@ -1889,7 +1790,7 @@ currentdict /xref-char-dict undef pop pop pop pop } ifelse } ifelse -} bind executeonly def +} bind def % Get the total number of pages in the document. /pdfpagecount % - pdfpagecount <int> @@ -1934,7 +1835,7 @@ currentdict /xref-char-dict undef }{ 0 } ifelse - } bind executeonly def + } bind def % Check for loops in the 'page tree' but accept an acyclic graph. % - verify_page_tree - @@ -1963,7 +1864,7 @@ currentdict /xref-char-dict undef end } if } if -} bind executeonly def +} bind def /pdffindpage? { % <int> pdffindpage? 1 null (page not found) % <int> pdffindpage? 1 noderef (page found) @@ -1985,7 +1886,7 @@ currentdict /xref-char-dict undef % Stack: index null|noderef dup //null eq { pop pop 1 //null exit } if } loop -} bind executeonly def +} bind def % Find the N'th page of the document by iterating through the Pages tree. % The first page is numbered 1. @@ -2000,10 +1901,10 @@ currentdict /xref-char-dict undef { pop pop pop } % don't store more than 65534 pagenumbers ifelse exch pop -} bind executeonly def +} bind def /pdffindpage { % <int> pdffindpage <pagedict> pdffindpageref oforce -} bind executeonly def +} bind def % Find the N'th page of the document. % The first page is numbered 1. @@ -2016,7 +1917,7 @@ currentdict /xref-char-dict undef { exch pop oforce } { pop pdffindpage } ifelse - } bind executeonly def + } bind def % Find the page number of a page object (inverse of pdfgetpage). /pdfpagenumber % <pagedict> pdfpagenumber <int> @@ -2030,7 +1931,7 @@ currentdict /xref-char-dict undef for exch pop } ifelse - } bind executeonly def + } bind def % Arrange the four elements that define a rectangle into a 'normal' order. /normrect_elems % <x1> <y1> <x2> <y2> normrect_elems <llx> <lly> <urx> <ury> @@ -2048,14 +1949,14 @@ currentdict /xref-char-dict undef 2 copy gt { exch } if % <x2> <x1> <lly> <ury> 4 2 roll 2 copy lt { exch } if % <lly> <ury> <urx> <llx> 4 1 roll exch % <llx> <lly> <urx> <ury> -} bind executeonly def +} bind def % Arrange a rectangle into a 'normal' order. I.e the lower left corner % followed by the upper right corner. /normrect % <rect> normrect <rect> { aload pop normrect_elems 4 array astore -} bind executeonly def +} bind def /fix_empty_rect_elems % </Name> <x1> <y1> <x2> <y2> fix_empty_rect_elems <x1> <y1> <x2'> <y2'> { dup 3 index eq { //true } { 1 index 4 index eq } ifelse { @@ -2067,11 +1968,11 @@ currentdict /xref-char-dict undef } { 5 -1 roll pop } ifelse -} bind executeonly def +} bind def /boxrect % <llx> <lly> <urx> <ury> boxrect <x> <y> <w> <h> { exch 3 index sub exch 2 index sub - } bind executeonly def + } bind def /resolvedest { % <name|string|other> resolvedest <other|null> dup type /nametype eq { Trailer /Root oget /Dests knownoget { @@ -2092,12 +1993,12 @@ currentdict /xref-char-dict undef } ifelse } if } ifelse -} bind executeonly def +} bind def % Procedures to do the necessary transformations of view destinations % <PDF2PS_matrix> <rot> <view> -- <view'> /viewdestprocs 8 dict dup begin - /Fit { exch pop exch pop } bind executeonly def + /Fit { exch pop exch pop } bind def /FitH { aload length 2 lt { 1 array astore @@ -2107,7 +2008,7 @@ currentdict /xref-char-dict undef 4 -1 roll transform exch pop 2 array astore } ifelse - } bind executeonly def + } bind def /FitV { aload length 2 lt { 1 array astore @@ -2117,7 +2018,7 @@ currentdict /xref-char-dict undef 4 -1 roll transform pop 2 array astore } ifelse - } bind executeonly def + } bind def /FitB /Fit load def /FitBH /FitH load def /FitBV /FitV load def @@ -2150,14 +2051,14 @@ currentdict /xref-char-dict undef 2 { 3 -1 roll //null eq { pop //null } if exch } repeat % put the nulls back 3 -1 roll 4 array astore - } bind executeonly def + } bind def /FitR { exch pop aload pop 2 { 5 index transform 4 2 roll } repeat normrect_elems 5 array astore exch pop - } bind executeonly def + } bind def end readonly def /linkdest { % <link|outline> linkdest @@ -2208,31 +2109,102 @@ end readonly def ifelse } if -} bind executeonly def - - -%% Used to recursively check dictionaries for any /.gs.pdfobj# keys -%% and remove them if so -%% -any- /Removepdfobj# -any- - -/Removepdfobj# -{ - dup type /dicttype eq { - dup /.gs.pdfobj# known { - dup /.gs.pdfobj# undef - } if - dup {Removepdfobj# 2 index 3 1 roll put} forall - } if -}bind executeonly def - +} bind def % <pagedict> mark ... -proc- <page#> <error> /namedactions 8 dict dup begin - /FirstPage { 1 /CumulativePageCount where {pop CumulativePageCount}{0}ifelse add //false } bind executeonly def - /LastPage { pdfpagecount /CumulativePageCount where {pop CumulativePageCount}{0}ifelse add //false } bind executeonly def - /NextPage { counttomark 2 add index pdfpagenumber 1 add dup pdfpagecount gt exch /CumulativePageCount where {pop CumulativePageCount}{0}ifelse add exch} bind executeonly def - /PrevPage { counttomark 2 add index pdfpagenumber 1 sub dup 1 lt exch /CumulativePageCount where {pop CumulativePageCount}{0}ifelse add exch} bind executeonly def + /FirstPage { 1 /CumulativePageCount where {pop CumulativePageCount}{0}ifelse add //false } def + /LastPage { pdfpagecount /CumulativePageCount where {pop CumulativePageCount}{0}ifelse add //false } def + /NextPage { counttomark 2 add index pdfpagenumber 1 add dup pdfpagecount gt exch /CumulativePageCount where {pop CumulativePageCount}{0}ifelse add exch} bind def + /PrevPage { counttomark 2 add index pdfpagenumber 1 sub dup 1 lt exch /CumulativePageCount where {pop CumulativePageCount}{0}ifelse add exch} bind def end readonly def % <pagedict> <annotdict> -proc- - +/annottypes 5 dict dup begin + /Text { + mark exch + { /Rect /Open /Contents /F} + { 2 copy knownoget { 3 -1 roll } { pop } ifelse } + forall pop {/ANN pdfmark} stopped {cleartomark} if + } bind def + /Link { + /NO_PDFMARK_DESTS where {pop NO_PDFMARK_DESTS not}{true}ifelse + { + mark exch + dup /BS knownoget { << exch { oforce } forall >> /BS exch 3 -1 roll } if + dup /F knownoget { /F exch 3 -1 roll } if + dup /C knownoget { /Color exch 3 -1 roll } if + dup /Rect knownoget { /Rect exch 3 -1 roll } if + dup /Border knownoget { + dup type /arraytype eq { + dup length 3 lt + } { + //true + } ifelse { + pop [ 0 0 0 ] % Following AR5 use invisible border. + } if + /Border exch 3 -1 roll + } if + dup /A knownoget { + dup /URI known { + /A mark 3 2 roll % <<>> /A [ <<action>> + { oforce } forall + .dicttomark + 3 2 roll + } { + dup /S knownoget { + %% Because we process GoTo Destinations into absolute references in the PDF file + %% we need to resolve the /D or /Dest. However, we must *not* do this for + %% GoToR Destinations because (obviously) those are in a different file and + %% we cannot resolve them into absolute references. We don't need to anyway + %% because that file must already have a named destination. + dup /GoTo eq { + pop + dup /D knownoget { + exch pop exch dup length dict copy dup /Dest 4 -1 roll put + } if + }{ + dup /GoToR eq { + pop /A mark % <<..action dict..>> /A [ + 3 2 roll % /A [ <<..action dict..>> + { oforce } forall + .dicttomark + 3 2 roll + }{ + dup /Launch eq { + pop /A mark % <<..action dict..>> /A [ + 3 2 roll % /A [ <<..action dict..>> + { oforce } forall + .dicttomark + 3 2 roll + }{ + /Named eq { + /N knownoget { + namedactions exch .knownget { + exec { + pop + ( **** Warning: Ignoring a named action pointing out of the document page range.\n) + pdfformatwarning + } { + /Page exch 3 -1 roll + } ifelse + } if + } if + } if + }ifelse + } ifelse + } ifelse + } if + } ifelse + } if + { linkdest } stopped { + cleartomark + ( **** Warning: Link annotation points out of the document page range.\n) + pdfformatwarning + } { + pop {/LNK pdfmark} stopped {cleartomark} if + } ifelse + }{pop} ifelse + } bind def +end readonly def % **** The following procedure should not be changed to allow clients % **** to directly interface with the constituent procedures. GSview @@ -2244,14 +2216,14 @@ end readonly def pdfshowpage_init % <pagedict> pdfshowpage_setpage % <pagedict> pdfshowpage_finish % - - } bind executeonly def + } bind def /pdfpagecontents % <pagedict> pdfpagecontents <contents> - { } bind executeonly def + { } bind def /pdfshowpage_init % <pagedict> pdfshowpage_init <pagedict> { /DSCPageCount DSCPageCount 1 add store - } bind executeonly def + } bind def /get_media_box { % <pagedict> get_media_box <box> <bool> /MediaBox pget { @@ -2262,7 +2234,7 @@ end readonly def ( Output may be incorrect.\n) pdfformaterror [ 0 0 currentpagedevice /PageSize get aload pop ] //false } ifelse -} bind executeonly def +} bind def /get_any_box { % <pagedict> get_any_box <box name> <box> //systemdict /UseBleedBox .knownget dup { and } if { @@ -2353,7 +2325,7 @@ end readonly def } ifelse 4 array astore % /SomeBox [mX0 mY0 mX1 mY1] } ifelse -} bind executeonly def +} bind def % Compute the matrix that transforms the PDF->PS "default" user space /pdf_PDF2PS_matrix { % <pdfpagedict> -- matrix @@ -2433,7 +2405,7 @@ end readonly def % stack: savedCTM <pdfpagedict> pop matrix currentmatrix exch setmatrix -} bind executeonly def +} bind def % Cache the matrix that transforms the PDF->PS "default" user space % into <pdfpagedict> under the key //PDF2PS_matrix_key, then return it @@ -2445,13 +2417,13 @@ end readonly def dup dup pdf_PDF2PS_matrix //PDF2PS_matrix_key exch put //PDF2PS_matrix_key get } ifelse -} bind executeonly def +} bind def currentdict /PDF2PS_matrix_key undef /.pdfshowpage_Install { % <pagedict> [<prevproc>] .pdfshowpage_Install - 0 get exec pdf_cached_PDF2PS_matrix concat -} bind executeonly def +} bind def /pdfshowpage_setpage { % <pagedict> pdfshowpage_setpage <pagedict> 6 dict begin % for setpagedevice @@ -2552,7 +2524,7 @@ currentdict /PDF2PS_matrix_key undef /Install exch def % Stack: pagedict currentpagedict pop currentdict end setpagedevice -} bind executeonly def +} bind def /.free_page_resources { % - .free_page_resources - Page /Resources pget { @@ -2566,7 +2538,7 @@ currentdict /PDF2PS_matrix_key undef } forall } if } if -} bind executeonly def +} bind def /pdfshowpage_finish { % <pagedict> pdfshowpage_finish - save /PDFSave exch store @@ -2579,9 +2551,6 @@ currentdict /PDF2PS_matrix_key undef .writepdfmarks { - % Pagelabel - pagelabeldict begin dopagelabel end - % Copy the boxes. % Copy the boxes. { /CropBox /BleedBox /TrimBox /ArtBox } { 2 copy pget { @@ -2594,6 +2563,20 @@ currentdict /PDF2PS_matrix_key undef pop } ifelse } forall + + % Copy annotations and links. + dup /Annots knownoget { + 0 1 2 index length 1 sub + { 1 index exch oget + dup type /dicttype eq { + dup /Subtype oget annottypes exch .knownget { exec } { pop } ifelse + } { + pop + } ifelse + } + for pop + } if + } if % end .writepdfmarks % Display the actual page contents. @@ -2705,7 +2688,7 @@ currentdict /PDF2PS_matrix_key undef .setglobal /RepairedAnError exch def /Repaired exch def -} bind executeonly def +} bind def % Display the contents of a page (including annotations). /showpagecontents { % <pagedict> showpagecontents - @@ -2763,7 +2746,7 @@ currentdict /PDF2PS_matrix_key undef //systemdict /ShowAcroForm .knownget { //true eq } { //false } ifelse { Trailer /Root oget /AcroForm knownoget { draw_acro_form } if } if -} bind executeonly def +} bind def /processcolorspace { % - processcolorspace <colorspace> % The following is per the PLRM3. @@ -2771,7 +2754,7 @@ currentdict /PDF2PS_matrix_key undef exch pop exch pop dup type /nametype ne { cvn } if dup { setcolorspace } .internalstopped { pop /DeviceRGB } if -} bind executeonly def +} bind def % ------ Transparency support ------ % @@ -2812,7 +2795,7 @@ currentdict /PDF2PS_matrix_key undef % Also check for transparency in the annotation (if not in resources). { pop //true } { annotsusetransparency } ifelse } ifelse -} bind executeonly def +} bind def % Check if transparency is specified in an ExtGState dict /extgstateusestransparency { % <gstate dict> extgstateusestransparency <bool> @@ -2830,7 +2813,7 @@ currentdict /PDF2PS_matrix_key undef pop exit } loop } ifelse -} bind executeonly def +} bind def % Check if transparency is used in a Pattern /patternusestransparency { % <Pattern dict> patternusestransparency <bool> @@ -2844,7 +2827,7 @@ currentdict /PDF2PS_matrix_key undef } loop } ifelse -} bind executeonly def +} bind def % Check the Resources of a page or Form. Check for loops in the resource chain. /resourceusestransparency { % <dict> <dict> resourceusestransparency <bool> @@ -2912,7 +2895,7 @@ currentdict /PDF2PS_matrix_key undef pop //false exit } loop exch pop -} bind executeonly def +} bind def % Check if the annotations on a page use transparency /annotsusetransparency { % <page dict> annotsusetransparency <bool> @@ -2949,14 +2932,14 @@ currentdict /PDF2PS_matrix_key undef } ifelse } forall % For all annots on the page } if -} bind executeonly def +} bind def % Add a color name to our spot color list. Ignore /All and /None /putspotcolor { % <name> <spotcolordict> putspotcolor - % The 'name' could be a string. If so then convert to a name. exch dup type /stringtype eq { cvn } if dup dup /None eq exch /All eq or { pop pop } { 0 put } ifelse -} bind executeonly def +} bind def % Determine which spot colors are used within a color space Note: This % dict will include all colors used in Separation or DeviceN color spaces. @@ -2981,7 +2964,7 @@ currentdict /PDF2PS_matrix_key undef } ifelse } if pop pop -} bind executeonly def +} bind def % Check the Resources of a page, form, or annotation. Determine which spot % colors are used within the resource Note: The spot color dict will include @@ -3056,7 +3039,7 @@ currentdict /PDF2PS_matrix_key undef } if exit } loop -} bind executeonly def +} bind def % Determine which spot colors are used within the annotations. Note: This % dict will include all colors used in Separation or DeviceN color spaces. @@ -3075,7 +3058,7 @@ currentdict /PDF2PS_matrix_key undef pop } ifelse } forall -} bind executeonly def +} bind def % Determine spot colors are used within a page. We are creating a dict to % hold the spot color names as keys. Using a dict avoids having to worry @@ -3110,7 +3093,7 @@ currentdict /PDF2PS_matrix_key undef 3 -1 roll /Annots knownoget { annotsspotcolors } if pop % Discard reference loop dict -} bind executeonly def +} bind def % Determine how many (if any) spot colors are used by a page. % Note: This count does not include Cyan, Magenta, Yellow, or Black @@ -3121,7 +3104,7 @@ currentdict /PDF2PS_matrix_key undef [ /Cyan /Magenta /Yellow /Black ] { 2 index exch known { 1 sub } if } forall exch pop % Remove spot color dict -} bind executeonly def +} bind def % ------ ColorSpace substitution support ------ % @@ -3151,7 +3134,7 @@ currentdict /PDF2PS_matrix_key undef } ifelse } if } if -} bind executeonly def +} bind def %% <loopdict> <Objectdict> <calling obj_num> pdfform_detect_cspacesub <boolean> %% @@ -3235,7 +3218,7 @@ currentdict /PDF2PS_matrix_key undef } loop %% remove and discard the loopdict exch pop -} bind executeonly def +} bind def % % <pagedict> pdfshowpage_detect_cspacesub <pagedict> <boolean> @@ -3253,7 +3236,7 @@ currentdict /PDF2PS_matrix_key undef /HighLevelDevice /GetDeviceParam .special_op { exch pop not exch pop }if -} bind executeonly def +} bind def % % <pagedict> pdfshowpage_setcspacesub <pagedict> @@ -3326,7 +3309,7 @@ currentdict /PDF2PS_matrix_key undef pop } ifelse } if -} bind executeonly def +} bind def % Write OutputIntents to device if the device handles it /writeoutputintents { @@ -3387,7 +3370,7 @@ currentdict /PDF2PS_matrix_key undef pop pop } if } if -} bind executeonly def +} bind def end % pdfdict .setglobal @@ -3410,7 +3393,6 @@ DELAYBIND not { /.setfillconstantalpha /.setalphaisshape /.currentalphaisshape /.settextspacing /.currenttextspacing /.settextleading /.currenttextleading /.settextrise /.currenttextrise /.setwordspacing /.currentwordspacing /.settexthscaling /.currenttexthscaling -/.setdistillerparams % Used by our own test suite files %/.pushpdf14devicefilter % transparency-example.ps diff --git a/Master/tlpkg/tlgs/Resource/Init/pdf_ops.ps b/Master/tlpkg/tlgs/Resource/Init/pdf_ops.ps index 54d58679048..589d0d5d927 100644 --- a/Master/tlpkg/tlgs/Resource/Init/pdf_ops.ps +++ b/Master/tlpkg/tlgs/Resource/Init/pdf_ops.ps @@ -22,7 +22,7 @@ % to think this interpreter is a distiller. % (If this interpreter really is a distiller, don't do this.) systemdict /pdfmark known not - { userdict /pdfmark { cleartomark } bind executeonly put } if + { userdict /pdfmark { cleartomark } bind put } if userdict /GS_PDF_ProcSet 256 dict dup begin @@ -71,10 +71,10 @@ nodict readonly pop 20 dict copy dup begin 1 packedarray cvx executeonly /self exch def graphicsbeginpage textbeginpage -} bind executeonly def +} bdef /endpage { % - endpage - showpage end -} bind executeonly def +} bdef /graphicsbeginpage { initgraphics @@ -82,7 +82,7 @@ nodict readonly pop currentdict /ClipRect knownoget { aload pop rectclip } if 0 g 0 G //false op //false OP 0 OPM 1 ca 1 CA //null SMask //false AIS /Compatible BM //true TK -} bind executeonly def +} bdef % We must allow /Show to be set, otherwise a text operation can % end up in infinite recursion with showfirst calling Show, and @@ -102,7 +102,7 @@ end def exch currentdict //nodict eq { /self dup load end 5 dict begin def } if def } ifelse - } bind executeonly def + } bdef currentdict /gput_always_allow .undef /q { @@ -131,9 +131,6 @@ currentdict /gput_always_allow .undef %% original TextSaveMatrix behind allows the matching ET not to throw an error, as well as coping %% with the various other problems listed above. Its not pretty though. currentdict /TextSaveMatrix known { - ( **** Error: Encountered a 'q' inside a Text Object, this is illegal.\n) - pdfformaterror - ( Output may be incorrect..\n) pdfformaterror currentdict /TextSaveMatrix get matrix copy gsave //nodict begin /qTextSaveMatrix gput @@ -142,7 +139,7 @@ currentdict /gput_always_allow .undef }ifelse } ifelse PDFusingtransparency { .pushextendedgstate } if -} bind executeonly def +} bdef % Some PDF files have excess Q operators! /Q { @@ -196,12 +193,12 @@ currentdict /gput_always_allow .undef pdfformaterror } ifelse } if -} bind executeonly def +} bdef % Save PDF gstate /qstate { % - qstate <qstate> gstate -} bind executeonly def +} bdef % Set PDF gstate /setqstate { % <qstate> setqstate - @@ -212,11 +209,11 @@ currentdict /gput_always_allow .undef exch setgstate matrix currentmatrix matrix setmatrix exch newpath uappend setmatrix } ifelse -} bind executeonly def +} bdef % ---------------- Color setting ---------------- % -/nullpatternproc { pop } bind executeonly def +/nullpatternproc { pop } bdef /nullpattern mark /PatternType 1 /PaintType 1 /TilingType 3 /BBox [0 0 1 1] /XStep 1 /YStep 1 /PaintProc //nullpatternproc @@ -267,33 +264,33 @@ currentdict /gput_always_allow .undef DefaultQstate exch put } if } ifelse -} bind executeonly def +} bdef /CSdict mark - /DeviceGray { 0 } bind executeonly - /DeviceRGB { [0 0 0] cvx } bind executeonly - /DeviceCMYK { [0 0 0 1] cvx } bind executeonly - /CIEBasedA { 0 } bind executeonly - /CIEBasedABC { [0 0 0] cvx } bind executeonly - /CalGray { pop /DeviceGray 0 } bind executeonly - /CalRGB { pop /DeviceRGB [0 0 0] cvx } bind executeonly - /Lab {[0 0 0] cvx } bind executeonly - /ICCBased { [ 1 index 1 oget /N get { 0 } repeat ] cvx } bind executeonly - /Separation { 1 } bind executeonly + /DeviceGray { 0 } bind + /DeviceRGB { [0 0 0] cvx } bind + /DeviceCMYK { [0 0 0 1] cvx } bind + /CIEBasedA { 0 } bind + /CIEBasedABC { [0 0 0] cvx } bind + /CalGray { pop /DeviceGray 0 } bind + /CalRGB { pop /DeviceRGB [0 0 0] cvx } bind + /Lab {[0 0 0] cvx } bind + /ICCBased { [ 1 index 1 oget /N get { 0 } repeat ] cvx } bind + /Separation { 1 } bind /DeviceN { % What is the correct value?? [ 1 index 1 get length { 1 } repeat ] cvx - } bind executeonly - /Indexed { 0 } bind executeonly - /Pattern { //nullpattern matrix makepattern } bind executeonly + } bind + /Indexed { 0 } bind + /Pattern { //nullpattern matrix makepattern } bind .dicttomark readonly def -/ri {//.renderingintentdict exch .knownget { .setrenderingintent } if } bind executeonly def -/g {/DeviceGray .setfillcolorspace .setfillcolor } bind executeonly def -/G {/DeviceGray .setstrokecolorspace .setstrokecolor} bind executeonly def -/rg {/DeviceRGB .setfillcolorspace .setfillcolor} bind executeonly def -/RG {/DeviceRGB .setstrokecolorspace .setstrokecolor} bind executeonly def -/k {/DeviceCMYK .setfillcolorspace .setfillcolor} bind executeonly def -/K {/DeviceCMYK .setstrokecolorspace .setstrokecolor} bind executeonly def +/ri {//.renderingintentdict exch .knownget { .setrenderingintent } if } bdef +/g {/DeviceGray .setfillcolorspace .setfillcolor } bdef +/G {/DeviceGray .setstrokecolorspace .setstrokecolor} bdef +/rg {/DeviceRGB .setfillcolorspace .setfillcolor} bdef +/RG {/DeviceRGB .setstrokecolorspace .setstrokecolor} bdef +/k {/DeviceCMYK .setfillcolorspace .setfillcolor} bdef +/K {/DeviceCMYK .setstrokecolorspace .setstrokecolor} bdef /cs {dup dup type /nametype ne { 0 get } if dup /ICCBased eq { 1 index 1 get /OrigN .knownget not {1 index 1 get /N get} if mark @@ -328,7 +325,7 @@ currentdict /gput_always_allow .undef } { //CSdict exch get exec exch .setfillcolorspace exec .setfillcolor } ifelse -} bind executeonly def +} bdef /CS {dup dup type /nametype ne { 0 get } if dup /ICCBased eq { 1 index 1 get /OrigN .knownget not {1 index 1 get /N get} if mark @@ -362,11 +359,11 @@ currentdict /gput_always_allow .undef } { //CSdict exch get exec exch .setstrokecolorspace exec .setstrokecolor } ifelse -} bind executeonly def -/sc {.setfillcolor} bind executeonly def -/SC {.setstrokecolor} bind executeonly def -/sc* {.setfillcolor} bind executeonly def -/SC* {.setstrokecolor} bind executeonly def +} bdef +/sc {.setfillcolor} bdef +/SC {.setstrokecolor} bdef +/sc* {.setfillcolor} bdef +/SC* {.setstrokecolor} bdef /sc*_and_set { dup type /dicttype eq { @@ -379,7 +376,7 @@ currentdict /gput_always_allow .undef } ifelse } if .setfillcolor -} bind executeonly def +} bdef /SC*_and_set { dup type /dicttype eq { @@ -392,9 +389,9 @@ currentdict /gput_always_allow .undef } ifelse } if .setstrokecolor -} bind executeonly def -/sc1 {.setfillcolor} bind executeonly def -/SC1 {.setstrokecolor} bind executeonly def +} bdef +/sc1 {.setfillcolor} bdef +/SC1 {.setstrokecolor} bdef /sc1_and_set { dup type /dicttype eq { @@ -407,7 +404,7 @@ currentdict /gput_always_allow .undef } ifelse } if .setfillcolor -} bind executeonly def +} bdef /SC1_and_set { dup type /dicttype eq { @@ -420,9 +417,9 @@ currentdict /gput_always_allow .undef } ifelse } if .setstrokecolor -} bind executeonly def -/csput {dup dup type /nametype ne { 0 get } if //CSdict exch get exec exch 2 copy .setfillcolorspace exec .setfillcolor .setstrokecolorspace exec .setstrokecolor} bind executeonly def -/csset {dup dup type /nametype ne { 0 get } if //CSdict exch get exec exch} bind executeonly def +} bdef +/csput {dup dup type /nametype ne { 0 get } if //CSdict exch get exec exch 2 copy .setfillcolorspace exec .setfillcolor .setstrokecolorspace exec .setstrokecolor} bdef +/csset {dup dup type /nametype ne { 0 get } if //CSdict exch get exec exch} bdef % ---------------- Color setting ---------------- % @@ -430,14 +427,14 @@ currentdict /gput_always_allow .undef % ---------------- Overprint/transparency setting ---------------- % /op { .setfilloverprint -} bind executeonly def % NB pdf_draw:gsparamdict handled /OP with no /op +} bdef % NB pdf_draw:gsparamdict handled /OP with no /op /OP { .setstrokeoverprint -} bind executeonly def +} bdef /OPM { /.setoverprintmode where { pop dup .setoverprintmode .swapcolors .setoverprintmode .swapcolors } { pop } ifelse -} bind executeonly def -/ca { .setfillconstantalpha } bind executeonly def -/CA { .setstrokeconstantalpha } bind executeonly def +} bdef +/ca { .setfillconstantalpha } bdef +/CA { .setstrokeconstantalpha } bdef /SMask { dup type /booleantype eq { .currentSMask type /dicttype eq { @@ -454,8 +451,8 @@ currentdict /gput_always_allow .undef %% a gsave, so we haven't copied it to /self, if we don't do that here %% then transparent annotations cause an invalid access error. currentdict //nodict eq {/self dup load end 5 dict begin def} if -} bind executeonly def -/AIS { .setalphaisshape } bind executeonly def +} bdef +/AIS { .setalphaisshape } bdef /BM { /.setblendmode where { pop [ exch dup type /nametype ne { aload pop } if /Normal ] { @@ -464,15 +461,15 @@ currentdict /gput_always_allow .undef } { pop } ifelse -} bind executeonly def +} bdef /TK { /.settextknockout where { pop .settextknockout } { pop } ifelse -} bind executeonly def +} bdef /UseBlackPtComp { %% Our implementation of black point compensation uses 0 or 1, not a boolean /.setblackptcomp where {pop false eq {0}{1}ifelse .setblackptcomp }{ pop } ifelse -} bind executeonly def +} bdef % ---------------- Color installation ---------------- % @@ -491,7 +488,7 @@ currentdict /gput_always_allow .undef } { pop pop } ifelse -} bind executeonly def +} bdef /.settransparencymask { % <paramdict> <masknum> .settransparencymask - exch dup type /dicttype ne { PDFusingtransparency { @@ -510,24 +507,24 @@ currentdict /gput_always_allow .undef dup /Draw get exec } ifelse } ifelse -} bind executeonly def +} bdef % (Non-mask) images must execute setfillblend. /setfillblend { .currentfillconstantalpha .currentSMask .settransparencyparams -} bind executeonly def +} def /setfillstate { setfillblend -} bind executeonly def +} def /setstrokestate { .currentstrokeconstantalpha .currentSMask .settransparencyparams -} bind executeonly def +} def /Cdict 15 dict dup begin % <color...> <colorspace> -proc- - - /DeviceGray { pop setgray } bind executeonly def - /DeviceRGB { pop setrgbcolor } bind executeonly def - /DeviceCMYK { pop setcmykcolor } bind executeonly def - /CIEBasedA { setgcolorspace setcolor } bind executeonly def + /DeviceGray { pop setgray } bdef + /DeviceRGB { pop setrgbcolor } bdef + /DeviceCMYK { pop setcmykcolor } bdef + /CIEBasedA { setgcolorspace setcolor } bdef /CIEBasedABC /CIEBasedA load def /CIEBasedDEF /CIEBasedA load def /CIEBasedDEFG /CIEBasedA load def @@ -583,7 +580,7 @@ currentdict /gput_always_allow .undef cleartomark pop } ifelse - } bind executeonly def + } bdef /Separation /CIEBasedA load def /DeviceN /CIEBasedA load def /Indexed /CIEBasedA load def @@ -635,37 +632,37 @@ currentdict /gput_always_allow .undef } if } ifelse setcolor - } bind executeonly def + } bdef end def /setgcolor % (null | <color...>) <colorspace> setgcolor - { 1 index //null eq { pop pop } { dup 0 get //Cdict exch get exec } ifelse - } bind executeonly def + } bdef % Compare the old and new color spaces in an attempt to avoid expensive % reloads of CIEBased color spaces. /PCSdict 15 dict dup begin % <colorspace> -proc- <colorspace|pdfcspace> - /CIEBasedA { dup 1 get /PDFColorSpace .knownget { exch pop } if } bind executeonly def + /CIEBasedA { dup 1 get /PDFColorSpace .knownget { exch pop } if } bdef /CIEBasedABC /CIEBasedA load def /CIEBasedDEF /CIEBasedA load def /CIEBasedDEFG /CIEBasedA load def /Indexed { dup 1 get dup pdfcolorspace 2 copy ne { 3 1 roll } if pop pop - } bind executeonly def + } bdef end def /pdfcolorspace { % <colorspace> pdfcolorspace <colorspace|pdfcspace> dup type /arraytype eq { //PCSdict 1 index 0 get .knownget { exec } if } if -} bind executeonly def +} bdef /setgcolorspace { % <colorspace> setgcolorspace - dup pdfcolorspace currentcolorspace pdfcolorspace eq { pop } { setcolorspace } ifelse -} bind executeonly def +} bdef /OPsavedict 2 dict def % for saveOP, saveBM @@ -688,7 +685,7 @@ end def } { pop //false } ifelse -} bind executeonly def +} bdef /fsexec % <fillop|strokeop> fsexec - { @@ -716,7 +713,7 @@ end def } { cvx exec } ifelse -} bind executeonly def +} bdef % ---------------- Path painting and clipping ---------------- % @@ -737,9 +734,9 @@ end def currentdict /qTextSaveMatrix get setmatrix } if } ifelse -} bind executeonly def +} bind def -/normal_m { { moveto } stopped { count pdfemptycount sub 2 .min { pop } repeat 0 0 moveto } if } bind executeonly def +/normal_m { { moveto } stopped { count pdfemptycount sub 2 .min { pop } repeat 0 0 moveto } if } bdef /inside_text_m { { matrix currentmatrix 3 1 roll @@ -748,9 +745,9 @@ end def setmatrix } stopped { count pdfemptycount sub 2 .min { pop } repeat 0 0 moveto } if -} bind executeonly def +} bdef -/normal_l { { lineto } stopped { count pdfemptycount sub 2 .min { pop } repeat } if } bind executeonly def +/normal_l { { lineto } stopped { count pdfemptycount sub 2 .min { pop } repeat } if } bdef /inside_text_l { { matrix currentmatrix 3 1 roll @@ -759,9 +756,9 @@ end def setmatrix } stopped { count pdfemptycount sub 2 .min { pop } repeat } if -} bind executeonly def +} bdef -/normal_c { { curveto } stopped { count pdfemptycount sub 6 .min { pop } repeat } if } bind executeonly def +/normal_c { { curveto } stopped { count pdfemptycount sub 6 .min { pop } repeat } if } bdef /inside_text_c { { matrix currentmatrix 7 1 roll @@ -770,14 +767,14 @@ end def setmatrix } stopped { count pdfemptycount sub 6 .min { pop } repeat } if -} bind executeonly def +} bdef /normal_v { count pdfemptycount sub 4 ge { { currentpoint 6 2 roll curveto } stopped { count pdfemptycount sub 6 .min { pop } repeat } if } { count pdfemptycount sub { pop } repeat } ifelse - } bind executeonly def + } bdef /inside_text_v { count pdfemptycount sub 4 ge { { matrix currentmatrix 5 1 roll @@ -788,9 +785,9 @@ end def } { count pdfemptycount sub { pop } repeat } ifelse - } bind executeonly def + } bdef -/normal_y { { 2 copy curveto } stopped { count pdfemptycount sub 6 .min { pop } repeat } if } bind executeonly def +/normal_y { { 2 copy curveto } stopped { count pdfemptycount sub 6 .min { pop } repeat } if } bdef /inside_text_y { { matrix currentmatrix 5 1 roll @@ -799,19 +796,19 @@ end def setmatrix } stopped { count pdfemptycount sub 6 .min { pop } repeat } if -} bind executeonly def +} bdef /normal_re { 4 2 roll moveto exch dup 0 rlineto 0 3 -1 roll rlineto neg 0 rlineto closepath - } bind executeonly def + } bdef /inside_text_re { matrix currentmatrix 5 1 roll check_and_set_saved_matrix 4 2 roll moveto exch dup 0 rlineto 0 3 -1 roll rlineto neg 0 rlineto closepath setmatrix - } bind executeonly def + } bdef /S { OFFlevels length 0 eq { @@ -819,7 +816,7 @@ end def } { newpath } ifelse -} bind executeonly def +} bdef /f { OFFlevels length 0 eq { @@ -827,7 +824,7 @@ end def } { newpath } ifelse -} bind executeonly def +} bdef /f* { OFFlevels length 0 eq { @@ -835,11 +832,11 @@ end def } { newpath } ifelse -} bind executeonly def +} bdef -/n { newpath } bind executeonly def % don't allow n to get bound in +/n { newpath } bdef % don't allow n to get bound in -/s { closepath S } bind executeonly def +/s { closepath S } bdef /B { OFFlevels length 0 eq { @@ -863,9 +860,9 @@ end def } { newpath } ifelse -} bind executeonly def +} bdef -/b { closepath B } bind executeonly def +/b { closepath B } bdef /B* { OFFlevels length 0 eq { @@ -889,16 +886,16 @@ end def } { newpath } ifelse -} bind executeonly def +} bdef -/b* { closepath B* } bind executeonly def +/b* { closepath B* } bdef % 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 setstrokestate .swapcolors stroke .swapcolors grestore } if n } bdef +/f { OFFlevels length 0 eq { gsave setfillstate fill grestore } if n } bdef +/f* { OFFlevels length 0 eq { gsave setfillstate eofill grestore } if n } bdef /B { OFFlevels length 0 eq { PDFusingtransparency { @@ -923,8 +920,8 @@ end def } ifelse } if n -} bind executeonly def -/b { closepath B } bind executeonly def +} bdef +/b { closepath B } bdef /B* { OFFlevels length 0 eq { PDFusingtransparency { @@ -946,16 +943,16 @@ end def } ifelse } if n -} bind executeonly def -/b { closepath B* } bind executeonly def -/n { end { currentpoint } stopped not { pop pop clip } if newpath } bind executeonly def +} bdef +/b { closepath B* } bdef +/n { end { currentpoint } stopped not { pop pop clip } if newpath } bdef end readonly def -/W { //Wdict begin } bind executeonly def +/W { //Wdict begin } bdef /W*dict 8 dict dup begin Wdict { def } forall -/n { end { currentpoint } stopped not { pop pop eoclip } if newpath } bind executeonly def +/n { end { currentpoint } stopped not { pop pop eoclip } if newpath } bdef end readonly def -/W* { //W*dict begin } bind executeonly def +/W* { //W*dict begin } bdef % ---------------- Text control ---------------- % /textbeginpage @@ -964,7 +961,7 @@ end readonly def /FontMatrixNonHV //false def /Show { showfirst } def /TextFillStateNeeded //true def - } bind executeonly def + } bdef /TestDegenerateCTM { matrix currentmatrix @@ -980,7 +977,7 @@ end readonly def }{ false } ifelse -} bind executeonly def +} bdef % Contrary to the statement in the PDF manual, BT and ET *can* be nested, % if the CharProc for a Type 3 font does a BT/ET itself. @@ -1004,7 +1001,7 @@ end readonly def 1 scale } if .currenttextrise 0 ne { 0 .currenttextrise translate } if -} bind executeonly def +} bdef /settextstate { % The text state can be set even outside BT/ET. @@ -1024,23 +1021,7 @@ end readonly def 6 array astore setmatrix settextmatrix } if - currentdict /qTextSaveMatrix known { - qTextSaveMatrix - aload pop - 5 index 0 ne 3 index 0 ne and - 5 index 0 ne 5 index 0 ne and or not { - (\n **** Error: Invalid (0 scaling) text matrix for Tm ****\n) - pdfformaterror - ( Output may be incorrect.\n) pdfformaterror - % handle invalid scale by using a really small value - 2 -6 roll pop pop pop pop - 0.00000001 0 0 0.00000001 - 6 -2 roll - }if - 6 array astore - setmatrix settextmatrix - } if -} bind executeonly def +} bdef /settextposition { % Update the TextMatrix translation. gsave TextSaveMatrix setmatrix @@ -1065,13 +1046,7 @@ end readonly def ( Ignroing error, output may be incorrect.\n) pdfformaterror grestore } ifelse -} bind executeonly def - -%% Do not make the procedures here executeonly. The /m procedure is -%% tested in /.pdf_paintproc in pdf_draw.ps, we need to be able to -%% read the name of the procedure from here in order to determine -%% whether we are inside a text block. The procedures themselves -%% are already executeonly anyway. +} bdef /switch_to_text_marking_ops { pdfopdict /m {inside_text_m} bind .forceput @@ -1080,7 +1055,7 @@ end readonly def pdfopdict /v {inside_text_v} bind .forceput pdfopdict /y {inside_text_y} bind .forceput pdfopdict /re {inside_text_re} bind .forceput -} bind executeonly def +} bdef /switch_to_normal_marking_ops { pdfopdict /m {normal_m} bind .forceput @@ -1089,7 +1064,7 @@ end readonly def pdfopdict /v {normal_v} bind .forceput pdfopdict /y {normal_y} bind .forceput pdfopdict /re {normal_re} bind .forceput -} bind executeonly def +} bdef /BT { currentdict /TextSaveMatrix known { @@ -1131,7 +1106,7 @@ end readonly def .begintransparencytextgroup } if -} bind executeonly def +} bdef /ET_NO_TXT_KO { currentdict /TextSaveMatrix known { @@ -1156,7 +1131,7 @@ end readonly def currentdict /qTextSaveMatrix known not { switch_to_normal_marking_ops } if -} bind executeonly def +} bdef /ET { //ET_NO_TXT_KO exec @@ -1164,13 +1139,13 @@ end readonly def PDFusingtransparency .currenttextknockout and { .endtransparencytextgroup } if -} bind executeonly def +} bdef -/Tc { .settextspacing { 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 -/Tw { .setwordspacing { showfirst } /Show gput } bind executeonly def +/Tc { .settextspacing { showfirst } /Show gput } bdef +/TL { .settextleading } bdef +/Tr { .settextrenderingmode { showfirst } /Show gput } bdef +/Ts { .settextrise settextstate } bdef +/Tw { .setwordspacing { showfirst } /Show gput } bdef /Tz { dup 0 eq { (\n **** Error: Invalid 0.0 horizontal text scaling given for Tz\n) @@ -1180,7 +1155,7 @@ end readonly def }{ 100 div }ifelse .settexthscaling %/TextHScaling gput - settextstate} bind executeonly def + settextstate} bdef % ---------------- Font control ---------------- % @@ -1200,7 +1175,7 @@ end readonly def } { //false } ifelse -} bind executeonly def +} bdef % Worker procedure for recursive checking of font matrices /?FontMatrixNonHV { % {self} ?horz <<font>> -- {self} ?horz ?nonhv 2 copy //?FontMatrixNonHV exec { % check the font's own FontMatrix @@ -1228,7 +1203,7 @@ end readonly def %stack: {testproc} ?nonhv {self} ?horz 4 2 roll exch pop } ifelse -} bind executeonly def +} bdef % Main procedure /?FontMatrixNonHV { % <<rootfont>> -- ?nonhv //?FontMatrixNonHV exch @@ -1238,7 +1213,7 @@ end readonly def % call the worker procedure //?FontMatrixNonHV exec exch pop exch pop -} bind executeonly def +} bdef /Tf { % <font> <scale> Tf - dup .setPDFfontsize @@ -1258,7 +1233,7 @@ end readonly def pop } ifelse setfont -} bind executeonly def +} bdef % Copy a font, removing its FID. If changed is true, also remove % the UniqueID and XUID, if any. If the original dictionary doesn't have @@ -1302,7 +1277,7 @@ end readonly def {dup 3 -1 roll /.OrigUniqueIDXUID exch put} ifelse -} bind executeonly def +} bdef % Insert a new Encoding or Metrics into a font if necessary. % Return a possibly updated font, and a flag to indicate whether @@ -1314,7 +1289,7 @@ end readonly def } { pop //false } ifelse -} bind executeonly def +} bdef /.updatefontencoding { % <font> <Encoding|null> .updatefontencoding % <font'> <copied> @@ -1323,7 +1298,7 @@ end readonly def } { pop //false } ifelse -} bind executeonly def +} bdef % Duplicate keys in CharString dictionary according to GlyphMap: <</new_glyph /old_glyph>> % We have to do this because PDF fonts can associate multiple widths with the same glyph @@ -1354,7 +1329,7 @@ end readonly def } { pop //false } ifelse -} bind executeonly def +} bdef /.updatefont { % <font> <Encoding|null> <Metrics|null> <GlyphMap|null> % .updatefont <font'> <copied> @@ -1365,7 +1340,7 @@ end readonly def 3 1 roll exch % bool bool <font> <Metrics|null> .updatefontmetrics % bool bool <font> bool 4 2 roll or or % <font> is_copied -} bind executeonly def +} bdef % ---------------- Text positioning ---------------- % @@ -1395,9 +1370,9 @@ end readonly def matrix .currenttextlinematrix .settextmatrix settextstate -} bind executeonly def -/TD { dup neg .settextleading Td } bind executeonly def -/T* { 0 .currenttextleading neg Td } bind executeonly def +} bdef +/TD { dup neg .settextleading Td } bdef +/T* { 0 .currenttextleading neg Td } bdef /Tm { 5 index 0 ne 3 index 0 ne and 5 index 0 ne 5 index 0 ne and or not { @@ -1412,27 +1387,27 @@ end readonly def matrix .currenttextlinematrix astore .settextlinematrix matrix .currenttextlinematrix .settextmatrix settextstate -} bind executeonly def +} bdef % ---------------- Text painting ---------------- % /Vexch { rootfont /WMode knownoget { 1 eq { exch } if } if -} bind executeonly def +} bind def /textrenderingprocs [ % (0 is handled specially) % Painting-only modes - { tf } executeonly { tS } executeonly { tB } executeonly { tn } + { tf } { tS } { tB } { tn } % Clipping modes - { gsave tf grestore tW } executeonly - { gsave tS grestore tW } executeonly - { gsave tB grestore tW } executeonly - { tW } executeonly + { gsave tf grestore tW } + { gsave tS grestore tW } + { gsave tB grestore tW } + { tW } ] readonly def /pdfwrite_textrenderingprocs [ % Tr 0 - Fill - { setfillstate show } bind executeonly + { setfillstate show } bind % Tr 1 - Stroke { currentlinewidth exch setstrokestate % Need to set the stroke width to a value which gives the correct @@ -1440,11 +1415,7 @@ end readonly def % CTM, so we need to calculate the stroke width which would result % if the CTM had been unity. currentlinewidth dup - currentdict /qTextSaveMatrix known { - matrix defaultmatrix idtransform qTextSaveMatrix dtransform - }{ - matrix defaultmatrix idtransform TextSaveMatrix dtransform - } ifelse + matrix defaultmatrix idtransform TextSaveMatrix dtransform abs 2 copy exch abs eq { pop }{ @@ -1452,7 +1423,7 @@ end readonly def % we can ignore it. (wrong answer, but consistent) pop pop currentlinewidth }ifelse setlinewidth - show setlinewidth} bind executeonly + show setlinewidth} bind % Tr 2 - Fill then Stroke { currentlinewidth exch setstrokestate % Need to set the stroke width to a value which gives the correct @@ -1460,11 +1431,7 @@ end readonly def % CTM, so we need to calculate the stroke width which would result % if the CTM had been unity. currentlinewidth dup - currentdict /qTextSaveMatrix known { - matrix defaultmatrix idtransform qTextSaveMatrix dtransform - }{ - matrix defaultmatrix idtransform TextSaveMatrix dtransform - } ifelse + matrix defaultmatrix idtransform TextSaveMatrix dtransform abs 2 copy exch abs eq { pop }{ @@ -1472,9 +1439,9 @@ end readonly def % we can ignore it. (wrong answer, but consistent) pop pop currentlinewidth }ifelse setlinewidth - setfillstate show setlinewidth} bind executeonly + setfillstate show setlinewidth} bind % Tr 3 - Neither fill nor stroke - { setfillstate show } bind executeonly + { setfillstate show } bind % % pdfwrite emits all text inside a gsave/grestore pair. As % a result we can't preserve any of the 'clip' modes, as the @@ -1483,7 +1450,7 @@ end readonly def % % Tr 4 - Fill, add to clip { gsave 0 .settextrenderingmode - setfillstate dup show grestore //true charpath } bind executeonly + setfillstate dup show grestore //true charpath } bind % Tr 5 - Stroke, add to clip { gsave 1 .settextrenderingmode currentlinewidth dup @@ -1496,15 +1463,11 @@ end readonly def pop pop currentlinewidth }ifelse setlinewidth setstrokestate dup show grestore - //true charpath} bind executeonly + //true charpath} bind % Tr 6 - Fill, stroke, add to clip { gsave 2 .settextrenderingmode currentlinewidth dup - currentdict /qTextSaveMatrix known { - matrix defaultmatrix idtransform qTextSaveMatrix dtransform - }{ - matrix defaultmatrix idtransform TextSaveMatrix dtransform - } ifelse + matrix defaultmatrix idtransform TextSaveMatrix dtransform abs 2 copy exch abs eq { pop }{ @@ -1513,9 +1476,9 @@ end readonly def pop pop currentlinewidth }ifelse setlinewidth setstrokestate setfillstate dup show grestore - //true charpath} bind executeonly + //true charpath} bind % Tr 7 - Add to clip - { //true charpath} bind executeonly + { //true charpath} bind ] readonly def /setstrokeforTrpreservation { @@ -1546,12 +1509,12 @@ end readonly def setlinewidth } if } if -} bind executeonly def +} bind def % conditionally set fillstate to avoid multiple operations during text operators /settextfillstate { TextFillStateNeeded { setfillstate //false /TextFillStateNeeded gput } if -} bind executeonly def +} bind def % If current path is not known to be valid, use the clip path /TextTransSetup { % showarg path_valid TextTransSetup false showarg @@ -1574,7 +1537,7 @@ end readonly def } { pop % discard path_valid boolean } ifelse -} bind executeonly def +} bind def /TextTransTeardown { % stack: path_valid .currentblendmode /CompatibleOverprint eq { @@ -1585,7 +1548,7 @@ end readonly def .currentSMask //null ne { .endtransparencygroup } if -} bind executeonly def +} bind def /setshowstate { @@ -1781,8 +1744,8 @@ end readonly def ifelse } ifelse /Show gput - } bind executeonly def -/showfirst { setshowstate Show } executeonly def + } bdef +/showfirst { setshowstate Show } def /Tj { { @@ -1795,9 +1758,9 @@ end readonly def gsave nulldevice exec grestore } ifelse //true /TextFillStateNeeded gput -} bind executeonly def -/' { T* Tj } bind executeonly def -/" { exch Tc exch Tw T* Tj } bind executeonly def +} bdef +/' { T* Tj } bdef +/" { exch Tc exch Tw T* Tj } bdef /TJ { { 0 0 moveto { dup type /stringtype eq { @@ -1815,7 +1778,7 @@ end readonly def gsave nulldevice exec grestore } ifelse //true /TextFillStateNeeded gput -} bind executeonly def +} bdef % NB: We don't need clippath when filling or stroking /tf { @@ -1823,7 +1786,7 @@ end readonly def //true /TextFillStateNeeded gput settextfillstate //true TextTransSetup currentpoint fill TextTransTeardown moveto } if -} bind executeonly def +} bdef /tn { currentpoint newpath moveto } bdef % Obsolete, never used. % For stroking characters, temporarily restore the graphics CTM so that % the line width will be transformed properly. @@ -1837,14 +1800,12 @@ end readonly def { .currentPDFfontsize 0 eq not { setstrokestate //true TextTransSetup - currentpoint //Tmatrix currentmatrix TextSaveMatrix setmatrix - currentdict /qTextSaveMatrix known {qTextSaveMatrix setmatrix} if - .swapcolors stroke TextTransTeardown .swapcolors + currentpoint //Tmatrix currentmatrix TextSaveMatrix setmatrix .swapcolors stroke TextTransTeardown .swapcolors setmatrix moveto } if } ifelse //true /TextFillStateNeeded gput - } bind executeonly def + } bdef % Handle transparency the same as /B operator /tB { @@ -1864,11 +1825,11 @@ end readonly def gsave tf grestore tS } ifelse //true /TextFillStateNeeded gput -} bind executeonly def +} bdef % This does the wrong thing if there have been multiple text operations % within a single BT/ET pair, but it's a start. -/tW { } bind executeonly def +/tW { } bdef %% split a string containing \r or \n into multiple strings) %% \r\n is also handled. @@ -1908,7 +1869,7 @@ end readonly def } { pop pop pop } ifelse -} bind executeonly def +} bind def % Text formatting and painting for the AcroForm field without appearance streams. /Tform { % <MaxLen> (V) <Ff> <Q> Tform - @@ -2034,7 +1995,7 @@ end readonly def Show % - } ifelse } ifelse -} bind executeonly def +} bdef end readonly put % GS_PDF_ProcSet diff --git a/Master/tlpkg/tlgs/Resource/Init/pdf_rbld.ps b/Master/tlpkg/tlgs/Resource/Init/pdf_rbld.ps index 03654414065..d5e2b11b51c 100644 --- a/Master/tlpkg/tlgs/Resource/Init/pdf_rbld.ps +++ b/Master/tlpkg/tlgs/Resource/Init/pdf_rbld.ps @@ -87,7 +87,7 @@ % Set error flag if we have equal object and generation numbers Generations 4 index get 1 index eq { /dup_obj_gen_num //true def } if } 8 -1 roll { ifelse } { pop if } ifelse % Run 'else' only when rebuilding. -} bind executeonly def +} bind def % Print the contents of the xref array. This actually consists of three % arrays (Objects, Generations, and ObjectStream). @@ -102,7 +102,7 @@ Objects exch get === % print object location } for flush -} bind executeonly def +} bind def % Get token from string and check its type % <string> <type> typed_token <false> % no token or not match @@ -121,7 +121,7 @@ } { pop //false % no token - pop type, set exit status } ifelse % check if we got token -} bind executeonly def +} bind def % Allocate space for post_eof_count to be bound into procedures below. /post_eof_count 0 def @@ -153,7 +153,7 @@ } { pop 0 % no xref, should not happen, report it upstrem } ifelse -} bind executeonly def +} bind def %% Searches backwards from a specified point looking for a 'trailer' keyword. @@ -197,7 +197,7 @@ }if pop % renove the zero leaving the new start position } loop -} bind executeonly def +} bind def % We want the location of the trailer dictionary at the end of file. % We will read the last block of data and search for the final occurance @@ -223,7 +223,7 @@ } { pop pop 0 } ifelse -} bind executeonly def +} bind def % We want to find the trailer dictionary. There is a trailer dictionary % for each xref object list. We only want the trailer dictionary associated @@ -309,7 +309,7 @@ /Trailer exch def pop } ifelse -} bind executeonly def +} bind def % This routine will determine if there is stuff after the %%EOF. There is % supposed to be only a line termination. However many real life files @@ -343,7 +343,7 @@ % Can't even find startxref, assume it's all objects pop 0 } ifelse -} bind executeonly def +} bind def % This routine will scan a file searaching for object locations to build % an alternate version of the data in the xref tables. @@ -422,7 +422,7 @@ pdfformatwarning } if currentdict /Orig_Objects undef -} bind executeonly def +} bind def % Print warning message because we found a problem while reading the xref % tables @@ -436,7 +436,7 @@ ( **** Ghostscript will attempt to recover the data.\n) pdfformaterror ( **** However, the output may be incorrect.\n) pdfformaterror -} bind executeonly def +} bind def % Attempt to recover the XRef data. This is called if we have a failure % while reading the normal XRef tables. This routine usually works @@ -445,4 +445,4 @@ { print_xref_warning % Print warning message count pdfemptycount sub { pop } repeat % remove anything left by readxref search_objects % Search for objects -} bind executeonly def +} bind def diff --git a/Master/tlpkg/tlgs/Resource/Init/pdf_sec.ps b/Master/tlpkg/tlgs/Resource/Init/pdf_sec.ps index 143efb7ea59..fe21c8f2b54 100644 --- a/Master/tlpkg/tlgs/Resource/Init/pdf_sec.ps +++ b/Master/tlpkg/tlgs/Resource/Init/pdf_sec.ps @@ -51,7 +51,7 @@ pdfdict begin 1 dict begin /Key exch def currentdict end /ArcfourDecode filter -} bind executeonly def +} bind def % <ciphertext> <key> arc4decode <plaintext> /arc4decode { @@ -60,7 +60,7 @@ pdfdict begin } { 1 index length string 3 1 roll arc4decodefilter exch readstring pop } ifelse -} bind executeonly def +} bind def % take a stream and aes decrypt it. % <stream> <key> aesdecodefilter <stream> @@ -69,7 +69,7 @@ pdfdict begin /Key exch def currentdict end /AESDecode filter -} bind executeonly def +} bind def % AES decrypt a string, returning a string. The second argument can % be a dictionary of the form << /Key key /Padding false >>, which @@ -92,24 +92,24 @@ pdfdict begin exch readstring pop } ifelse -} bind executeonly def +} bind def /md5 { 16 string dup /MD5Encode filter dup 4 3 roll writestring closefile -} bind executeonly def +} bind def /md5_trunk { md5 0 pdf_key_length getinterval -} bind executeonly def +} bind def /sha256 { 32 string dup /SHA256Encode filter dup 4 3 roll writestring closefile -} bind executeonly def +} bind def % <string> contains_non_ascii <bool> /contains_non_ascii { //false exch { 128 ge { pop //true exit } if } forall -} bind executeonly def +} bind def /pdf_padding_string <28bf4e5e4e758a41 64004e56fffa0108 @@ -122,7 +122,7 @@ def pdf_padding_string 0 32 3 index length sub getinterval concatstrings -} bind executeonly def +} bind def /pdf_xorbytes { % <iter-num> <key> pdf_xorbytes <xored-key> dup length dup string @@ -133,7 +133,7 @@ def 3 copy put pop pop } for 3 1 roll pop pop -} bind executeonly def +} bind def % Get length of encryption key in bytes /pdf_key_length { % pdf_key_length <key_length> @@ -142,7 +142,7 @@ def { pop 5 } % If V == 1 then always use 40 bits { /Length knownoget { -3 bitshift } { 5 } ifelse } ifelse -} bind executeonly def +} bind def % Algorithm 3.2 /pdf_compute_encryption_key { % <password> pdf_compute_encryption_key <key> @@ -198,14 +198,14 @@ def } ifelse % Step 9 - Done in md5_trunk. -} bind executeonly def +} bind def % Algorithm 3.4 /pdf_gen_user_password_R2 { % <filekey> pdf_gen_user_password_R2 <U> % Step 2. pdf_padding_string exch arc4decode -} bind executeonly def +} bind def % Algorithm 3.5 /pdf_gen_user_password_R3 { % <filekey> pdf_gen_user_password_R3 <U> @@ -230,7 +230,7 @@ def } for exch pop -} bind executeonly def +} bind def /pdf_gen_user_password { % <password> pdf_gen_user_password <filekey> <U> % common Step 1 of Algorithms 3.4 and 3.5. @@ -253,7 +253,7 @@ def } ifelse } ifelse } ifelse -} bind executeonly def +} bind def % Algorithm 3.6 % <password> pdf_check_pre_r5_user_password <filekey> true @@ -268,7 +268,7 @@ def } { pop //false } ifelse -} bind executeonly def +} bind def % Compute an owner key, ie the result of step 4 of Algorithm 3.3 /pdf_owner_key % <password> pdf_owner_key <owner-key> @@ -285,7 +285,7 @@ def } if % Step 4 - Done in md5_trunk. -} bind executeonly def +} bind def % Algorithm 3.7 % <password> pdf_check_pre_r5_owner_password <filekey> true @@ -308,7 +308,7 @@ def % <result-of-step-3> pdf_check_pre_r5_user_password -} bind executeonly def +} bind def % Algorithm 3.2a % <password> pdf_check_r5_password <filekey> true @@ -377,7 +377,7 @@ def } if end -} bind executeonly def +} bind def % <password> pdf_check_password <filekey> true % <password> pdf_check_password false @@ -443,7 +443,7 @@ def } ifelse } ifelse } ifelse -} bind executeonly def +} bind def % Process the encryption information in the Trailer. /pdf_process_Encrypt { @@ -511,7 +511,7 @@ def % /pdf_process_Encrypt cvx /invalidfileaccess signalerror % } % if -} bind executeonly def +} bind def % Calculate the key used to decrypt an object (to pass to .decpdfrun or % put into a stream dictionary). @@ -554,7 +554,7 @@ def } ifelse md5 0 FileKey length 5 add 2 index length .min getinterval } ifelse -} bind executeonly def +} bind def % As .pdfrun, but decrypt strings with key <key>. /PDFScanRules_true << /PDFScanRules //true >> def @@ -653,7 +653,7 @@ def /PDFsource PDFsource { store { stop } if } aload pop .packtomark cvx /PDFsource 3 -1 roll store exec - } bind executeonly def + } bind def currentdict /PDFScanRules_true undef currentdict /PDFScanRules_null undef @@ -719,7 +719,7 @@ currentdict /PDFScanRules_null undef } { % Else file is not encrypted PDFfile resolveopdict .pdfrun } ifelse % Ifelse encrypted -} bind executeonly def +} bind def % Prefix a decryption filter to a stream if needed. % Stack: readdata? dict parms file/string filternames @@ -745,7 +745,7 @@ currentdict /PDFScanRules_null undef ifelse exch } if - } bind executeonly def + } bind def end % pdfdict .setglobal |