diff options
Diffstat (limited to 'tex/context/base/back-pdf.mkiv')
-rw-r--r-- | tex/context/base/back-pdf.mkiv | 145 |
1 files changed, 25 insertions, 120 deletions
diff --git a/tex/context/base/back-pdf.mkiv b/tex/context/base/back-pdf.mkiv index 38de4bbfd..cc21355e9 100644 --- a/tex/context/base/back-pdf.mkiv +++ b/tex/context/base/back-pdf.mkiv @@ -19,6 +19,7 @@ \registerctxluafile{lpdf-col}{1.000} \registerctxluafile{lpdf-xmp}{1.001} \registerctxluafile{lpdf-ano}{1.001} +\registerctxluafile{lpdf-res}{1.001} \registerctxluafile{lpdf-mis}{1.001} \registerctxluafile{lpdf-ren}{1.001} \registerctxluafile{lpdf-grp}{1.001} @@ -41,20 +42,20 @@ %D %D Here we initialize some internal quantities. We also protect them. -\pdfoutput \plusone \let\pdfoutput \undefined \newcount\pdfoutput \pdfoutput \plusone +\outputmode \plusone \let\modeoutput \undefined \newcount\outputmode \outputmode \plusone %D These are already set: -\pdfhorigin 1 true in \let\pdfhorigin\undefined \newdimen\pdfhorigin \pdfhorigin 1 true in -\pdfvorigin \pdfhorigin \let\pdfvorigin\undefined \newdimen\pdfvorigin \pdfvorigin \pdfhorigin +\pdfhorigin 1 true in +\pdfvorigin \pdfhorigin %D These too and most of them will be protected as well: \pdfminorversion \plusseven -\pdfgentounicode \plusone \let\pdfgentounicode \undefined \newcount\pdfgentounicode -\pdfinclusioncopyfonts \plusone \let\pdfinclusioncopyfonts \undefined \newcount\pdfinclusioncopyfonts -\pdfinclusionerrorlevel \zerocount \let\pdfinclusionerrorlevel\undefined \newcount\pdfinclusionerrorlevel -\pdfdecimaldigits \plusten \let\pdfdecimaldigits \undefined \newcount\pdfdecimaldigits +\pdfgentounicode \plusone % \let\pdfgentounicode \undefined \newcount\pdfgentounicode +\pdfinclusioncopyfonts \plusone % \let\pdfinclusioncopyfonts \undefined \newcount\pdfinclusioncopyfonts +\pdfinclusionerrorlevel \zerocount % \let\pdfinclusionerrorlevel\undefined \newcount\pdfinclusionerrorlevel +\pdfdecimaldigits \plusten % \let\pdfdecimaldigits \undefined \newcount\pdfdecimaldigits \pdfimageresolution 300 \pdfpkresolution 600 @@ -97,7 +98,7 @@ %D For the moment we keep these. -\newtoks \pdfbackendeveryximage +%newtoks \pdfbackendeveryximage \newtoks \pdfbackendeveryxform %D These are the only official methods to add stuff to the resources. @@ -129,20 +130,9 @@ \pdfbackendsetinfo{ConTeXt.Support}{contextgarden.net}% \to \everylastbackendshipout -%D Transformations. Some day we will use primitives (once they're fixed). +%D Transformations -% todo: inject at the lua end cq. deal with #5 and #6 too - -% % % rotation % % % - -% \unexpanded\def\dostartrotation#1% grouped -% {\forcecolorhack -% \pdfsave -% \pdfsetmatrix{\clf_pdfrotation#1}} - -% \unexpanded\def\dostoprotation -% {\pdfrestore -% \forcecolorhack} +% rotation \unexpanded\def\dostartrotation#1% {\forcecolorhack @@ -151,36 +141,16 @@ \unexpanded\def\dostoprotation {\clf_pdfstoprotation} -% % % scaling % % % - -% \unexpanded\def\dostartscaling#1#2% the test is needed because acrobat is bugged! -% {\forcecolorhack % maybe use signal instead -% \pdfsave -% \pdfsetmatrix -% {\ifdim#1\points=\zeropoint.0001\else#1\fi\space 0 0 -% \ifdim#2\points=\zeropoint.0001\else#2\fi\space}}% 0 0 - -% \unexpanded\def\dostopscaling -% {\pdfrestore -% \forcecolorhack} +% scaling \unexpanded\def\dostartscaling#1#2% {\forcecolorhack - \clf_pdfstartscaling sx #1 sy #2\relax} + \clf_pdfstartscaling rx #1 ry #2\relax} \unexpanded\def\dostopscaling {\clf_pdfstopscaling} -% % % mirroring % % % - -% \unexpanded\def\dostartmirroring -% {\forcecolorhack -% \pdfsave -% \pdfsetmatrix{-1 0 0 1}} % 0 0 - -% \unexpanded\def\dostopmirroring -% {\pdfrestore -% \forcecolorhack} +% mirroring \unexpanded\def\dostartmirroring {\clf_pdfstartmirroring} @@ -188,35 +158,9 @@ \unexpanded\def\dostopmirroring {\clf_pdfstopmirroring} -% % % transform % % % - -% \unexpanded\def\dotransformnextbox#1#2#3#4#5#6% sx rx ry sy tx ty (will change) / basepoints ! -% {\dowithnextbox{\dodotransformnextbox{#5}{#6}{#1 #2 #3 #4}}} +% transform -% \unexpanded\def\dodotransformnextbox#1#2#3% -% {\hbox -% {\kern#1\onebasepoint -% \raise#2\onebasepoint\hbox -% {\pdfsave -% \pdfsetmatrix{#3}% 0 0 (no #5 #6 yet) -% \box\nextbox -% \pdfrestore -% }}} - -% \unexpanded\def\dotransformnextbox#1#2#3#4#5#6% sx rx ry sy tx ty (will change) / basepoints ! -% {% fixing ht/dp/wd should happen elsewhere -% \dowithnextbox{\dodotransformnextbox{#1}{#2}{#3}{#4}{#5}{#6}}} - -% \unexpanded\def\dodotransformnextbox#1#2#3#4#5#6% -% {\hbox -% {\kern #5\onebasepoint -% \raise#6\onebasepoint -% \hbox -% {\clf_pdfstartmatrix sx #1 rx #2 ry #3 sy #4\relax -% \box\nextbox -% \clf_pdfstopmatrix}}} - -\unexpanded\def\dotransformnextbox#1#2#3#4#5#6% sx rx ry sy tx ty (will change) / basepoints ! +\unexpanded\def\dotransformnextbox#1#2#3#4#5#6% {\dowithnextbox{\dodotransformnextbox{#1}{#2}{#3}{#4}{#5}{#6}}} \unexpanded\def\dodotransformnextbox#1#2#3#4#5#6% @@ -224,7 +168,7 @@ {\kern #5\onebasepoint \raise#6\onebasepoint \hbox - {\clf_pdfstartmatrix sx #1 rx #2 ry #3 sy #4\relax + {\clf_pdfstartmatrix rx #1 sx #2 sy #3 ry #4\relax \box\nextbox \clf_pdfstopmatrix}}} @@ -235,8 +179,8 @@ % \box\nextbox} % % \startluacode -% function commands.pdftransformbox(box,sx,rx,ry,sy,tx,ty) -% if sx == 1 and rx == 0 and ry == 0 and sy == 1 then +% function commands.pdftransformbox(box,rx,sx,sy,ry,tx,ty) +% if rx == 1 and sx == 0 and sy == 0 and ry == 1 then % if tx == 0 and ty == 0 then % local b = nodes.hpack(nodes.concat { % nodes.pool.kern(tx), @@ -251,9 +195,9 @@ % local b = nodes.hpack(nodes.concat { % nodes.pool.kern(tx), % nodes.pool.pdfsave(), -% nodes.pool.pdfsetmatrix(sx,rx,ry,sy), +% nodes.pool.pdfsetmatrix(rx,sx,sy,ry), % nodes.takebox(box), -% nodes.pool.pdfsetmatrix(-sx,-rx,-ry,-sy), +% nodes.pool.pdfsetmatrix(-rx,-sx,-sy,-ry), % nodes.pool.pdfrestore(), % }) % b.shift = -ty @@ -262,7 +206,7 @@ % end % \stopluacode -% % % clipping % % % +% clipping \unexpanded\def\dostartclipping#1#2#3% we can move this to lua and only set a box here {\PointsToBigPoints{#2}\width @@ -278,51 +222,12 @@ \unexpanded\def\dostopclipping {\pdfliteral{Q}} -%D The following will move to the backend \LUA\ code: - -%appendtoks \ctxlua{backends.codeinjections.finalizepage ()}\to \everybackendshipout % is immediate -%appendtoks \ctxlua{backends.codeinjections.finalizedocument()}\to \everylastbackendshipout % is immediate - %D Temporary hack, will be removed or improved or default. -%def\TransparencyHack{\ctxlua{backends.codeinjections.addtransparencygroup()}} -\def\TransparencyHack{\setupcolors[\c!pagecolormodel=\v!auto]} - -%D \macros -%D {dostartobject,dostopobject,doinsertobject} - -%D This will change: - -\newbox\objectbox - -\unexpanded\def\dostartobject#1#2#3#4#5% needs to be \unexpanded - {\bgroup - \setbox\objectbox\vbox\bgroup - \def\back_object_stop{\egroup\back_object_register{#1}{#2}}} - -\unexpanded\def\dostopobject % needs to be \unexpanded - {\back_object_stop - \egroup} - -\let\back_object_stop\relax - % attr {/Group << /S /Transparency /I false /K true >>} -\def\back_object_register#1#2% - {\the\pdfbackendeveryxform - \finalizeobjectbox\objectbox - \immediate\pdfxform resources {\pdfbackendcurrentresources}\objectbox - \dosetobjectreference{#1}{#2}\pdflastxform} - -\let\m_back_object_reference\empty - -\unexpanded\def\doinsertobject#1#2% - {\begingroup - \doifelseobjectreferencefound{#1}{#2} - {\dogetobjectreference{#1}{#2}\m_back_object_reference - \pdfrefxform\m_back_object_reference}% - \donothing - \endgroup} +%def\TransparencyHack{\ctxlua{backends.codeinjections.addtransparencygroup()}} +\def\TransparencyHack{\setupcolors[\c!pagecolormodel=\v!auto]} \let\lastpredefinedsymbol\empty % some day we can do more at the lua end @@ -334,7 +239,7 @@ \clf_registerbackendsymbol{#1}\m_back_object_reference\relax \endgroup} -% for the moment here +% Still here: %D \macros %D {back_ovalbox} |