summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/pack-box.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/pack-box.mkiv')
-rw-r--r--Master/texmf-dist/tex/context/base/pack-box.mkiv30
1 files changed, 17 insertions, 13 deletions
diff --git a/Master/texmf-dist/tex/context/base/pack-box.mkiv b/Master/texmf-dist/tex/context/base/pack-box.mkiv
index 6cb492aa6df..fa771b4855a 100644
--- a/Master/texmf-dist/tex/context/base/pack-box.mkiv
+++ b/Master/texmf-dist/tex/context/base/pack-box.mkiv
@@ -82,7 +82,7 @@
{\dowithnextbox
{\bgroup
\checktextbackgrounds
- \setbox\scratchbox\null
+ \setbox\scratchbox\emptyhbox
\wd\scratchbox\nextboxwd
\ht\scratchbox\nextboxht
\dp\scratchbox\nextboxdp
@@ -443,10 +443,9 @@
\c!voffset=\@@bgoffset,
\c!hoffset=\@@bgoffset]
-\def\bleed
+\unexpanded\def\bleed
{\dosingleempty\dobleed}
-
\def\bleedwidth {\the\hsize}%
\def\bleedheight{\the\vsize}%
@@ -477,12 +476,13 @@
rt=>\!!donebtrue\!!donectrue]%
\doifelse\@@bgstretch\v!yes\donetrue\donefalse
\scratchdimen\@@bgwidth
+ \edef\currentbgposition {\??bg:\number\nofbleeds}%
+ \edef\currentpageposition{page:0}% todo: per page
\ifdone
\if!!donea
- \advance\scratchdimen\MPx{\??bg:\number\nofbleeds}%
+ \advance\scratchdimen\dimexpr \MPx\currentbgposition-\MPx\currentpageposition\relax
\else\if!!doneb
- \scratchdimen\paperwidth
- \advance\scratchdimen-\MPx{\??bg:\number\nofbleeds}%
+ \scratchdimen\dimexpr\paperwidth-\MPx\currentbgposition+\MPx\currentpageposition\relax % not checked
\fi\fi
\fi
\advance\scratchdimen\@@bghoffset
@@ -490,17 +490,21 @@
\scratchdimen\@@bgheight
\ifdone
\if!!donec
- \scratchdimen\paperheight
- \advance\scratchdimen-\MPy{\??bg:\number\nofbleeds}%
+ \scratchdimen\dimexpr\paperheight-\MPy\currentbgposition+\MPy\currentpageposition\relax % not checked
\else\if!!doned
- \advance\scratchdimen\MPy{\??bg:\number\nofbleeds}%
+ \advance\scratchdimen\dimexpr \MPy\currentbgposition-\MPy\currentpageposition\relax % not checked
\fi\fi
\fi
\advance\scratchdimen\@@bgvoffset
\xdef\bleedheight{\the\scratchdimen}%
+ %
+ \bgroup
\hsize\bleedwidth
\vsize\bleedheight
- \setbox\scratchbox\hbox{#2}%
+ \global\setbox\globalscratchbox\hbox{#2}%
+ \egroup
+ \setbox\scratchbox\box\globalscratchbox
+ %
\doif\@@bgpage\v!yes
{\setbox\scratchbox\topskippedbox{\box\scratchbox}}%
\setbox\scratchbox\hbox to \@@bgwidth
@@ -513,7 +517,7 @@
\ht\scratchbox\@@bgheight
\dp\scratchbox\zeropoint
\ifdone
- \hpos{\??bg:\number\nofbleeds}{\box\scratchbox}%
+ \hpos\currentbgposition{\box\scratchbox}%
\else
\box\scratchbox
\fi
@@ -521,7 +525,7 @@
\setupbleeding[\c!stretch=\v!yes]
-\defineexternalfigure[bleed][\c!width=\bleedwidth,\c!height=\bleedheight]
+\defineexternalfigure[bleed][\c!width=\bleedwidth,\c!height=\bleedheight] % should be \v!bleed
% \placefigure[left]{none}
% {\bleed[width=5cm,height=3cm,location=lt]{\externalfigure[koe][bleed]}}
@@ -900,7 +904,7 @@
[\c!width=\zeropoint,%
\c!height=\zeropoint,%
\c!depth=\zeropoint,#1]%
- \setbox\scratchbox\null
+ \setbox\scratchbox\emptyhbox
\wd\scratchbox\@@olwidth
\ht\scratchbox\@@olheight
\dp\scratchbox\@@oldepth