summaryrefslogtreecommitdiff
path: root/tex/context/base/page-imp.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/page-imp.mkiv')
-rw-r--r--tex/context/base/page-imp.mkiv64
1 files changed, 44 insertions, 20 deletions
diff --git a/tex/context/base/page-imp.mkiv b/tex/context/base/page-imp.mkiv
index de11090d3..b320eae03 100644
--- a/tex/context/base/page-imp.mkiv
+++ b/tex/context/base/page-imp.mkiv
@@ -17,6 +17,8 @@
\unprotect
+% todo: impose a la mkiv (us elua specification tables)
+
% sizing bug:
%
% \setuppapersize[A4][A4,landscape] \setuparranging[2UP] \showframe
@@ -116,22 +118,46 @@
\prependtoks \flushtextdata \to \everylastshipout
-\def\installpagehandler#1#2% % a handler takes one argument: something to be boxed
+\def\installpagehandler#1#2% % a handler takes one argument: something to be boxed
{\setgvalue{\??pp:\c!method:#1}##1{#2{##1}}} % and shipped out (don't depend on the exact package)
\installpagehandler\v!normal
{\ifarrangingpages\expandafter\actualarrange\else\expandafter\actualshipout\fi}
+% Problem: we need to apply the finalizers to a to be shipped out page (as
+% we can have positioning involved). However, we can also add stuff in the
+% imposition, like cropmarks. Fortunately we do that with metapost so
+% colors etc are dealt with at that end.
+
+% \starttypen
+% \def\pagestoshipout{1,3,5}
+% \stoptypen
+
+\newcount \shippedoutpages
+\newcount \combinedpagescounter
+
+\let \pagestoshipout\empty % {1,3,6}
+\newconstant \whichpagetoshipout % 0=all 1=odd 2=even
+
+\newbox \shipoutscratchbox
+\newbox \postponedcontent
+
+\setnewconstant\shipoutfinalizemethod\plusone % this will be default (we will have two finalizers)
+
\def\myshipout#1%
{\beforeshipout % voor de pagebody dus !
\dontshowcomposition
\dontcomplain
- \executeifdefined{\??pp:\c!method:\@@ppmethod}\gobbleoneargument{#1}%
+ \ifcase\shipoutfinalizemethod
+ \executeifdefined{\??pp:\c!method:\@@ppmethod}\gobbleoneargument{#1}%
+ \else
+ \setbox\shipoutscratchbox\hbox{#1}% just in case there are objects there, hook for testing (will go away)
+ \finalizeshipoutbox\shipoutscratchbox
+ \executeifdefined{\??pp:\c!method:\@@ppmethod}\gobbleoneargument{\box\shipoutscratchbox}%
+ \fi
\setnextrealpageno
\aftershipout}
-\newbox\postponedcontent
-
\def\flushatshipout
{\dowithnextbox
{\global\setbox\postponedcontent\hbox to \zeropoint
@@ -142,19 +168,7 @@
\global\postponedcontent\zeropoint}%
\hbox}
-% \starttypen
-% \def\pagestoshipout{1,3,5}
-% \stoptypen
-
-\newcount\shippedoutpages
-\newcount\combinedpagescounter
-
-\let\pagestoshipout\empty % {1,3,6}
-\newconstant\whichpagetoshipout % 0=all 1=odd 2=even
-
-\newbox\shipoutscratchbox
-
-\def\actualshipout#1% todo: less callbacks
+\def\actualshipout#1% todo: less callbacks, #1 will go away
{\global\advance\shippedoutpages\plusone
% this is not resource safe!
\ifx\pagestoshipout\empty
@@ -173,8 +187,10 @@
\fi
\ifdone
\begingroup
- \setbox\shipoutscratchbox\hbox{#1}% just in case there are objects there, hook for testing
- \finalizeshipoutbox\shipoutscratchbox
+ \ifcase\shipoutfinalizemethod
+ \setbox\shipoutscratchbox\hbox{#1}%
+ \finalizeshipoutbox\shipoutscratchbox
+ \fi
\setbox\scratchbox\hbox
{% before the main one !
\ifcase\realfolio \or
@@ -197,7 +213,11 @@
\hbox % \setbox0=\box.. is nicer
{\box\scratchbox
\ifvoid\postponedcontent\else\box\postponedcontent\fi % evt ver naar links !
- \box\shipoutscratchbox}}%
+ \ifcase\shipoutfinalizemethod
+ \box\shipoutscratchbox
+ \else
+ \hbox{#1}%
+ \fi}}%
\endgroup
\else
\message
@@ -307,6 +327,10 @@
\global\arrangingpagesfalse
\fi
\setuppapersize
+ \ifarrangingpages
+ \ctxlua{job.disablesave()}%
+ %\disabledirective[job.save]%
+ \fi
\fi}
\def\installpagearrangement #1 % will lchange, no space