diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/pack-box.mkiv')
-rw-r--r-- | Master/texmf-dist/tex/context/base/pack-box.mkiv | 115 |
1 files changed, 92 insertions, 23 deletions
diff --git a/Master/texmf-dist/tex/context/base/pack-box.mkiv b/Master/texmf-dist/tex/context/base/pack-box.mkiv index f8b36691c75..6e3bab6f498 100644 --- a/Master/texmf-dist/tex/context/base/pack-box.mkiv +++ b/Master/texmf-dist/tex/context/base/pack-box.mkiv @@ -24,10 +24,10 @@ %D which in itself is ok, but can lead to loops due to rounding errors (happened %D in demo-obv). -\definelayer[\v!text-2][\c!position=\v!yes,\c!region=,\c!width=\overlaywidth,\c!height=\overlayheight] -\definelayer[\v!text-1][\c!position=\v!yes,\c!region=,\c!width=\overlaywidth,\c!height=\overlayheight] -\definelayer[\v!text+1][\c!position=\v!yes,\c!region=,\c!width=\overlaywidth,\c!height=\overlayheight] -\definelayer[\v!text+2][\c!position=\v!yes,\c!region=,\c!width=\overlaywidth,\c!height=\overlayheight] +\definelayer[\v!text-2][\c!position=\v!yes,\c!region=,\c!width=\d_overlay_width,\c!height=\d_overlay_height] +\definelayer[\v!text-1][\c!position=\v!yes,\c!region=,\c!width=\d_overlay_width,\c!height=\d_overlay_height] +\definelayer[\v!text+1][\c!position=\v!yes,\c!region=,\c!width=\d_overlay_width,\c!height=\d_overlay_height] +\definelayer[\v!text+2][\c!position=\v!yes,\c!region=,\c!width=\d_overlay_width,\c!height=\d_overlay_height] \unexpanded\def\internaltextoverlay#1% will become more generic and installable {\startoverlay % i.e. probably an overlay by itself @@ -436,7 +436,7 @@ \def\pack_ornament_text[#1][#2]% {\bgroup - \doifassignmentelse{#1} + \doifelseassignment{#1} {\letdummyparameter\c!alternative\v!a \getdummyparameters[#1]% \doifelse{\directdummyparameter\c!alternative}\v!a @@ -552,7 +552,7 @@ % \doifelse{\bleedingparameter\c!stretch}\v!yes\donetrue\donefalse % - \xdef\bleedwidth{\dimexpr + \xdef\bleedwidth{\the\dimexpr \ifdone \ifconditional\c_pack_boxes_l \scratchwidth+\MPx\currentbgposition-\MPx\currentpageposition @@ -563,8 +563,9 @@ \fi\fi \else \scratchwidth - \fi+\scratchhoffset}% - \xdef\bleedheight{\dimexpr + \fi+\scratchhoffset + \relax}% + \xdef\bleedheight{\the\dimexpr \ifdone \ifconditional\c_pack_boxes_t \paperheight -\MPy\currentbgposition+\MPy\currentpageposition % not checked @@ -575,7 +576,8 @@ \fi\fi \else \scratchheight - \fi+\scratchvoffset}% + \fi+\scratchvoffset + \relax}% \dowithnextboxcontentcs\pack_boxes_bleed_settings\pack_boxes_bleed_finish\hbox} \def\pack_boxes_bleed_settings @@ -678,7 +680,7 @@ \dowithnextboxcontent {\forgetall \hsize\directdummyparameter\c!width - \normalexpanded{\setupalign[\directdummyparameter\c!align]}% + \usealignparameter\directdummyparameter \dousestyleparameter{\directdummyparameter\c!style}} {\setlayer[#1][#2]{\strut\dousecolorparameter{\directdummyparameter\c!color}\flushnextbox}% maybe expand the color \egroup}% @@ -977,22 +979,43 @@ \box\scratchbox \egroup} -% \backgroundimage{1}{\hsize}{\vsize}{\externalfigure[cow][\c!width=3cm]} +% \backgroundimage{1}{\hsize}{\vsize}{\externalfigure[cow][\c!width=3cm]} + +% \framed[offset=overlay,width=6cm,height=3cm]{\backgroundimage {1}{\hsize}{\vsize}{\externalfigure[cow][width=1cm]}} +% \framed[offset=overlay,width=6cm,height=3cm]{\backgroundimage {2}{\hsize}{\vsize}{\externalfigure[cow][width=1cm]}} +% \framed[offset=overlay,width=6cm,height=3cm]{\backgroundimage {3}{\hsize}{\vsize}{\externalfigure[cow][width=1cm]}} + +% \framed[offset=overlay,width=4cm,height=2cm]{\backgroundimagefill{1}{\hsize}{\vsize}{\externalfigure[cow][width=1cm]}} +% \framed[offset=overlay,width=4cm,height=2cm]{\backgroundimagefill{2}{\hsize}{\vsize}{\externalfigure[cow][width=1cm]}} +% \framed[offset=overlay,width=4cm,height=2cm]{\backgroundimagefill{3}{\hsize}{\vsize}{\externalfigure[cow][width=1cm]}} +% \framed[offset=overlay,width=2cm,height=4cm]{\backgroundimagefill{1}{\hsize}{\vsize}{\externalfigure[cow][width=1cm]}} +% \framed[offset=overlay,width=2cm,height=4cm]{\backgroundimagefill{2}{\hsize}{\vsize}{\externalfigure[cow][width=1cm]}} +% \framed[offset=overlay,width=2cm,height=4cm]{\backgroundimagefill{3}{\hsize}{\vsize}{\externalfigure[cow][width=1cm]}} +% +% \framed[offset=overlay,width=4cm,height=2cm]{\backgroundimagefill{1}{\hsize}{\vsize}{\externalfigure[mill]}} +% \framed[offset=overlay,width=4cm,height=2cm]{\backgroundimagefill{2}{\hsize}{\vsize}{\externalfigure[mill]}} +% \framed[offset=overlay,width=4cm,height=2cm]{\backgroundimagefill{3}{\hsize}{\vsize}{\externalfigure[mill]}} +% \framed[offset=overlay,width=2cm,height=4cm]{\backgroundimagefill{1}{\hsize}{\vsize}{\externalfigure[mill]}} +% \framed[offset=overlay,width=2cm,height=4cm]{\backgroundimagefill{2}{\hsize}{\vsize}{\externalfigure[mill]}} +% \framed[offset=overlay,width=2cm,height=4cm]{\backgroundimagefill{3}{\hsize}{\vsize}{\externalfigure[mill]}} \unexpanded\def\backgroundimage#1#2#3% repeat hsize vsize {\bgroup \forgetall - \dowithnextbox{\pack_boxes_background_image{#1}{#2}{#3}}\hbox} + \scratchcounter#1\relax + \scratchwidth #2\relax + \scratchheight #3\relax + \dowithnextboxcs\pack_boxes_background_image\hbox} -\def\pack_boxes_background_image#1#2#3% +\def\pack_boxes_background_image {\offinterlineskip - \ifcase#1\relax + \ifcase\scratchcounter % just one \else - \scratchdimen#2\divide\scratchdimen\wd\nextbox\scratchnx\scratchdimen\advance\scratchnx\plusone\relax - \scratchdimen#3\divide\scratchdimen\ht\nextbox\scratchny\scratchdimen\advance\scratchny\plusone\relax + \scratchdimen\scratchwidth \divide\scratchdimen\wd\nextbox\scratchnx\scratchdimen\advance\scratchnx\plusone\relax + \scratchdimen\scratchheight\divide\scratchdimen\ht\nextbox\scratchny\scratchdimen\advance\scratchny\plusone\relax % to be considered: methods - \ifcase#1% + \ifcase\scratchcounter \or % x and y \setbox\nextbox\hbox{\dorecurse\scratchnx{\copy\nextbox}}% \setbox\nextbox\vbox{\dorecurse\scratchny{\copy\nextbox\endgraf}}% @@ -1002,13 +1025,59 @@ \setbox\nextbox\vbox{\dorecurse\scratchny{\copy\nextbox\endgraf}}% \fi \fi - \ifdim\wd\nextbox>#2\relax - \setbox\nextbox\hbox to #2{\hss\box\nextbox\hss}% - \setbox\nextbox\hbox{\normalexpanded{\clip[\c!width=#2,\c!height=\the\ht\nextbox]{\box\nextbox}}}% + \ifdim\wd\nextbox>\scratchwidth + \setbox\nextbox\hbox to \scratchwidth{\hss\box\nextbox\hss}% + \setbox\nextbox\hbox{\normalexpanded{\clip[\c!width=\the\scratchwidth,\c!height=\the\ht\nextbox]{\box\nextbox}}}% + \fi + \ifdim\ht\nextbox>\scratchheight + \setbox\nextbox\vbox to \scratchheight{\vss\box\nextbox\vss}% + \setbox\nextbox\hbox{\normalexpanded{\clip[\c!width=\the\wd\nextbox,\c!height=\the\scratchheight]{\box\nextbox}}}% + \fi + \box\nextbox + \egroup} + +\unexpanded\def\backgroundimagefill#1#2#3% repeat hsize vsize + {\bgroup + \forgetall + \scratchcounter#1\relax + \scratchwidth #2\relax + \scratchheight #3\relax + \dowithnextboxcs\pack_boxes_background_image_fill\hbox} + +\def\pack_boxes_background_image_fill + {\offinterlineskip + \setbox\nextbox\hbox\bgroup + \ifdim\scratchwidth>\scratchheight + \scale[\c!width=\the\scratchwidth]{\box\nextbox}% + \else + \scale[\c!height=\the\scratchheight]{\box\nextbox}% + \fi + \egroup + \ifdim\wd\nextbox>\scratchwidth + \setbox\nextbox\hbox to \scratchwidth + {\ifcase\scratchcounter + \hss\box\nextbox\hss + \or + \box\nextbox\hss + \or + \hss\box\nextbox + \else + \hss\box\nextbox\hss + \fi}% + \setbox\nextbox\hbox{\normalexpanded{\clip[\c!width=\the\scratchwidth,\c!height=\the\ht\nextbox]{\box\nextbox}}}% \fi - \ifdim\ht\nextbox>#3\relax - \setbox\nextbox\vbox to #3{\vss\box\nextbox\vss}% - \setbox\nextbox\hbox{\normalexpanded{\clip[\c!width=\the\wd\nextbox,\c!height=#3]{\box\nextbox}}}% + \ifdim\ht\nextbox>\scratchheight + \setbox\nextbox\vbox to \scratchheight + {\ifcase\scratchcounter + \vss\box\nextbox\vss + \or + \box\nextbox\vss + \or + \vss\box\nextbox + \else + \vss\box\nextbox\vss + \fi}% + \setbox\nextbox\hbox{\normalexpanded{\clip[\c!width=\the\wd\nextbox,\c!height=\the\scratchheight]{\box\nextbox}}}% \fi \box\nextbox \egroup} |