summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/anch-pos.mkiv307
-rw-r--r--tex/context/base/back-pdf.mkiv21
-rw-r--r--tex/context/base/cont-new.mkii2
-rw-r--r--tex/context/base/cont-new.mkiv39
-rw-r--r--tex/context/base/context-version.pdfbin4075 -> 4075 bytes
-rw-r--r--tex/context/base/context-version.pngbin105850 -> 106211 bytes
-rw-r--r--tex/context/base/context.mkii2
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/core-mis.mkiv134
-rw-r--r--tex/context/base/grph-inc.mkiv4
-rw-r--r--tex/context/base/grph-trf.mkiv112
-rw-r--r--tex/context/base/mult-low.lua3
-rw-r--r--tex/context/base/pack-bck.mkvi33
-rw-r--r--tex/context/base/pack-box.mkiv53
-rw-r--r--tex/context/base/pack-lyr.mkiv8
-rw-r--r--tex/context/base/page-flt.mkiv25
-rw-r--r--tex/context/base/page-ini.mkiv2
-rw-r--r--tex/context/base/page-mul.mkiv75
-rw-r--r--tex/context/base/spac-ali.mkiv8
-rw-r--r--tex/context/base/spac-ver.mkiv11
-rw-r--r--tex/context/base/status-files.pdfbin24000 -> 24019 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin169694 -> 169698 bytes
-rw-r--r--tex/context/base/strc-itm.mkvi2
-rw-r--r--tex/context/base/syst-ini.mkiv4
-rw-r--r--tex/context/base/tabl-tbl.mkiv8
-rw-r--r--tex/context/base/tabl-tsp.mkiv70
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
27 files changed, 515 insertions, 412 deletions
diff --git a/tex/context/base/anch-pos.mkiv b/tex/context/base/anch-pos.mkiv
index 57e8808dc..da6e25f87 100644
--- a/tex/context/base/anch-pos.mkiv
+++ b/tex/context/base/anch-pos.mkiv
@@ -214,93 +214,111 @@
\dosetpositionpapersize\printpaperwidth\printpaperheight
\fi}
-\def\setpositiononly#1%
+\unexpanded\def\setpositiononly
{\iftrialtypesetting
- % nothing
+ \expandafter\gobbleoneargument
\else
- \initializenextposition
- \def\currentposition{#1}%
- \dosetposition\currentposition
+ \expandafter\positions_set_only_indeed
\fi}
-\def\setposition#1%
+\def\positions_set_only_indeed#1%
+ {\initializenextposition
+ \edef\currentposition{#1}%
+ \dosetposition\currentposition}
+
+\unexpanded\def\setposition
{\iftrialtypesetting
- % nothing
+ \expandafter\gobbleoneargument
\else
- \initializenextposition
- \def\currentposition{#1}%
- \dosetposition\currentposition
- \traceposstring\llap\green{\currentposition>}%
- \dopositionaction\currentposition
+ \expandafter\positions_set_indeed
\fi}
-\def\setpositiondata#1#2#3#4%
- {\iftrialtypesetting \else
- \initializenextposition
- \hbox
- {\def\currentposition{#1}%
- \dosetpositionwhd\currentposition
- {\the\dimexpr#2\relax}%
- {\the\dimexpr#3\relax}%
- {\the\dimexpr#4\relax}%
- \traceposstring\llap\green{\currentposition>}%
- \dopositionaction\currentposition
- \hss}%
+\def\positions_set_indeed#1%
+ {\initializenextposition
+ \edef\currentposition{#1}%
+ \dosetposition\currentposition
+ \traceposstring\llap\green{\currentposition>}%
+ \dopositionaction\currentposition}
+
+\unexpanded\def\setpositiondata
+ {\iftrialtypesetting
+ \expandafter\gobblefourarguments
+ \else
+ \expandafter\positions_set_data_indeed
\fi}
-\def\setpositionbox#1%
- {\dowithnextbox
- {\iftrialtypesetting
- \flushnextbox
- \else
- \initializenextposition
- \hbox to \nextboxwd
- {\edef\currentposition{#1}%
- \dosetpositionwhd\currentposition
- {\the\nextboxwd}%
- {\the\nextboxht}%
- {\the\nextboxdp}%
- \traceposstring\llap\green{\currentposition>}%
- \setbox\positionbox\flushnextbox
- \dopositionaction\currentposition
- \box\positionbox
- \hss}%
- \fi}}
-
-\def\setpositiondataplus#1#2#3#4#5%
- {\iftrialtypesetting \else
- \initializenextposition
- \hbox % bug: to \nextboxwd
- {\edef\currentposition{#1}%
- \dosetpositionplus\currentposition
- {\the\dimexpr#2\relax}%
- {\the\dimexpr#3\relax}%
- {\the\dimexpr#4\relax}%
- {#5}%
- \traceposstring\rlap\magenta{<\currentposition}%
- \dopositionaction\currentposition
- \hss}%
+\def\positions_set_data_indeed#1#2#3#4%
+ {\initializenextposition
+ \hbox
+ {\edef\currentposition{#1}%
+ \dosetpositionwhd\currentposition{#2}{#3}{#4}% already \the\dimexpr
+ \traceposstring\llap\green{\currentposition>}%
+ \dopositionaction\currentposition
+ \hss}}
+
+\unexpanded\def\setpositionbox
+ {\iftrialtypesetting
+ \expandafter\positions_set_box_nop
+ \else
+ \expandafter\positions_set_box_yes
+ \fi}
+
+\def\positions_set_box_nop#1%
+ {\dowithnextboxcs\flushnextbox}
+
+\def\positions_set_box_yes#1%
+ {\dowithnextbox{\positions_set_box_finish{#1}}}
+
+\def\positions_set_box_finish#1%
+ {\initializenextposition
+ \hbox to \wd\nextbox
+ {\edef\currentposition{#1}%
+ \dosetpositionwhd\currentposition{\wd\nextbox}{\ht\nextbox}{\dp\nextbox}% already \the\dimexpr
+ \traceposstring\llap\green{\currentposition>}%
+ \setbox\positionbox\box\nextbox
+ \dopositionaction\currentposition
+ \box\positionbox
+ \hss}}
+
+\def\setpositiondataplus
+ {\iftrialtypesetting
+ \expandafter\gobblefivearguments
+ \else
+ \expandafter\positions_set_plus_indeed
+ \fi}
+
+\def\positions_set_plus_indeed#1#2#3#4#5%
+ {\initializenextposition
+ \hbox % just package
+ {\edef\currentposition{#1}%
+ \dosetpositionplus\currentposition{#2}{#3}{#4}{#5}% already \the\dimexpr
+ \traceposstring\rlap\magenta{<\currentposition}%
+ \dopositionaction\currentposition
+ \hss}}
+
+\def\setpositionplus
+ {\iftrialtypesetting
+ \expandafter\positions_set_plus_nop
+ \else
+ \expandafter\positions_set_plus_yes
\fi}
-\def\setpositionplus#1#2%
- {\dowithnextbox
- {\iftrialtypesetting
- \flushnextbox
- \else
- \initializenextposition
- \hbox to \nextboxwd
- {\edef\currentposition{#1}%
- \dosetpositionplus\currentposition
- {\the\nextboxwd}%
- {\the\nextboxht}%
- {\the\nextboxdp}%
- {#2}%
- \traceposstring\rlap\magenta{<\currentposition}%
- \setbox\positionbox\flushnextbox
- \dopositionaction\currentposition
- \box\positionbox
- \hss}%
- \fi}}
+\def\positions_set_plus_nop#1#2%
+ {\dowithnextboxcs\flushnextbox}
+
+\def\positions_set_plus_yes#1#2%
+ {\dowithnextbox{\positions_set_plus_yes_finish{#1}{#2}}}
+
+\def\positions_set_plus_yes_finish#1#2%
+ {\initializenextposition
+ \hbox to \nextboxwd
+ {\edef\currentposition{#1}%
+ \dosetpositionplus\currentposition{\wd\nextbox}{\ht\nextbox}{\dp\nextbox}{#2}%
+ \traceposstring\rlap\magenta{<\currentposition}%
+ \setbox\positionbox\flushnextbox
+ \dopositionaction\currentposition
+ \box\positionbox
+ \hss}}
\let\currentposition\s!unknown
@@ -314,7 +332,7 @@
\let\POSactionprefix\POSprefix
-\def\dosetpositionaction#1%
+\unexpanded\def\dosetpositionaction#1%
{\setgvalue{\POSactionprefix#1::}}
%D The lists can become quite long (also because there can
@@ -325,16 +343,16 @@
\def\doifpositionaction#1%
{\ifcsname\POSactionprefix#1::\endcsname
- \@EA\firstofoneargument
+ \expandafter\firstofoneargument
\else
- \@EA\gobbleoneargument
+ \expandafter\gobbleoneargument
\fi}
\def\doifpositionactionelse#1%
{\ifcsname\POSactionprefix#1::\endcsname
- \@EA\firstoftwoarguments
+ \expandafter\firstoftwoarguments
\else
- \@EA\secondoftwoarguments
+ \expandafter\secondoftwoarguments
\fi}
%D We can copy a position with:
@@ -383,39 +401,40 @@
\let\xypos\setpositiononly
-\def\hpos#1{\dontleavehmode\setpositionbox{#1}\hbox}
-\def\vpos#1{\setpositionbox{#1}\vbox}
+\unexpanded\def\hpos#1{\dontleavehmode\setpositionbox{#1}\hbox}
+\unexpanded\def\vpos#1{\setpositionbox{#1}\vbox}
-\def\bpos#1{\hpos{b:#1}{\strut}\ignorespaces}
-\def\epos#1{\removelastspace\hpos{e:#1}{\strut}}
+\unexpanded\def\bpos#1{\hpos{b:#1}{\strut}\ignorespaces}
+\unexpanded\def\epos#1{\removelastspace\hpos{e:#1}{\strut}}
-\def\fpos#1%
+\unexpanded\def\fpos#1%
{\setpositionplus{b:#1}{\number\parposcounter}\horizontalstrut
\ignorespaces}
-\def\tpos#1%
+\unexpanded\def\tpos#1%
{\removelastspace
\setpositionplus{e:#1}{\number\parposcounter}\horizontalstrut}
-\def\ffpos#1%
+\unexpanded\def\ffpos#1%
{\setpositionplus{b:#1}{\number\parposcounter}\horizontalstrut\wpos{#1}%
\ignorespaces}
-\def\ttpos#1%
+\unexpanded\def\ttpos#1%
{\removelastspace
\setpositionplus{e:#1}{\number\parposcounter}\horizontalstrut}
-\def\wpos#1%
+\unexpanded\def\wpos#1%
{\dontleavehmode\vadjust % may disappear if buried
- {\setbox0\hbox{\raise\strutdp\hbox{\rawwpos{#1}}}%
- \rlap{\smashedbox0}}}
+ {\setbox\scratchbox\hbox{\raise\strutdp\hbox{\rawwpos{#1}}}%
+ \rlap
+ {\smashedbox\scratchbox}}}
-\def\wwpos#1% \hsmashed{\llap{\rawwpos{#1}}}
+\unexpanded\def\wwpos#1% \hsmashed{\llap{\rawwpos{#1}}}
{\rlap
- {\setbox0\hbox{\rawwpos{#1}}%
- \smashedbox0}}
+ {\setbox\scratchbox\hbox{\rawwpos{#1}}%
+ \smashedbox\scratchbox}}
-\def\rawwpos#1%
+\unexpanded\def\rawwpos#1%
{\hpos{w:#1}
{\strut
\hskip-\leftskip
@@ -425,7 +444,7 @@
% the next macro disables par positions (in inner boxes) and
% only registers the width
-\def\setinnerparpositions
+\unexpanded\def\setinnerparpositions
{\let\fpos\ffpos
\let\tpos\ttpos
\let\wpos\wwpos}
@@ -448,54 +467,49 @@
% we can check for used entries, and if not, then not add one
-\def\enableparpositions % global
+\unexpanded\def\enableparpositions % global
{\global\let\registerparoptions\doregisterparoptions
\global\positioningtrue
\global\positioningpartrue}
-\def\disableparpositions % local
+\unexpanded\def\disableparpositions % local
{\positioningparfalse}
\let\registerparoptions\relax
-\def\doregisterparoptions
+\unexpanded\def\doregisterparoptions
{\iftrialtypesetting \else
\ifinpagebody \else \ifmmode \else \ifinformula \else
- \dodoregisterparoptions
+ \positions_register_par_options
\fi \fi \fi
\fi}
-\def\dodoregisterparoptions
+\def\positions_register_par_options
{\global\advance\parposcounter\plusone
\setpositiondataplus
- {p:\number\parposcounter}% identifier
- {\the\zeropoint}%
- {\the\strutht}%
- {\the\strutdp}%
+ {p:\number\parposcounter}\zeropoint\strutht\strutdp
{\the\hsize,\the\dimexpr\leftskip\relax,\the\dimexpr\rightskip\relax,\the\hangindent,\the\hangafter,\the\parindent}%
%\normalhbox{\registerparsymbol}%
\iftracepositions\registerparsymbol\fi}
-\def\traceposstring#1#2#3%
+\unexpanded\def\traceposstring#1#2#3%
{\iftracepositions
\smashedhbox
{#1{\infofont#2#3}%
- \scratchdimen.5\points
- \kern-2\scratchdimen
- \vrule\!!width4\scratchdimen\!!height\scratchdimen\!!depth\scratchdimen}%
+ \kern-\onepoint
+ \vrule\!!width2\onepoint\!!height\halfapoint\!!depth\halfapoint}%
\fi}
-\def\registerparsymbol
+\unexpanded\def\registerparsymbol
{\iftracepositions
\smashedhbox to \zeropoint
{\hss
\startcolor[blue]%
\llap{\infofont\number\parposcounter}%
- \scratchdimen\onepoint
\vrule
- \!!width 4\scratchdimen
- \!!height2\scratchdimen
- \!!depth 2\scratchdimen
+ \!!width 4\onepoint
+ \!!height2\onepoint
+ \!!depth 2\onepoint
\stopcolor
\hss}%
\fi}
@@ -542,10 +556,10 @@
\def\analyzenodelocation#1%
{\ifcsname\@@noden#1\endcsname
- \doanalyzenodelocation{#1}{\getnodelocationn{#1}}\zerocount
+ \positions_node_location_analyze{#1}{\getnodelocationn{#1}}\zerocount
\fi}
-\def\doanalyzenodelocation#1#2#3% class n default
+\def\positions_node_location_analyze#1#2#3% class n default
{\begingroup
\donefalse
\ifcase\nodelocationmode
@@ -564,37 +578,16 @@
\edef\nodelocationotherx{\numnodelocationx{#1}\recurselevel}%
\edef\nodelocationothery{\numnodelocationy{#1}\recurselevel}%
\ifcase\nodelocationmode
+ % \exitloop
\or
% ok for single column
- \ifcase\nodelocationotherp\relax
- \exitloop
- \else\ifnum\nodelocationotherp<\nodelocationselfp\relax
- \donetrue \advance\scratchcounter\plusone
- \else\ifnum\nodelocationotherp>\nodelocationselfp\relax
- % skip
- \else\ifdim\nodelocationothery>\nodelocationselfy\relax
- \donetrue \advance\scratchcounter\plusone
- \else\ifdim\nodelocationothery<\nodelocationselfy\relax
- % skip
- \else\ifdim\nodelocationotherx<\nodelocationselfx\relax
- \donetrue \advance\scratchcounter\plusone
- \fi\fi\fi\fi\fi\fi
+ \positions_node_location_analyze_one
\or
% acceptable for double column
- \ifcase\nodelocationotherp\relax
- \exitloop
- \else\ifnum\nodelocationotherp<\nodelocationselfp\relax
- \donetrue \advance\scratchcounter\plusone
- \else\ifnum\nodelocationotherp>\nodelocationselfp\relax
- % skip
- \else\ifnum\recurselevel>\nodelocationselfn\relax
- \donetrue \exitloop
- \else
- \donetrue \advance\scratchcounter\plusone
- \fi\fi\fi\fi
- \else
- \exitloop
- \fi
+ \positions_node_location_analyze_two
+ \else
+ \exitloop
+ \fi
\fi}%
\fi
\ifdone \else
@@ -603,6 +596,34 @@
\setxvalue{\@@nodeo#1}{\the\scratchcounter}%
\endgroup}
+\def\positions_node_location_analyze_one
+ {\ifcase\nodelocationotherp\relax
+ \exitloop
+ \else\ifnum\nodelocationotherp<\nodelocationselfp\relax
+ \donetrue \advance\scratchcounter\plusone
+ \else\ifnum\nodelocationotherp>\nodelocationselfp\relax
+ % skip
+ \else\ifdim\nodelocationothery>\nodelocationselfy\relax
+ \donetrue \advance\scratchcounter\plusone
+ \else\ifdim\nodelocationothery<\nodelocationselfy\relax
+ % skip
+ \else\ifdim\nodelocationotherx<\nodelocationselfx\relax
+ \donetrue \advance\scratchcounter\plusone
+ \fi\fi\fi\fi\fi\fi}
+
+\def\positions_node_location_analyze_two
+ {\ifcase\nodelocationotherp\relax
+ \exitloop
+ \else\ifnum\nodelocationotherp<\nodelocationselfp\relax
+ \donetrue \advance\scratchcounter\plusone
+ \else\ifnum\nodelocationotherp>\nodelocationselfp\relax
+ % skip
+ \else\ifnum\recurselevel>\nodelocationselfn\relax
+ \donetrue \exitloop
+ \else
+ \donetrue \advance\scratchcounter\plusone
+ \fi\fi\fi\fi}
+
\unexpanded\def\shownodelocation#1%
{\ifcsname\@@noden#1\endcsname
\analyzenodelocation{#1}%
diff --git a/tex/context/base/back-pdf.mkiv b/tex/context/base/back-pdf.mkiv
index fd90f9213..f84f83fe5 100644
--- a/tex/context/base/back-pdf.mkiv
+++ b/tex/context/base/back-pdf.mkiv
@@ -182,15 +182,18 @@
\unexpanded\def\dotransformnextbox#1#2#3#4#5#6% sx rx ry sy tx ty (will change) / basepoints !
{\advance\backendtransformlevel\plusone
- \dowithnextbox % fixing ht/dp/wd should happen elsewhere
- {\hbox
- {\hskip#5\onebasepoint
- \raise#6\onebasepoint\hbox
- {\pdfsave
- \pdfsetmatrix{#1 #2 #3 #4}% 0 0 (no #5 #6 yet)
- \box\nextbox
- \pdfrestore
- \advance\backendtransformlevel\minusone}}}}
+ % fixing ht/dp/wd should happen elsewhere
+ \dowithnextbox{\dodotransformnextbox{#5}{#6}{#1 #2 #3 #4}}}
+
+\unexpanded\def\dodotransformnextbox#1#2#3%
+ {\hbox
+ {\hskip#1\onebasepoint
+ \raise#2\onebasepoint\hbox
+ {\pdfsave
+ \pdfsetmatrix{#3}% 0 0 (no #5 #6 yet)
+ \box\nextbox
+ \pdfrestore
+ \advance\backendtransformlevel\minusone}}}
\unexpanded\def\dostartclipping#1#2#3% todo (still needed?) (can move to lua)
{\PointsToBigPoints{#2}\width
diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii
index d91fafa0f..7f31e795b 100644
--- a/tex/context/base/cont-new.mkii
+++ b/tex/context/base/cont-new.mkii
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2011.12.14 22:12}
+\newcontextversion{2011.12.15 13:56}
%D This file is loaded at runtime, thereby providing an
%D excellent place for hacks, patches, extensions and new
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index d0afd70a8..d9d2817ec 100644
--- a/tex/context/base/cont-new.mkiv
+++ b/tex/context/base/cont-new.mkiv
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2011.12.14 22:12}
+\newcontextversion{2011.12.15 13:56}
%D This file is loaded at runtime, thereby providing an
%D excellent place for hacks, patches, extensions and new
@@ -21,43 +21,6 @@
\writestatus\m!system{beware: some patches loaded from cont-new.mkiv}
-
-\def\fastscale#1%
- {\begingroup
- \ifnum#1=1000\relax
- \setfalse\scaleboxdone
- \else
- \settrue\scaleboxdone
- \edef\finalscaleboxxscale{\withoutpt\the\dimexpr#1pt/1000\relax}%
- \let\finalscaleboxyscale\finalscaleboxxscale
- \fi
- \dowithnextbox{\doscaleboxindeed\flushnextbox\endgroup}\hbox}
-
-% \setupcaption [figure] [align=flushleft]
-% \setupcaption [figure-1] [align=flushleft,leftmargin=10mm]
-% \setupcaption [figure-2] [align=flushleft,leftmargin=10mm,rightmargin=-10mm,width=\textwidth]
-%
-% \startsetups somefigure
-% \ifdim\floatsetupwidth>\textwidth
-% \placesetupfloat[figure-2]
-% \else
-% \placesetupfloat[figure-1]
-% \fi
-% \stopsetups
-%
-% \placefloatwithsetups[somefigure]{}{\externalfigure[dummy][width=5cm,height=2cm]}
-
-\def\placefloatwithsetups
- {\dotripleempty\doplacefloatwithsetups}
-
-\long\def\doplacefloatwithsetups[#1][#2][#3]#4%
- {\def\floatsetupcaption {#4}%
- \def\floatsetupcontent {\copy\nextbox}%
- \def\floatsetupwidth {\wd\nextbox}%
- \def\floatsetupheight {\ht\nextbox}%
- \def\placesetupfloat[##1]{\placefloat[##1][#2][#3]{#4}{\floatsetupcontent}}% #4 and not \floatsetupcaption (unexpanded)
- \dowithnextbox{\setups[#1]}\vbox}
-
\def\dividedsize#1#2#3% size gap n
{\dimexpr
\ifnum\dimexpr#1\relax>\plusone
diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf
index 2cb34c4cd..4dd332d82 100644
--- a/tex/context/base/context-version.pdf
+++ b/tex/context/base/context-version.pdf
Binary files differ
diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png
index a69c11acf..b67d9988f 100644
--- a/tex/context/base/context-version.png
+++ b/tex/context/base/context-version.png
Binary files differ
diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii
index c7bbb3e35..d19abf5a7 100644
--- a/tex/context/base/context.mkii
+++ b/tex/context/base/context.mkii
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2011.12.14 22:12}
+\edef\contextversion{2011.12.15 13:56}
%D For those who want to use this:
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index 2a4985432..1044d2eb5 100644
--- a/tex/context/base/context.mkiv
+++ b/tex/context/base/context.mkiv
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2011.12.14 22:12}
+\edef\contextversion{2011.12.15 13:56}
%D For those who want to use this:
diff --git a/tex/context/base/core-mis.mkiv b/tex/context/base/core-mis.mkiv
index 93f3d2061..d0f418991 100644
--- a/tex/context/base/core-mis.mkiv
+++ b/tex/context/base/core-mis.mkiv
@@ -1736,11 +1736,11 @@
\edef\currentcombinationspec{2*1*}}}%
\fi
\forgetall
-\dostarttagged\t!combination\currentcombination
+ \dostarttagged\t!combination\currentcombination
\doifelse{\combinationparameter\c!height}\v!fit
\vbox {\vbox to \combinationparameter\c!height}%
\bgroup
-\let\combination\empty % permits \combination{}{} handy for cld
+ \let\combination\empty % permits \combination{}{} handy for cld
\setuphorizontaldivision
[\c!n=\v!fit,\c!distance=\combinationparameter\c!distance]%
\expanded{\dodostartcombination[\currentcombinationspec]}}
@@ -1750,7 +1750,7 @@
\long\def\dodostartcombination[#1*#2*#3]%
{\global\horcombination#1%
\global\totcombination#2%
-\dotagcombination
+ \dotagcombination
\global\setbox\combinationstack\emptybox
\xdef\maxhorcombination{\the\horcombination}%
\multiply\totcombination\horcombination
@@ -1772,31 +1772,34 @@
\def\docombination % we want to add struts but still ignore an empty box
{\dostarttagged\t!combinationpair\empty
\dostarttagged\t!combinationcontent\empty
+ \dowithnextboxcs\docombinationfinish\hbox}
+
+\def\docombinationfinish % we want to add struts but still ignore an empty box
+ {\dostoptagged
+ \setbox0\flushnextbox
+ \dostarttagged\t!combinationcaption\empty
\dowithnextbox
{\dostoptagged
- \setbox0\flushnextbox
- \dostarttagged\t!combinationcaption\empty
- \dowithnextbox
- {\dostoptagged
- \dostoptagged
- \setbox2\flushnextbox
- \dodocombination}%
- \vtop\bgroup
- \def\next
- {\futurelet\nexttoken\nextnext}%
- \def\nextnext
- {\ifx\nexttoken\egroup \else % the next box is empty
- \hsize\wd0
- \setupalign[\combinationparameter\c!align]%
- \dousestylehashparameter{\??co\currentcombination}\c!style
- \dousecolorhashparameter{\??co\currentcombination}\c!color
- \bgroup
- \aftergroup\endstrut
- \aftergroup\egroup
- \begstrut
- \fi}%
- \afterassignment\next\let\nexttoken=}
- \hbox}
+ \dostoptagged
+ \setbox2\flushnextbox
+ \dodocombination}%
+ \vtop\bgroup
+ \afterassignment\donextcombination\let\nexttoken=}
+
+\def\donextcombination
+ {\futurelet\nexttoken\donextnextcombination}
+
+\def\donextnextcombination
+ {\ifx\nexttoken\egroup \else % the next box is empty
+ \hsize\wd0
+ \setupalign[\combinationparameter\c!align]%
+ \dousestylehashparameter{\??co\currentcombination}\c!style
+ \dousecolorhashparameter{\??co\currentcombination}\c!color
+ \bgroup
+ \aftergroup\endstrut
+ \aftergroup\egroup
+ \begstrut
+ \fi}
\def\depthonlybox
{\dowithnextbox{\vtop{\hsize\wd\nextbox\kern\zeropoint\box\nextbox}}\vbox}
@@ -1815,30 +1818,35 @@
\global\advance\totcombination\minusone
\global\advance\horcombination\minusone
\ifnum\horcombination=\zerocount
- \def\next
- {\cr
- \flushcombinationstack
- \noalign
- {\forgetall % \setupwhitespace[\v!none]% no
- \global\setbox\combinationstack\emptybox
- \nointerlineskip
- \combinationparameter\c!after
- \combinationparameter\c!before
- \vss
- \nointerlineskip}%
- \global\horcombination\maxhorcombination\relax
- \docombination}%
+ \doubleexpandafter\docombination_a
\else
- \def\next
- {&&&\hskip\combinationparameter\c!distance&\docombination}%
+ \doubleexpandafter\docombination_b
\fi
\else
- \def\next
- {\cr
- \flushcombinationstack
- \egroup}%
- \fi
- \next}
+ \expandafter\docombination_c
+ \fi}
+
+\def\docombination_a
+ {\cr
+ \flushcombinationstack
+ \noalign
+ {\forgetall % \setupwhitespace[\v!none]% no
+ \global\setbox\combinationstack\emptybox
+ \nointerlineskip
+ \combinationparameter\c!after
+ \combinationparameter\c!before
+ \vss
+ \nointerlineskip}%
+ \global\horcombination\maxhorcombination\relax
+ \docombination}
+
+\def\docombination_b
+ {&&&\hskip\combinationparameter\c!distance&\docombination}
+
+\def\docombination_c
+ {\cr
+ \flushcombinationstack
+ \egroup}
% formally ok:
%
@@ -1870,7 +1878,7 @@
\def\flushcombinationstack
{\noalign
{\ifdim\ht\combinationstack>\zeropoint
-\nointerlineskip % nieuw
+ \nointerlineskip % nieuw
\combinationparameter\c!inbetween
\global\horcombination\maxhorcombination
\globallet\doflushcombinationstack\dodoflushcombinationstack
@@ -1887,13 +1895,13 @@
\box1% \ruledhbox{\box1}%
\global\advance\horcombination\minusone\relax
\ifnum\horcombination>\zerocount
- \def\next{&&&&\doflushcombinationstack}%
+ \expandafter\dodoflushcombinationstacknext
\else
\global\setbox\combinationstack\emptybox
- %\let\next\relax
- \@EA\gobbleoneargument
- \fi
- \next}
+ \fi}
+
+\def\dodoflushcombinationstacknext
+ {&&&&\doflushcombinationstack}
\setupcombinations
[\c!width=\v!fit,
@@ -1930,19 +1938,23 @@
\unexpanded\def\startfloatcombination
{\dodoubleempty\dostartfloatcombination}
+\let\startfloatcombination\relax
+
\def\dostartfloatcombination[#1][#2]%
{\vbox\bgroup
%\insidecolumnstrue % trick, forces no centering, todo: proper switch/feature
\postcenterfloatmethod\zerocount
\forcelocalfloats
- \unexpanded\def\stopfloatcombination
- {\scratchtoks\emptytoks
- \dorecurse\noflocalfloats
- {\appendetoks{\noexpand\getlocalfloat{\recurselevel}}{}\to\scratchtoks}%
- \expanded{\startcombination[#1]\the\scratchtoks}\stopcombination
- \resetlocalfloats
- \egroup}}
-
+ \unexpanded\def\stopfloatcombination{\dostopfloatcombination{#1}}}
+
+\unexpanded\def\dostopfloatcombination#1%
+ {\scratchtoks\emptytoks
+ \dorecurse\noflocalfloats
+ {\appendetoks{\noexpand\getlocalfloat{\recurselevel}}{}\to\scratchtoks}% brrr
+ \expanded{\startcombination[#1]\the\scratchtoks}\stopcombination
+ \resetlocalfloats
+ \egroup}
+
\unexpanded\def\placerelativetoeachother#1#2%
{\bgroup
\dowithnextbox
diff --git a/tex/context/base/grph-inc.mkiv b/tex/context/base/grph-inc.mkiv
index 17af235b9..b403fa8e1 100644
--- a/tex/context/base/grph-inc.mkiv
+++ b/tex/context/base/grph-inc.mkiv
@@ -19,6 +19,8 @@
%D - alternative images
%D - a few more obscure things
+% use framedcommandhandler
+
\registerctxluafile{grph-inc}{1.001}
\registerctxluafile{grph-fil}{1.001}
\registerctxluafile{grph-u3d}{1.001} % this will change
@@ -300,6 +302,8 @@
\egroup
\egroup}
+\newsystemmode\v!figure
+
\def\signalexternalfigure % global
{\ifcase\figurestatus
\global\resetsystemmode\v!figure % todo, also: \v!resource
diff --git a/tex/context/base/grph-trf.mkiv b/tex/context/base/grph-trf.mkiv
index 9b4201116..4801a2aa5 100644
--- a/tex/context/base/grph-trf.mkiv
+++ b/tex/context/base/grph-trf.mkiv
@@ -14,7 +14,8 @@
%D It may be that some functionality got lost. If it concerns
%D defined features, let me know and it will be sorted out.
-%D We will move the calculations to lua.
+%D We will move the calculations to \LUA\ and clean up this
+%D lot anyway.
\writestatus{loading}{ConTeXt Graphic Macros / Transformations}
@@ -285,34 +286,46 @@
\def\setscaleboxbydimension
{\ifdim\scaleboxdimx>\zeropoint
\ifdim\scaleboxdimy>\zeropoint
- \dosetdimensionscaleboxsize
- {\docalculatescaleboxscale\scaleboxdimy\scaleboxsizey\scaleboxscay
- \docalculatescaleboxscale\scaleboxdimx\scaleboxsizex\scaleboxscax}%
- {\docalculatescaleboxscale\scaleboxdimy\scaleboxsizey\scaleboxscay
- \docalculatescaleboxscale\scaleboxdimx\scaleboxsizex\scaleboxscax}%
- {\docalculatescaleboxscale\scaleboxdimy\scaleboxsizey\scaleboxscay
- \docalculatescaleboxscale\scaleboxdimx\scaleboxsizex\scaleboxscax}%
+ \setscaleboxbydimension_a
\else
- \dosetdimensionscaleboxsize
- {\docalculatescaleboxscales\scaleboxdimx\scaleboxsizex\scaleboxdimy\scaleboxsizey}%
- {\docalculatescaleboxscales\scaleboxdimx\scaleboxsizex\scaleboxdimy\scaleboxsizey}%
- {\docalculatescaleboxscales\scaleboxdimx\scaleboxsizex\scaleboxdimy\scaleboxsizey}%
+ \setscaleboxbydimension_b
\fi
\else
\ifdim\scaleboxdimy>\zeropoint
- \dosetdimensionscaleboxsize
- {\docalculatescaleboxscales\scaleboxdimy\scaleboxsizey\scaleboxdimx\scaleboxsizex}%
- {\docalculatescaleboxscales\scaleboxdimy\scaleboxsizey\scaleboxdimx\scaleboxsizex}%
- {\docalculatescaleboxscales\scaleboxdimy\scaleboxsizey\scaleboxdimx\scaleboxsizex}%
+ \setscaleboxbydimension_c
\else
- \dosetdimensionscaleboxsize
- {\doapplyscaleboxscale\scaleboxdimx\scaleboxsizex\scaleboxscax\c!xscale
- \doapplyscaleboxscale\scaleboxdimy\scaleboxsizey\scaleboxscay\c!yscale}%
- {\docalculatescaleboxscales\scaleboxdimx\scaleboxsizex\scaleboxdimy\scaleboxsizey}%
- {\docalculatescaleboxscales\scaleboxdimy\scaleboxsizey\scaleboxdimx\scaleboxsizex}%
+ \setscaleboxbydimension_d
\fi
\fi}
+\def\setscaleboxbydimension_a
+ {\dosetdimensionscaleboxsize
+ {\docalculatescaleboxscale\scaleboxdimy\scaleboxsizey\scaleboxscay
+ \docalculatescaleboxscale\scaleboxdimx\scaleboxsizex\scaleboxscax}%
+ {\docalculatescaleboxscale\scaleboxdimy\scaleboxsizey\scaleboxscay
+ \docalculatescaleboxscale\scaleboxdimx\scaleboxsizex\scaleboxscax}%
+ {\docalculatescaleboxscale\scaleboxdimy\scaleboxsizey\scaleboxscay
+ \docalculatescaleboxscale\scaleboxdimx\scaleboxsizex\scaleboxscax}}
+
+\def\setscaleboxbydimension_b
+ {\dosetdimensionscaleboxsize
+ {\docalculatescaleboxscales\scaleboxdimx\scaleboxsizex\scaleboxdimy\scaleboxsizey}%
+ {\docalculatescaleboxscales\scaleboxdimx\scaleboxsizex\scaleboxdimy\scaleboxsizey}%
+ {\docalculatescaleboxscales\scaleboxdimx\scaleboxsizex\scaleboxdimy\scaleboxsizey}}
+
+\def\setscaleboxbydimension_c
+ {\dosetdimensionscaleboxsize
+ {\docalculatescaleboxscales\scaleboxdimy\scaleboxsizey\scaleboxdimx\scaleboxsizex}%
+ {\docalculatescaleboxscales\scaleboxdimy\scaleboxsizey\scaleboxdimx\scaleboxsizex}%
+ {\docalculatescaleboxscales\scaleboxdimy\scaleboxsizey\scaleboxdimx\scaleboxsizex}}
+
+\def\setscaleboxbydimension_d
+ {\dosetdimensionscaleboxsize
+ {\doapplyscaleboxscale\scaleboxdimx\scaleboxsizex\scaleboxscax\c!xscale
+ \doapplyscaleboxscale\scaleboxdimy\scaleboxsizey\scaleboxscay\c!yscale}%
+ {\docalculatescaleboxscales\scaleboxdimx\scaleboxsizex\scaleboxdimy\scaleboxsizey}%
+ {\docalculatescaleboxscales\scaleboxdimy\scaleboxsizey\scaleboxdimx\scaleboxsizex}}
+
\def\dosetdimensionscaleboxsize#1#2#3%
{#1\relax
\doifsomething{\scaleparameter\c!maxwidth}
@@ -326,15 +339,41 @@
#3\relax
\fi}}
-\def\docalculatescaleboxnorm#1#2#3#4#5% 2 3 parameters (dodo:speedup)
- {\processaction
- [\scaleparameter#2]
- [ \v!max=>\global#1\dimexpr#4\relax,
- \v!fit=>\global#1\dimexpr#5\relax,
- \v!broad=>\global#1\dimexpr#5-4\@@exbodyfont\relax,
- \v!auto=>\doifsomething{\scaleparameter#3}{\global#1\dimexpr\scaleparameter#3\relax},
- \s!default=>\doifsomething{\scaleparameter#3}{\global#1\dimexpr\scaleparameter#3\relax},
- \s!unknown=>\global#1\dimexpr\scaleparameter#2\dimexpr\@@exbodyfont/10\relax\relax]}
+% \def\docalculatescaleboxnorm#1#2#3#4#5% 2 3 parameters (dodo:speedup)
+% {\processaction
+% [\scaleparameter#2]
+% [ \v!max=>\global#1\dimexpr#4\relax,
+% \v!fit=>\global#1\dimexpr#5\relax,
+% \v!broad=>\global#1\dimexpr#5-4\@@exbodyfont\relax,
+% \v!auto=>\doifsomething{\scaleparameter#3}{\global#1\dimexpr\scaleparameter#3\relax},
+% \s!default=>\doifsomething{\scaleparameter#3}{\global#1\dimexpr\scaleparameter#3\relax},
+% \s!unknown=>\global#1\dimexpr\scaleparameter#2\dimexpr\@@exbodyfont/10\relax\relax]}
+
+\def\docalculatescaleboxnorm#1#2% todo: swap 1 and 2 and pass one less
+ {\edef\askedscaleboxnorm{\scaleparameter#2}%
+ \csname\??ef:n:\ifcsname\??ef:n:\askedscaleboxnorm\endcsname
+ \askedscaleboxnorm\else\s!unknown
+ \fi\endcsname{#1}}
+
+\setvalue{\??ef:n:\v!max}#1#2#3#4%
+ {\global#1#3}
+
+\setvalue{\??ef:n:\v!fit}#1#2#3#4%
+ {\global#1#4}
+
+\setvalue{\??ef:n:\v!broad}#1#2#3#4%
+ {\global#1\dimexpr#4-4\@@exbodyfont\relax}
+
+\setvalue{\??ef:n:\s!unknown}#1#2#3#4%
+ {\global#1\dimexpr\askedscaleboxnorm\dimexpr\@@exbodyfont/10\relax\relax}
+
+\def\docalculatescaleboxnormauto#1#2#3#4%
+ {\edef\askedscaleboxnorm{\scaleparameter#2}%
+ \ifx\askedscaleboxnorm\empty\else\global#1\askedscaleboxnorm\fi}
+
+\letvalue{\??ef:n:\v!auto }\docalculatescaleboxnormauto
+\letvalue{\??ef:n:\empty }\docalculatescaleboxnormauto
+\letvalue{\??ef:n:\s!default}\docalculatescaleboxnormauto
\def\docalculatescaleboxscales#1#2#3#4%
{\scratchdimen\dimexpr#1/\dimexpr#2/\plusthousand\relax\relax
@@ -426,7 +465,18 @@
\ifdim\ht\nextbox<\scratchdimen
\setbox\nextbox\vbox to \scratchdimen{\vss\box\nextbox\vss}%
\fi}}
-
+
+\def\fastscale#1%
+ {\begingroup
+ \ifnum#1=1000\relax
+ \setfalse\scaleboxdone
+ \else
+ \settrue\scaleboxdone
+ \edef\finalscaleboxxscale{\withoutpt\the\dimexpr#1pt/1000\relax}%
+ \let\finalscaleboxyscale\finalscaleboxxscale
+ \fi
+ \dowithnextbox{\doscaleboxindeed\flushnextbox\endgroup}\hbox}
+
%D \macros
%D {clip, setupclipping}
%D
diff --git a/tex/context/base/mult-low.lua b/tex/context/base/mult-low.lua
index d09317253..7ea99322a 100644
--- a/tex/context/base/mult-low.lua
+++ b/tex/context/base/mult-low.lua
@@ -14,7 +14,8 @@ return {
"zerocount", "minusone", "minustwo", "plusone", "plustwo", "plusthree", "plusfour", "plusfive",
"plussix", "plusseven", "pluseight", "plusnine", "plusten", "plussixteen", "plushundred",
"plusthousand", "plustenthousand", "plustwentythousand", "medcard", "maxcard",
- "zeropoint", "onepoint", "onebasepoint", "maxdimen", "scaledpoint", "thousandpoint", "points",
+ "zeropoint", "onepoint", "halfapoint", "onebasepoint", "maxdimen", "scaledpoint", "thousandpoint",
+ "points", "halfpoint",
"zeroskip",
"pluscxxvii", "pluscxxviii", "pluscclv", "pluscclvi",
--
diff --git a/tex/context/base/pack-bck.mkvi b/tex/context/base/pack-bck.mkvi
index db7cd7bee..ed742421a 100644
--- a/tex/context/base/pack-bck.mkvi
+++ b/tex/context/base/pack-bck.mkvi
@@ -176,10 +176,12 @@
\background_direct_ignore}
\def\background_direct_indeed
- {\dowithnextbox
- {\setupcurrentbackground[\c!offset=\v!overlay]%
- \inheritedbackgroundframed{\flushnextbox}\endgroup}
- \vbox}
+ {\dowithnextboxcs\background_direct_finish\vbox}
+
+\def\background_direct_finish
+ {\setupcurrentbackground[\c!offset=\v!overlay]%
+ \inheritedbackgroundframed{\flushnextbox}%
+ \endgroup}
\def\background_direct_ignore
{\endgroup}
@@ -237,16 +239,17 @@
\unexpanded\def\backgroundline[#color]%
{\dontleavehmode
- \dowithnextbox
- {\hbox
- {\faststartcolor[#color]%
- \vrule
- \!!width \nextboxwd
- \!!height\nextboxht
- \!!depth \nextboxdp
- \faststopcolor
- \hskip-\nextboxwd
- \flushnextbox}}%
- \hbox}
+ \dowithnextbox{\background_add_to_nextbox{#color}}\hbox}
+
+\unexpanded\def\background_add_to_nextbox#color% handy helper
+ {\hbox
+ {\faststartcolor[#color]%
+ \vrule
+ \!!width \nextboxwd
+ \!!height\nextboxht
+ \!!depth \nextboxdp
+ \faststopcolor
+ \hskip-\nextboxwd
+ \flushnextbox}}
\protect \endinput
diff --git a/tex/context/base/pack-box.mkiv b/tex/context/base/pack-box.mkiv
index a7a025a15..7469a55f8 100644
--- a/tex/context/base/pack-box.mkiv
+++ b/tex/context/base/pack-box.mkiv
@@ -559,35 +559,48 @@
% \setlayerframed[layer id][layer settings][framed setting]{data}
% \setlayerframed[layer id][combined settings]{data}
+% tricky: offsets apply to both the layer and the framed; it makes sense to
+% only apply the offset to ...
+
\def\setlayerframed
{\dotripleempty\dosetlayerframed}
+% \def\dosetlayerframed
+% {\ifthirdargument
+% \expandafter\dosetlayerframedT
+% \else
+% \expandafter\dosetlayerframedS
+% \fi}
+%
+% \def\dosetlayerframedT[#1][#2][#3]%
+% {\dowithnextbox{\setlayer[#1][#2]{\flushnextbox}}%
+% \hbox\framed[#3]}
+%
+% \def\dosetlayerframedS[#1][#2][#3]%
+% {\dowithnextbox % we could use a local setlayer command (no doif..empty) which also saves a nextbox
+% {\setlayer[#1][\c!width=\nextboxwd,\c!height=\nextboxht,#2,\c!offset=\!!zeropoint]{\flushnextbox}}%
+% \hbox\normalframedwithsettings[\c!location=\v!normal,#2]}% fast call (no arg check)
+
\def\dosetlayerframed
{\ifthirdargument
\expandafter\dosetlayerframedT
+ \else\ifsecondargument
+ \doubleexpandafter\dosetlayerframedD
\else
- \expandafter\dosetlayerframedS
- \fi}
+ \doubleexpandafter\dosetlayerframedS
+ \fi\fi}
-\def\dosetlayerframedT[#1][#2][#3]%
- {\dowithnextbox{\setlayer[#1][#2]{\flushnextbox}}%
- \hbox\framed[#3]}
+\def\dosetlayerframedS[#1][#2][#3]%
+ {\setlayer[#1][\c!width=\wd\nextbox,\c!height=\ht\nextbox,\c!offset=\zeropoint]%
+ \normalframedwithsettings[\c!location=\v!normal]} % diffrent kind of location
-% tricky: offsets apply to both the layer and the framed; it makes sense to
-% only apply the offset to ...
+\def\dosetlayerframedD[#1][#2][#3]%
+ {\setlayer[#1][\c!width=\wd\nextbox,\c!height=\ht\nextbox,#2,\c!offset=\zeropoint]%
+ \normalframedwithsettings[\c!location=\v!normal,#2]} % diffrent kind of location
-% \def\dosetlayerframedS[#1][#2][#3]%
-% {\dowithnextbox % we could use a local setlayer command (no doif..empty) which also saves a nextbox
-% {\setlayer[#1][\c!width=\nextboxwd,\c!height=\nextboxht,\c!offset=\!!zeropoint,#2]{\flushnextbox}}%
-% \hbox\framed[\c!location=\v!normal,#2]}% could be a fast one
-%
-% better (2011-09-06)
-
-\def\dosetlayerframedS[#1][#2][#3]%
- {\dowithnextbox % we could use a local setlayer command (no doif..empty) which also saves a nextbox
- {\setlayer[#1][\c!width=\nextboxwd,\c!height=\nextboxht,#2,\c!offset=\!!zeropoint]{\flushnextbox}}%
-% \hbox\framed[\c!location=\v!normal,#2]}% could be a fast one (no #2,\c!offset=\defaultframeoffset)
- \hbox\normalframedwithsettings[\c!location=\v!normal,#2]}% fast call (no arg check)
+\def\dosetlayerframedT[#1][#2][#3]%
+ {\setlayer[#1][#2]%
+ \normalframedwithsettings[#3]}
\def\setlayertext
{\dotripleempty\dosetlayertext}
@@ -604,7 +617,7 @@
\dowithnextboxcontent
{\forgetall
\hsize\@@lxwidth
- \expanded{\setupalign[\@@lxalign]}%
+ \normalexpanded{\setupalign[\@@lxalign]}%
\dousestyleparameter\@@lxstyle}
{\setlayer[#1][#2]{\strut\dousecolorparameter\@@lxcolor\flushnextbox}%
\egroup}%
diff --git a/tex/context/base/pack-lyr.mkiv b/tex/context/base/pack-lyr.mkiv
index 69cce43cb..2bba60df7 100644
--- a/tex/context/base/pack-lyr.mkiv
+++ b/tex/context/base/pack-lyr.mkiv
@@ -142,7 +142,7 @@
\def\dosetlayer[#1][#2][#3]% #4 == box do \fi is ok
{\doifelsevalue{\??ll#1\c!state}\v!stop
- {\dowithnextbox\donothing\hbox}
+ {\dowithnextboxcs\donothing\hbox}
{\ifthirdargument
\dodosetlayer[#1][#2][#3]%
\else
@@ -274,9 +274,9 @@
\setbox\layerbox\emptybox
\globallet\lastlayerxpos\!!zeropoint
\globallet\lastlayerypos\!!zeropoint
- \normalexpanded{\noexpand\doifinset{\v!bottom}{\layerparameter\c!corner}}\dosetlayerbottompositions
- \normalexpanded{\noexpand\doifinset{\v!right }{\layerparameter\c!corner}}\dosetlayerrightpositions
- \normalexpanded{\noexpand\doifinset{\v!middle}{\layerparameter\c!corner}}\dosetlayermiddlepositions
+ \normalexpanded{\doifinset{\v!bottom}{\layerparameter\c!corner}}\dosetlayerbottompositions
+ \normalexpanded{\doifinset{\v!right }{\layerparameter\c!corner}}\dosetlayerrightpositions
+ \normalexpanded{\doifinset{\v!middle}{\layerparameter\c!corner}}\dosetlayermiddlepositions
\edef\layerpage{\layerparameter\c!page}%
\fi
\ifx\layerpage\empty \else % is expanded
diff --git a/tex/context/base/page-flt.mkiv b/tex/context/base/page-flt.mkiv
index 29de9acd4..f2b183f2d 100644
--- a/tex/context/base/page-flt.mkiv
+++ b/tex/context/base/page-flt.mkiv
@@ -148,6 +148,31 @@
\blank[\rootfloatparameter\c!spaceafter]
\fi}}
+% \setupcaption [figure] [align=flushleft]
+% \setupcaption [figure-1] [align=flushleft,leftmargin=10mm]
+% \setupcaption [figure-2] [align=flushleft,leftmargin=10mm,rightmargin=-10mm,width=\textwidth]
+%
+% \startsetups somefigure
+% \ifdim\floatsetupwidth>\textwidth
+% \placesetupfloat[figure-2]
+% \else
+% \placesetupfloat[figure-1]
+% \fi
+% \stopsetups
+%
+% \placefloatwithsetups[somefigure]{}{\externalfigure[dummy][width=5cm,height=2cm]}
+
+\def\placefloatwithsetups
+ {\dotripleempty\doplacefloatwithsetups}
+
+\long\def\doplacefloatwithsetups[#1][#2][#3]#4%
+ {\def\floatsetupcaption {#4}%
+ \def\floatsetupcontent {\copy\nextbox}%
+ \def\floatsetupwidth {\wd\nextbox}%
+ \def\floatsetupheight {\ht\nextbox}%
+ \def\placesetupfloat[##1]{\placefloat[##1][#2][#3]{#4}{\floatsetupcontent}}% #4 and not \floatsetupcaption (unexpanded)
+ \dowithnextbox{\setups[#1]}\vbox}
+
%D The following code is in transition as we don't want to break the
%D current single column, multi column, and columnset mechanism.
%D
diff --git a/tex/context/base/page-ini.mkiv b/tex/context/base/page-ini.mkiv
index 8cb146505..d423a5d8a 100644
--- a/tex/context/base/page-ini.mkiv
+++ b/tex/context/base/page-ini.mkiv
@@ -340,7 +340,7 @@
\fi}
\def\page_otr_add_special_content
- {\dowithnextbox\page_otr_add_special_content_indeed\hbox}
+ {\dowithnextboxcs\page_otr_add_special_content_indeed\hbox}
\def\page_otr_add_special_content_indeed
{\wd\nextbox\zeropoint
diff --git a/tex/context/base/page-mul.mkiv b/tex/context/base/page-mul.mkiv
index f00dec89b..91342f6c4 100644
--- a/tex/context/base/page-mul.mkiv
+++ b/tex/context/base/page-mul.mkiv
@@ -1673,43 +1673,44 @@
\hsize\@@ksn\hsize
\advance\hsize -\intercolumnwidth
\fi
- \dowithnextbox
- {\setbox\columnspanbox\flushnextbox
- \ifinsidecolumns\wd\columnspanbox\hsize\fi
- \postprocesscolumnspanbox\columnspanbox
- \scratchdimen\ht\columnspanbox
- \setbox\columnspanbox\hbox % depth to be checked, probably option!
- {\localframed[\??ks][\c!offset=\v!overlay]{\box\columnspanbox}}%
- \ht\columnspanbox\scratchdimen
- \dp\columnspanbox\strutdp
- \wd\columnspanbox\hsize
- \ifinsidecolumns
- \ifnum\@@ksn>1
- \setvsize
- \dohandleallcolumns
- {\ifnum\currentcolumn>\@@ksn\else
- \global\setbox\currenttopcolumnbox=\vbox
- {\ifnum\currentcolumn=1
- \snaptogrid\vbox{\copy\columnspanbox}
- \else
- \snaptogrid\vbox{\vphantom{\copy\columnspanbox}}
- \fi}%
- \wd\currenttopcolumnbox\hsize
- \global\advance\vsize -\ht\currenttopcolumnbox
- \fi}
- \global\pagegoal\vsize
- \else
- \snaptogrid\vbox{\box\columnspanbox}
- \fi
- \else
- \snaptogrid\vbox{\box\columnspanbox}
- \fi
- \endgraf
- \ifvmode\prevdepth\strutdp\fi
- \egroup}
- \vbox\bgroup
- %\topskipcorrection % becomes an option !
- \EveryPar{\begstrut\EveryPar{}}} % also !
+ \dowithnextboxcs\dofinishcolumnsetspan\vbox\bgroup
+ %\topskipcorrection % becomes an option !
+ \EveryPar{\begstrut\EveryPar{}}} % also !
+
+\def\dofinishcolumnsetspan
+ {\setbox\columnspanbox\flushnextbox
+ \ifinsidecolumns\wd\columnspanbox\hsize\fi
+ \postprocesscolumnspanbox\columnspanbox
+ \scratchdimen\ht\columnspanbox
+ \setbox\columnspanbox\hbox % depth to be checked, probably option!
+ {\localframed[\??ks][\c!offset=\v!overlay]{\box\columnspanbox}}%
+ \ht\columnspanbox\scratchdimen
+ \dp\columnspanbox\strutdp
+ \wd\columnspanbox\hsize
+ \ifinsidecolumns
+ \ifnum\@@ksn>1
+ \setvsize
+ \dohandleallcolumns
+ {\ifnum\currentcolumn>\@@ksn\else
+ \global\setbox\currenttopcolumnbox=\vbox
+ {\ifnum\currentcolumn=1
+ \snaptogrid\vbox{\copy\columnspanbox}
+ \else
+ \snaptogrid\vbox{\vphantom{\copy\columnspanbox}}
+ \fi}%
+ \wd\currenttopcolumnbox\hsize
+ \global\advance\vsize -\ht\currenttopcolumnbox
+ \fi}
+ \global\pagegoal\vsize
+ \else
+ \snaptogrid\vbox{\box\columnspanbox}
+ \fi
+ \else
+ \snaptogrid\vbox{\box\columnspanbox}
+ \fi
+ \endgraf
+ \ifvmode\prevdepth\strutdp\fi
+ \egroup}
\unexpanded\def\startcolumnspan
{\dosingleempty\dostartcolumnspan}
diff --git a/tex/context/base/spac-ali.mkiv b/tex/context/base/spac-ali.mkiv
index c60dbbc3d..b50ee59f6 100644
--- a/tex/context/base/spac-ali.mkiv
+++ b/tex/context/base/spac-ali.mkiv
@@ -429,7 +429,7 @@
\let\updateraggedskips\relax
-\unexpanded\def\setraggedskips#1#2#3#4#5#6#7% never change this name
+\unexpanded\def\setraggedskips#1#2#3#4#5#6#7% never change this name (todo: inline this one .. less tracingall)
{\unexpanded\def\updateraggedskips{\dosetraggedskips{#1}{#2}{#3}{#4}{#5}{#6}{#7}}%
\updateraggedskips}
@@ -640,8 +640,8 @@
\installalign \v!new {\@@asraggedfalse} % so new will give you consistency
\installalign \v!reset {\notragged\normalbottom}
-\installalign \v!tolerant {\tolerance3000 \relax}
-\installalign \v!verytolerant {\tolerance4500 \relax}
+\installalign \v!tolerant {\tolerance3000\relax}
+\installalign \v!verytolerant {\tolerance4500\relax}
\installalign \v!stretch {\emergencystretch\bodyfontsize}
\installalign \v!righttoleft {\lefttoright}
@@ -759,7 +759,7 @@
\def\doalignedline#1{\resetrealignsignal\csname\s!do\v!line#1\endcsname}
%D Experimental (will be redone when floats are redone as it's real messy
-%D now):
+%D now). It can also be made faster (if needed).
\def\doxalignline#1#2#3#4#5#6%
{\noindentation % was \noindent
diff --git a/tex/context/base/spac-ver.mkiv b/tex/context/base/spac-ver.mkiv
index c43e49853..2d137d360 100644
--- a/tex/context/base/spac-ver.mkiv
+++ b/tex/context/base/spac-ver.mkiv
@@ -476,11 +476,12 @@
\egroup}
\unexpanded\def\correctwhitespace
- {\dowithnextbox
- {\startbaselinecorrection
- \flushnextbox
- \stopbaselinecorrection}%
- \vbox}
+ {\dowithnextboxcs\correctwhitespacefinish\vbox}
+
+\def\correctwhitespacefinish
+ {\startbaselinecorrection
+ \flushnextbox
+ \stopbaselinecorrection}
\unexpanded\def\verticalstrut {\normalvbox{\hsize\zeropoint\forgetall\strut}}
\unexpanded\def\horizontalstrut{\normalhbox {\strut}}
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index 901e46da8..6fd5f7f54 100644
--- a/tex/context/base/status-files.pdf
+++ b/tex/context/base/status-files.pdf
Binary files differ
diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf
index d75df13e0..544fde0a4 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/strc-itm.mkvi b/tex/context/base/strc-itm.mkvi
index 13f0f1c2d..3d3a7f953 100644
--- a/tex/context/base/strc-itm.mkvi
+++ b/tex/context/base/strc-itm.mkvi
@@ -933,7 +933,7 @@
% WS: make the distance between items customizable, think about better default values -> see itemize-1.tex
\itemgroups_set_text_item_distance% HH: moved out and made configurable (sort of)
\removeunwantedspaces
- \hskip\textitemdistance\relax
+ \hskip\m_itemgroups_text_distance\relax
\fi
\else
\itemgroups_between_command
diff --git a/tex/context/base/syst-ini.mkiv b/tex/context/base/syst-ini.mkiv
index df18f5307..e4cdfbd2b 100644
--- a/tex/context/base/syst-ini.mkiv
+++ b/tex/context/base/syst-ini.mkiv
@@ -345,12 +345,14 @@
\newskip \zeroskip \zeroskip = 0pt plus 0pt minus 0pt
\newdimen\zeropoint \zeropoint = 0pt
\newdimen\onepoint \onepoint = 1pt
+\newdimen\halfapoint \halfapoint = 0.5pt
\newdimen\maxdimen \maxdimen = 16383.99999pt
\newdimen\onebasepoint \onebasepoint = 1bp
\newdimen\scaledpoint \scaledpoint = 1sp
\newdimen\thousandpoint\thousandpoint= 1000pt
-\let\points\onepoint
+\let\points \onepoint
+\let\halfpoint\halfapoint
\newtoks \emptytoks
diff --git a/tex/context/base/tabl-tbl.mkiv b/tex/context/base/tabl-tbl.mkiv
index 0a4aa3690..680e9160a 100644
--- a/tex/context/base/tabl-tbl.mkiv
+++ b/tex/context/base/tabl-tbl.mkiv
@@ -318,9 +318,11 @@
\unexpanded\def\aftertabulateentry {\unskip\unskip\ifmmode\else\endgraf\fi}
\unexpanded\def\beginreshapedtabulatepar
- {\dowithnextbox
- {\ctxcommand{doreshapeframedbox(\number\nextbox)}\ifvmode\unvbox\else\box\fi\nextbox}
- \vbox\bgroup}
+ {\dowithnextboxcs\beginreshapedtabulateparfinish\vbox\bgroup}
+
+\def\beginreshapedtabulateparfinish
+ {\ctxcommand{doreshapeframedbox(\number\nextbox)}%
+ \ifvmode\unvbox\else\box\fi\nextbox}
\let\endreshapedtabulatepar\egroup
diff --git a/tex/context/base/tabl-tsp.mkiv b/tex/context/base/tabl-tsp.mkiv
index 84ea7d540..f230346bd 100644
--- a/tex/context/base/tabl-tsp.mkiv
+++ b/tex/context/base/tabl-tsp.mkiv
@@ -107,42 +107,44 @@
\fi}
\def\dodowithsplitofffloat
- {\dowithnextbox
- {\forgetall
- \dontcomplain
- \global\settrue\splitfloatdone
- \nodelocationmode\zerocount % bypass auto-renumbering
- \global\advance\noffloatssplits\plusone
- \ifcase\noffloatssplits\relax \or
- \ifconditional\onlyonesplitofffloat
- \let\floatcaptionsuffix\empty
- \fi
- \fi
- \bgroup
- \ifconditional\somenextsplitofffloat
- \notesenabledfalse % best here, experimental, brrr; test with note in caption
- \fi
- \splitfloatcommand{\box\nextbox}%
- \egroup
- \ifconditional\somenextsplitofffloat
- \doifelsenothing\@@siinbetween
- {\ifconditional\splitfloatfirstdone\else\page\fi}
- \@@siinbetween
- \else
- \@@siafter
- \dopopsavedfloats
- \doflushsavedfloats
- \fi
- \global\settrue\splitfloatfirstdone}%
- \vbox}
+ {\dowithnextboxcs\dodowithsplitofffloatfinish\vbox}
+
+\def\dodowithsplitofffloatfinish
+ {\forgetall
+ \dontcomplain
+ \global\settrue\splitfloatdone
+ \nodelocationmode\zerocount % bypass auto-renumbering
+ \global\advance\noffloatssplits\plusone
+ \ifcase\noffloatssplits\relax \or
+ \ifconditional\onlyonesplitofffloat
+ \let\floatcaptionsuffix\empty
+ \fi
+ \fi
+ \bgroup
+ \ifconditional\somenextsplitofffloat
+ \notesenabledfalse % best here, experimental, brrr; test with note in caption
+ \fi
+ \splitfloatcommand{\box\nextbox}%
+ \egroup
+ \ifconditional\somenextsplitofffloat
+ \doifelsenothing\@@siinbetween
+ {\ifconditional\splitfloatfirstdone\else\page\fi}
+ \@@siinbetween
+ \else
+ \@@siafter
+ \dopopsavedfloats
+ \doflushsavedfloats
+ \fi
+ \global\settrue\splitfloatfirstdone}
\def\nodowithsplitofffloat
- {\dowithnextbox
- {\forgetall
- \dontcomplain
- \box\nextbox % maybe an option to unvbox
- \global\settrue\splitfloatfirstdone}%
- \vbox}
+ {\dowithnextboxcs\nodowithsplitofffloatfinish\vbox}
+
+\def\nodowithsplitofffloatfinish
+ {\forgetall
+ \dontcomplain
+ \box\nextbox % maybe an option to unvbox
+ \global\settrue\splitfloatfirstdone}
\def\dochecksplitofffloat#1% box
{\ifinsidesplitfloat
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 470a2d0e5..eac42c455 100644
--- a/tex/generic/context/luatex/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : luatex-fonts-merged.lua
-- parent file : luatex-fonts.lua
--- merge date : 12/14/11 22:12:50
+-- merge date : 12/15/11 13:56:19
do -- begin closure to overcome local limits and interference