diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/supp-box.mkiv')
-rw-r--r-- | Master/texmf-dist/tex/context/base/mkiv/supp-box.mkiv | 182 |
1 files changed, 73 insertions, 109 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/supp-box.mkiv b/Master/texmf-dist/tex/context/base/mkiv/supp-box.mkiv index 59e7105207b..fb9cbdf5dac 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/supp-box.mkiv +++ b/Master/texmf-dist/tex/context/base/mkiv/supp-box.mkiv @@ -15,14 +15,10 @@ \unprotect -\registerctxluafile{supp-box}{optimize} +\registerctxluafile{supp-box}{} % This file is partially cleaned up. -%D First some defaults: - -\fixupboxesmode\plusone - % handy to have % % \hbox to \hsize @@ -212,8 +208,8 @@ %D \smashedvbox to ... {...} %D \stoptyping -\unexpanded\def\smashedhbox{\hpack\bgroup\dowithnextboxcs\syst_boxes_smashed_nextbox\hbox} -\unexpanded\def\smashedvbox{\vpack\bgroup\dowithnextboxcs\syst_boxes_smashed_nextbox\vbox} +\unexpanded\def\smashedhbox{\hbox\bgroup\dowithnextboxcs\syst_boxes_smashed_nextbox\hbox} +\unexpanded\def\smashedvbox{\vbox\bgroup\dowithnextboxcs\syst_boxes_smashed_nextbox\vbox} %D First we define a helper. We use a \LUATEX\ feature in order to avoid %D mathpalettes. @@ -580,7 +576,7 @@ \unexpanded\def\doifelsetext#1% {\begingroup - \setbox\scratchbox\hpack + \setbox\scratchbox\hbox {\settrialtypesetting \ignorespaces#1\removeunwantedspaces}% \ifzeropt\wd\scratchbox @@ -593,7 +589,7 @@ \unexpanded\def\doiftext#1% {\begingroup - \setbox\scratchbox\hpack + \setbox\scratchbox\hbox {\settrialtypesetting \ignorespaces#1\removeunwantedspaces}% \ifzeropt\wd\scratchbox @@ -674,7 +670,7 @@ %D \afterassignment\syst_boxes_with_next_box_indeed %D \else\ifx#2\vbox %D \afterassignment\syst_boxes_with_next_box_indeed -%D \else\ifx#2\vtop +%D \else\ifx#2\normalvtop %D \afterassignment\syst_boxes_with_next_box_indeed %D \else\ifx#2\normalvcenter %D \afterassignment\syst_boxes_with_next_box_indeed @@ -734,9 +730,9 @@ %D Some well known friends, but we implement them our own %D way. We want the macros to work in both math and text mode. -\def\dodorlap{\hpack to \zeropoint{\box\nextbox\hss}\endgroup} -\def\dodollap{\hpack to \zeropoint{\hss\box\nextbox}\endgroup} -\def\dodoclap{\hpack to \zeropoint{\hss\box\nextbox\hss}\endgroup} +\def\dodorlap{\hpack to \zeropoint{\box\nextbox\normalhss}\endgroup} +\def\dodollap{\hpack to \zeropoint{\normalhss\box\nextbox}\endgroup} +\def\dodoclap{\hpack to \zeropoint{\normalhss\box\nextbox\normalhss}\endgroup} \def\dorlap{\begingroup\dowithnextboxcs\dodorlap\hbox} \def\dollap{\begingroup\dowithnextboxcs\dodollap\hbox} @@ -750,8 +746,8 @@ \unexpanded\def\llap{\mathortext\domathllap\dollap} \unexpanded\def\clap{\mathortext\domathclap\doclap} -\def\dodotlap{\vpack to \zeropoint{\vss\box\nextbox}\endgroup} -\def\dodoblap{\vpack to \zeropoint{\box\nextbox\vss}\endgroup} +\def\dodotlap{\vpack to \zeropoint{\normalvss\box\nextbox}\endgroup} +\def\dodoblap{\vpack to \zeropoint{\box\nextbox\normalvss}\endgroup} \unexpanded\def\tlap{\begingroup\dowithnextboxcs\dodotlap\vbox} \unexpanded\def\blap{\begingroup\dowithnextboxcs\dodoblap\vbox} @@ -1187,8 +1183,8 @@ %D complex macro than needed at first sight. \def\dodoboundtext#1% - {\setbox\scratchboxone\hbox{#1}% - \advance\scratchdimen -\wd\scratchboxone + {\setbox0\hbox{#1}% + \advance\scratchdimen -\wd0 \ifdim\scratchdimen>\zeropoint\relax#1\fi}% \def\doboundtext#1#2#3% still used? @@ -1247,7 +1243,7 @@ \ifdim\wd\nextbox>\scratchdimen \setbox\scratchbox\hbox{\ifdone\space#2\else#2\space\fi}% \advance\scratchdimen -\wd\scratchbox - \setbox\scratchboxone\box\nextbox + \setbox0\box\nextbox \setbox\nextbox\vbox {\hsize\scratchdimen \hfuzz\maxdimen @@ -1258,7 +1254,7 @@ \rightskip\zeropoint \hskip\zeropoint \s!plus 1\s!fill % \hsize \fi - \unhcopy\scratchboxone}% + \unhcopy0}% \ifdim\ht\nextbox>\strutht \setbox\nextbox\vbox % if omitted: missing brace reported {\splittopskip\openstrutheight @@ -1266,7 +1262,7 @@ \setbox\nextbox\vsplit\nextbox to \strutht \else \doloop - {\setbox\scratchboxone\vsplit\nextbox to \strutht + {\setbox0\vsplit\nextbox to \strutht \ifdim\ht\nextbox>\strutht \else \exitloop \fi}% \fi \unvbox\nextbox @@ -1308,13 +1304,13 @@ {%\dontleavehmode \bgroup \let\speciallimitatetext\firstoffourarguments - \setbox\scratchboxone\hbox + \setbox0\hbox {\nohyphens \normallimitatetext{#1}{+#2}{}#4% \normallimitatetext{#1}{-#3}{}}% - \setbox\scratchboxtwo\hbox + \setbox2\hbox {#1}% - \ifdim\wd\scratchboxtwo<\wd\scratchboxone #1\else\unhbox\scratchboxone\fi + \ifdim\wd2<\wd0 #1\else\unhbox0\fi \egroup} \unexpanded\def\limitatetext#1#2#3% \expanded added 2003/01/16 @@ -1332,7 +1328,7 @@ %D \stoptyping \unexpanded\def\limitatefirstline#1#2#3% - {\hbox\bgroup\strut % \hpack + {\hbox\bgroup\strut \setbox\scratchbox\hbox{\begstrut#1\endstrut}% \ifdim\wd\scratchbox>#2\relax \setbox\scratchbox\hbox{#3}% @@ -1344,7 +1340,7 @@ {\unvbox\scratchbox \global\setbox\plusone\lastbox \global\setbox\plusone\hbox{\strut\unhbox\plusone}% - \hbox % to #2 % \hpack + \hbox % to #2 {\ifx\clip\undefined \box\plusone \else\ifdim\wd\plusone>\hsize @@ -1537,7 +1533,7 @@ %D a strut. \unexpanded\def\struttedbox - {\hpack\bgroup + {\hbox\bgroup \dowithnextboxcs\syst_boxes_struttedbox_finish\hbox} \def\syst_boxes_struttedbox_finish @@ -1554,7 +1550,7 @@ %D equals strutdepth. \unexpanded\def\topskippedbox - {\hpack\bgroup\dowithnextboxcs\syst_boxes_topskippedbox_finish\hbox} + {\hbox\bgroup\dowithnextboxcs\syst_boxes_topskippedbox_finish\hbox} \def\syst_boxes_topskippedbox_finish {\edef\m_boxes_tmp{\ifdim\strutdepth=\dp\nextbox\dp\nextbox\the\dp\nextbox\fi}% @@ -1610,22 +1606,22 @@ \unexpanded\def\centeredbox#1#% height +/-dimen width +/-dimen {\bgroup - \setbox\scratchboxone\vpack to \vsize + \setbox0\vpack to \vsize \bgroup \dontcomplain \forgetall - \setbox\scratchboxone\hpack{\vrule\s!width \zeropoint#1}% - \setbox\scratchboxtwo\vpack{\hrule\s!height\zeropoint#1}% - \advance\vsize \ht\scratchboxtwo - \advance\hsize \wd\scratchboxone + \setbox0\hbox{\vrule\s!width \zeropoint#1}% + \setbox2\vbox{\hrule\s!height\zeropoint#1}% + \advance\vsize \ht2 + \advance\hsize \wd0 \vpack to \vsize \bgroup - \vskip-\ht\scratchboxtwo + \vskip-\ht2 \vss \hpack to \hsize \bgroup \dowithnextbox - {\hskip-\wd\scratchboxone + {\hskip-\wd0 \hss \box\nextbox \hss @@ -1633,13 +1629,14 @@ \vss \egroup \egroup - \wd\scratchboxone\hsize - \ht\scratchboxone\vsize - \box\scratchboxone + \wd0\hsize + \ht0\vsize + \box0 \egroup} \hbox} -%D For those who don't want to deal with \type {\hsize} and \type {\vsize}, we have: +%D For those who don't want to deal with \type {\hsize} +%D and \type {\vsize}, we have: %D %D \starttyping %D \centerednextbox width 2bp height 2bp @@ -1673,9 +1670,9 @@ {\bgroup \dowithnextbox {\setlocalhsize - \setbox\scratchbox\hpack{\vrule\s!width \zeropoint#1}% + \setbox\scratchbox\hbox{\vrule\s!width \zeropoint#1}% \ifzeropt\wd\scratchbox\else\hsize\wd\scratchbox\fi - \setbox\scratchbox\vpack{\hrule\s!height\zeropoint#1}% + \setbox\scratchbox\vbox{\hrule\s!height\zeropoint#1}% \ifzeropt\ht\scratchbox\else\vsize\ht\scratchbox\fi \vpack to \vsize{\vss\hpack to \hsize{\hss\box\nextbox\hss}\vss}% \egroup}% @@ -1767,7 +1764,7 @@ {\dorecurse\rigidcolumns {\setbox\scratchbox\vsplit\rigidcolumnbox to \scratchdimen \dp\scratchbox\openstrutdepth - \setbox\scratchbox\vtop + \setbox\scratchbox\normalvtop \ifalignrigidcolumns to \ifstretchrigidcolumns\vsize\else\scratchdimen\fi \fi @@ -1877,21 +1874,21 @@ \unexpanded\def\convertvboxtohbox {\makehboxofhboxes - \setbox\scratchboxone\hpack{\unhbox\scratchboxone\removehboxes}% \hpack - \noindent\unhbox\scratchboxone\par} + \setbox0\hbox{\unhbox0 \removehboxes}% + \noindent\unhbox0\par} \unexpanded\def\makehboxofhboxes - {\setbox\scratchboxone\emptyhbox - \loop % \doloop { .. \exitloop .. } - \setbox\scratchboxtwo\lastbox - \ifhbox\scratchboxtwo - \setbox\scratchboxone\hpack{\box\scratchboxtwo\unhbox\scratchboxone}% + {\setbox0\emptyhbox + \loop % \doloop { .. \exitloop .. } + \setbox2\lastbox + \ifhbox2 + \setbox0\hbox{\box2\unhbox0}% \repeat} \unexpanded\def\removehboxes - {\setbox\scratchboxone\lastbox - \ifhbox\scratchboxone - {\removehboxes}\unhbox\scratchboxone + {\setbox0\lastbox + \ifhbox0 + {\removehboxes}\unhbox0 \fi} % And one special for notes: @@ -1950,7 +1947,7 @@ \doloop {\setbox\hhbox\vsplit\unhhedbox to \lineheight \ifvoid\unhhedbox - \setbox\hhbox\hbox{\strut\hboxofvbox\hhbox}% \hpack + \setbox\hhbox\hbox{\strut\hboxofvbox\hhbox}% \fi \ht\hhbox\strutht \dp\hhbox\strutdp @@ -2132,27 +2129,7 @@ %D %D \leavevmode\getbuffer -\def\boxisempty#1% - {\ifdim\wd#1=\zeropoint - \ifdim\ht#1=\zeropoint - \ifdim\dp#1=\zeropoint - \zerocount - \else - \plusone - \fi - \else - \plusone - \fi - \else - \plusone - \fi} - \def\syst_boxes_overlay_process - {\ifcase\boxisempty\nextbox\else - \syst_boxes_overlay_process_indeed - \fi} - -\def\syst_boxes_overlay_process_indeed {%\removeunwantedspaces % already done \scratchdepth\dp\ifdim\dp\nextbox>\dp\processbox\nextbox\else\processbox\fi \ifdim\ht\nextbox>\ht\processbox @@ -2221,9 +2198,9 @@ \unexpanded\def\cbox#1#{\vbox#1\syst_boxes_lrc_process\raggedcenter} \unexpanded\def\rbox#1#{\vbox#1\syst_boxes_lrc_process\raggedright } -\unexpanded\def\ltop#1#{\vtop#1\syst_boxes_lrc_process\raggedleft } -\unexpanded\def\ctop#1#{\vtop#1\syst_boxes_lrc_process\raggedcenter} -\unexpanded\def\rtop#1#{\vtop#1\syst_boxes_lrc_process\raggedright } +\unexpanded\def\ltop#1#{\normalvtop#1\syst_boxes_lrc_process\raggedleft } +\unexpanded\def\ctop#1#{\normalvtop#1\syst_boxes_lrc_process\raggedcenter} +\unexpanded\def\rtop#1#{\normalvtop#1\syst_boxes_lrc_process\raggedright } %D The alternatives \type {\tbox} and \type {\bbox} can be used %D to properly align boxes, like in: @@ -2245,8 +2222,8 @@ %D %D \getbuffer -\unexpanded\def\tbox{\hpack\bgroup\dowithnextboxcs\syst_boxes_tbox_finish\hbox} -\unexpanded\def\bbox{\hpack\bgroup\dowithnextboxcs\syst_boxes_bbox_finish\hbox} +\unexpanded\def\tbox{\hbox\bgroup\dowithnextboxcs\syst_boxes_tbox_finish\hbox} +\unexpanded\def\bbox{\hbox\bgroup\dowithnextboxcs\syst_boxes_bbox_finish\hbox} \def\syst_boxes_tbox_finish {\scratchdepth\dimexpr\ht\nextbox+\dp\nextbox-\ht\strutbox\relax @@ -2312,7 +2289,7 @@ {\ifx\next\bgroup \expanded{\egroup#1 to \the\sizeofbox}% \else - \expandafter\afterassignment\expandafter\docommand\expandafter\scratchdimen + \@EA\afterassignment\@EA\docommand\@EA\scratchdimen \fi}% \docommand} @@ -2360,7 +2337,7 @@ \newbox\fakedboxcursor -\setbox\fakedboxcursor\hpack +\setbox\fakedboxcursor\hbox {\vrule\s!width\zeropoint\s!height\zeropoint\s!depth\zeropoint} \unexpanded\def\boxcursor % overloaded in core-vis @@ -2746,7 +2723,7 @@ % vcenter in text, we kunnen vcenter overloaden \unexpanded\def\halfwaybox - {\hpack\bgroup + {\hbox\bgroup \dowithnextboxcs\syst_boxes_halfwaybox_finish\hbox} \def\syst_boxes_halfwaybox_finish @@ -2755,7 +2732,7 @@ \egroup} \unexpanded\def\depthonlybox - {\tpack\bgroup + {\vtop\bgroup \dowithnextboxcs\syst_boxes_depthonlybox_finish\vbox} \def\syst_boxes_depthonlybox_finish @@ -2770,7 +2747,12 @@ %D And even rawer: -\let\naturalvcenter\normalvtop % will go away + \let\naturalvtop \normalvtop + \let\naturalvcenter\normalvtop +\unexpanded\def\naturalhbox {\hbox dir TLT} +\unexpanded\def\naturalvbox {\vbox dir TLT} +\unexpanded\def\naturalhpack {\hpack dir TLT} +\unexpanded\def\naturalvpack {\vpack dir TLT} %D \macros %D {vcenter} @@ -2782,7 +2764,7 @@ \dowithnextboxcs\syst_boxes_vcenter_finish\vbox} \def\syst_boxes_vcenter_finish - {\hpack{\normalstartimath\vcenter{\box\nextbox}\normalstopimath}% + {\hpack{\normalstartimath\normalvcenter{\box\nextbox}\normalstopimath}% \egroup} % could be \everymathematics @@ -2798,7 +2780,7 @@ %D A not so well unhboxable box can be made with: \unexpanded\def\frozenhbox - {\hpack\bgroup + {\hbox\bgroup \dowithnextboxcs\syst_boxes_frozenhbox_finish\hbox} \def\syst_boxes_frozenhbox_finish @@ -2855,19 +2837,19 @@ \unexpanded\def\spreadhbox#1% rebuilds \hbox{<box><hss><box><hss><box>} {\bgroup \ifhbox#1\relax - \setbox\scratchboxtwo\emptybox + \setbox2\emptybox \unhbox#1% \doloop {\unpenalty\unskip\unpenalty\unskip\unpenalty\unskip - \setbox\scratchboxone\lastbox - \ifvoid\scratchboxone + \setbox0\lastbox + \ifvoid0 \exitloop \else - \setbox\scratchboxtwo\hbox - {\ifhbox\scratchboxone \spreadhbox\scratchboxone\else\box\scratchboxone\fi - \ifvoid\scratchboxtwo \else\hss\unhbox\scratchboxtwo\fi}% + \setbox2\hbox + {\ifhbox0 \spreadhbox0\else\box0\fi + \ifvoid2 \else\hss\unhbox2\fi}% \fi}% - \ifvoid\scratchboxtwo\else\unhbox\scratchboxtwo\fi + \ifvoid2\else\unhbox2\fi \else \box#1% \fi @@ -2992,24 +2974,6 @@ % \unexpanded\def\tightvbox{\dowithnextbox{\dp\nextbox\zeropoint\box\nextbox}\vbox} % \unexpanded\def\tightvtop{\dowithnextbox{\ht\nextbox\zeropoint\box\nextbox}\vtop} -%D This one keeps dimensions and sets the shift field (and so it's more for testing -%D than for real usage): - -\unexpanded\def\shiftbox{\clf_shiftbox} - -%D This one has been moved from a 2 decade old file. It makes something boxed -%D sit on the baseline. - -\unexpanded\def\linebox - {\hpack\bgroup\dowithnextbox - {\scratchdimen\dimexpr\dimexpr\htdp\nextbox-\lineheight\relax/2+\dp\strutbox\relax - \setbox\nextbox\hpack{\lower\scratchdimen\box\nextbox}% - \ht\nextbox\ht\strutbox - \dp\nextbox\dp\strutbox - \box\nextbox - \egroup} - \hbox} - \protect \endinput % a bit of test code: |