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/Resource/Init/pdf_ops.ps | |
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/Resource/Init/pdf_ops.ps')
-rw-r--r-- | Master/tlpkg/tlgs/Resource/Init/pdf_ops.ps | 377 |
1 files changed, 169 insertions, 208 deletions
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 |