summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/cont-new.mkii2
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4076 -> 4067 bytes
-rw-r--r--tex/context/base/context-version.pngbin106472 -> 106411 bytes
-rw-r--r--tex/context/base/context.mkii2
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/core-env.lua3
-rw-r--r--tex/context/base/pack-bck.mkvi10
-rw-r--r--tex/context/base/page-mul.mkiv2
-rw-r--r--tex/context/base/spac-ali.mkiv316
-rw-r--r--tex/context/base/status-files.pdfbin23978 -> 24005 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin168569 -> 168562 bytes
-rw-r--r--tex/context/base/tabl-xtb.lua181
-rw-r--r--tex/context/base/tabl-xtb.mkvi20
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
15 files changed, 347 insertions, 195 deletions
diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii
index 0334b3b26..30e8e3c4c 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.11.21 18:27}
+\newcontextversion{2011.11.23 16:20}
%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 d66803e3e..a3eb8d694 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.11.21 18:27}
+\newcontextversion{2011.11.23 16:20}
%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/context-version.pdf b/tex/context/base/context-version.pdf
index bcb7a8077..81add2f72 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 48d8de8b0..4a1c23de2 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 6c88149d3..4c0e453e6 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.11.21 18:27}
+\edef\contextversion{2011.11.23 16:20}
%D For those who want to use this:
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index c3589ad80..cfd8fcd56 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.11.21 18:27}
+\edef\contextversion{2011.11.23 16:20}
%D For those who want to use this:
diff --git a/tex/context/base/core-env.lua b/tex/context/base/core-env.lua
index 543dc188f..c31df929e 100644
--- a/tex/context/base/core-env.lua
+++ b/tex/context/base/core-env.lua
@@ -14,8 +14,8 @@ if not modules then modules = { } end modules ['core-env'] = {
local P, C, S, Cc, lpegmatch, patterns = lpeg.P, lpeg.C, lpeg.S, lpeg.Cc, lpeg.match, lpeg.patterns
local csname_id = token.csname_id
-local texcount = tex.count
local create = token.create
+local texcount = tex.count
local allocate = utilities.storage.allocate
local setmetatableindex = table.setmetatableindex
@@ -71,6 +71,7 @@ setmetatableindex(tex.conditionals, function(t,k) -- 0 == true
end)
setmetatableindex(tex.ifs, function(t,k)
+ -- k = "if" .. k -- better not
return csname_id(k) ~= undefined and create(k)[2] == iftrue -- inefficient, this create, we need a helper
end)
diff --git a/tex/context/base/pack-bck.mkvi b/tex/context/base/pack-bck.mkvi
index 200495719..c783a17d8 100644
--- a/tex/context/base/pack-bck.mkvi
+++ b/tex/context/base/pack-bck.mkvi
@@ -118,8 +118,8 @@
\scratchdimen\textheight
\backgroundsplitmode\plusone % split to max height
\else
- \setbox0\vbox{\backgroundparameter\c!before}%
- \scratchdimen\dimexpr\pagegoal-\ht0-\pagetotal\relax
+ \setbox2\vbox{\backgroundparameter\c!before}%
+ \scratchdimen\dimexpr\pagegoal-\ht2-\pagetotal\relax
\backgroundsplitmode\plustwo % split to partial height
\fi
\advance\scratchdimen\dimexpr-\backgroundparameter\c!topoffset-\backgroundparameter\c!bottomoffset\relax
@@ -145,9 +145,9 @@
\fi
\startlinecorrection
\ifnum\backgroundsplitmode=\plusthree
- \hskip\dimen2
- \fi %
- \inheritedbackgroundframed{\box2}% new **
+ \hskip\dimen2 % new **
+ \fi
+ \inheritedbackgroundframed{\box2}%
\stoplinecorrection
\ifcase\backgroundsplitmode % no split
\backgroundparameter\c!after
diff --git a/tex/context/base/page-mul.mkiv b/tex/context/base/page-mul.mkiv
index 46fc28189..5dfe47c3d 100644
--- a/tex/context/base/page-mul.mkiv
+++ b/tex/context/base/page-mul.mkiv
@@ -358,7 +358,7 @@
\newdimen\mcscratchdimen
\newcount\nofcolumnlines
-\newconstant\multicolumnlinemethod % 0: overshoot (old default), 1: tight
+\setnewconstant\multicolumnlinemethod\plusone % 0: overshoot (old default), 1: tight
\def\getmulticolumnlines
{\mcscratchdimen-\columntextoffset
diff --git a/tex/context/base/spac-ali.mkiv b/tex/context/base/spac-ali.mkiv
index e5e815d19..c60dbbc3d 100644
--- a/tex/context/base/spac-ali.mkiv
+++ b/tex/context/base/spac-ali.mkiv
@@ -76,7 +76,7 @@
ddir="r2l",
\fi}
-\def\synchronizelayoutdirection
+\unexpanded\def\synchronizelayoutdirection
{\ifconditional\layoutlefttoright
\settrue\inlinelefttoright
\textdir TLT\relax
@@ -87,7 +87,7 @@
\pardir TRT\relax
\fi}
-\def\synchronizedisplaydirection
+\unexpanded\def\synchronizedisplaydirection
{\ifconditional\displaylefttoright
\settrue\inlinelefttoright
\textdir TLT\relax
@@ -98,14 +98,14 @@
\pardir TRT\relax
\fi}
-\def\synchronizeinlinedirection
+\unexpanded\def\synchronizeinlinedirection
{\ifconditional\inlinelefttoright
\textdir TLT\relax
\else
\textdir TRT\relax
\fi}
-\def\showdirections
+\unexpanded\def\showdirections
{\dontleavehmode
\begingroup\infofont\textdir TLT[\space
layout:\ifconditional \layoutlefttoright l2r\else r2l\fi\space
@@ -121,7 +121,7 @@
% To be redone:
-\def\ibox#1#2#3%
+\unexpanded\def\ibox#1#2#3%
{\vbox\bgroup
\forgetall
\let\\=\endgraf
@@ -129,7 +129,7 @@
\doifrightpageelse\raggedright\raggedleft
\let\next}
-\def\obox#1#2#3%
+\unexpanded\def\obox#1#2#3%
{\vbox\bgroup
\forgetall
\let\\=\endgraf
@@ -190,6 +190,47 @@
% pretty slow (will be sped up)
+\newconstant\ragged_command_h_align_state
+\newconstant\ragged_command_v_align_state
+\newconstant\ragged_command_broad_state
+
+\ifdefined\raggedonelinerstate \else \newconditional\raggedonelinerstate \fi % public
+
+% \unexpanded\def\dosetraggedcommand#1% beware: #1=empty is ignored, keep that! assumes \forgetall
+% {\edef\askedraggedalign{#1}%
+% \ifx\askedraggedalign\empty
+% \nonosetraggedcommand
+% \else
+% \dodosetraggedcommand
+% \fi}
+%
+% \def\nonosetraggedcommand
+% {\everyraggedcommand{\resetrealignsignal}% \emptytoks maybe only when #1 <> empty
+% \let\raggedtopcommand\empty
+% \let\raggedbottomcommand\empty
+% \let\raggedbox\relax
+% \setfalse\raggedonelinerstate}
+%
+% \def\dodosetraggedcommand % beware: #1=empty is ignored, keep that!
+% {\everyraggedcommand{\resetrealignsignal}% \emptytoks maybe only when #1 <> empty
+% \let\raggedtopcommand\empty
+% \let\raggedbottomcommand\empty
+% \let\raggedbox\relax
+% \setfalse\raggedonelinerstate
+% \ifcsname\@@ragged@@command\askedraggedalign\endcsname % fast for one keyword and special table case
+% \!!doneafalse
+% \!!donebfalse
+% \!!donectrue
+% \csname\@@ragged@@command\askedraggedalign\endcsname
+% \else
+% \doifinsetelse\v!broad\askedraggedalign\!!doneatrue\!!doneafalse
+% \doifinsetelse\v!wide \askedraggedalign\!!donebtrue\!!donebfalse
+% \!!donectrue
+% \rawprocesscommacommand[\askedraggedalign]\dododosetraggedcommand
+% \fi}
+
+% happens a lot: {\flushleft,broad,high} \veryraggedright\let\raggedbottomcommand\vfilll
+
\unexpanded\def\dosetraggedcommand#1% beware: #1=empty is ignored, keep that! assumes \forgetall
{\edef\askedraggedalign{#1}%
\ifx\askedraggedalign\empty
@@ -198,150 +239,141 @@
\dodosetraggedcommand
\fi}
-\def\nonosetraggedcommand
- {\everyraggedcommand{\resetrealignsignal}% \emptytoks maybe only when #1 <> empty
- \let\raggedtopcommand\empty
- \let\raggedbottomcommand\empty
- \let\raggedbox\relax
- \setfalse\raggedonelinerstate}
-
-\def\dodosetraggedcommand % beware: #1=empty is ignored, keep that!
- {\everyraggedcommand{\resetrealignsignal}% \emptytoks maybe only when #1 <> empty
- \let\raggedtopcommand\empty
+\def\dodosetraggedcommand
+ {\let\raggedtopcommand\empty
\let\raggedbottomcommand\empty
\let\raggedbox\relax
\setfalse\raggedonelinerstate
- \ifcsname\@@ragged@@command\askedraggedalign\endcsname % fast for one keyword and special table case
- \!!doneafalse
- \!!donebfalse
- \!!donectrue
+ \everyraggedcommand\emptytoks
+ \ragged_command_broad_state \zerocount
+ \ragged_command_h_align_state\zerocount
+ \ragged_command_v_align_state\zerocount
+ \ifcsname\@@ragged@@command\askedraggedalign\endcsname
\csname\@@ragged@@command\askedraggedalign\endcsname
\else
- \doifinsetelse\v!broad\askedraggedalign\!!doneatrue\!!doneafalse
- \doifinsetelse\v!wide \askedraggedalign\!!donebtrue\!!donebfalse
- \!!donectrue
\rawprocesscommacommand[\askedraggedalign]\dododosetraggedcommand
- \fi}
+ \fi
+ \normalexpanded{\everyraggedcommand\expandafter{\expandafter\resetrealignsignal\the\everyraggedcommand\ragged_command_flush_align}}}
-\setvalue{\@@ragged@@command\v!table}% {flushleft,broad,high}
- {\let\raggedbottomcommand\vfilll
- \appendtoks\veryraggedright\to\everyraggedcommand}
+\def\nonosetraggedcommand
+ {\let\raggedtopcommand\empty
+ \let\raggedbottomcommand\empty
+ \let\raggedbox\relax
+ \setfalse\raggedonelinerstate
+ \everyraggedcommand{\resetrealignsignal}}
\def\dododosetraggedcommand#1%
-% {\executeifdefined{\@@ragged@@command\string#1}\relax}
{\csname\@@ragged@@command#1\endcsname}
-\def\ragged_command_tolerant {\tolerance3000\relax}
-\def\ragged_command_very_tolerant{\tolerance4500\relax}
-\def\ragged_command_stretch {\emergencystretch\bodyfontsize}
-
-% \everyraggedcommand\expandafter{\the\everyraggedcommand#1}
-
-\setvalue{\@@ragged@@command\v!hanging }{\appendtoks\enableprotruding \to\everyraggedcommand}
-\setvalue{\@@ragged@@command\v!nothanging }{\appendtoks\disableprotruding \to\everyraggedcommand}
-\setvalue{\@@ragged@@command\v!hz }{\appendtoks\enableadjusting \to\everyraggedcommand}
-\setvalue{\@@ragged@@command\v!nohz }{\appendtoks\disableadjusting \to\everyraggedcommand}
-%setvalue{\@@ragged@@command\v!spacing }{\appendtoks\enablespacehandling
-% \enablekernhandling \to\everyraggedcommand}
-%setvalue{\@@ragged@@command\v!nospacing }{\appendtoks\disablespacehandling
-% \disablekernhandling \to\everyraggedcommand}
-\setvalue{\@@ragged@@command\v!hyphenated }{\appendtoks\dohyphens \to\everyraggedcommand}
-\setvalue{\@@ragged@@command\v!nothyphenated}{\appendtoks\nohyphens \to\everyraggedcommand}
-
-\setvalue{\@@ragged@@command\v!tolerant }{\appendtoks\ragged_command_tolerant \to\everyraggedcommand}
-\setvalue{\@@ragged@@command\v!verytolerant }{\appendtoks\ragged_command_very_tolerant\to\everyraggedcommand}
-\setvalue{\@@ragged@@command\v!stretch }{\appendtoks\ragged_command_stretch \to\everyraggedcommand}
-
-\setvalue{\@@ragged@@command\v!left}%
- {\if!!donea \appendtoks\veryraggedleft\to\everyraggedcommand
- \else \appendtoks\raggedleft \to\everyraggedcommand
- \fi
- \!!donecfalse}
-
-\setvalue{\@@ragged@@command\v!right}%
- {\if!!donea \appendtoks\veryraggedright\to\everyraggedcommand
- \else \appendtoks\raggedright \to\everyraggedcommand
- \fi
- \!!donecfalse}
-
-\setvalue{\@@ragged@@command\v!middle}%
- {\if!!donec
- \if!!doneb \appendtoks\raggedwidecenter\to\everyraggedcommand
- \else\if!!donea \appendtoks\veryraggedcenter\to\everyraggedcommand
- \else \appendtoks\raggedcenter \to\everyraggedcommand
- \fi\fi
- \!!donecfalse
- \else
- \let\raggedbottomcommand\vfilll % bonus, pretty strong
- \let\raggedtopcommand \vfilll % used with \framed for
- \fi} % instance in tables
-
-\setvalue{\@@ragged@@command\v!last}%
- {\appendtoks\centeredlastline\to\everyraggedcommand
- \!!donecfalse}
-
-\setvalue{\@@ragged@@command\v!flushleft }{\getvalue{\@@ragged@@command\v!right }}
-\setvalue{\@@ragged@@command\v!flushright}{\getvalue{\@@ragged@@command\v!left }}
-\setvalue{\@@ragged@@command\v!center }{\getvalue{\@@ragged@@command\v!middle}}
-
-\setvalue{\@@ragged@@command\v!high}%
- {\let\raggedbottomcommand\vfilll} % and since we lack a
-
-\setvalue{\@@ragged@@command\v!low}%
- {\let\raggedtopcommand\vfilll} % proper keyword, but
-
-\setvalue{\@@ragged@@command\v!lohi}%
- {\let\raggedbottomcommand\vfilll % we do support the
- \let\raggedtopcommand\vfilll} % ugly laho (lohi)
-
-\setvalue{\@@ragged@@command\v!no}%
- {\appendtoks\raggedright\to\everyraggedcommand}
-
-\setvalue{\@@ragged@@command\v!yes}%
- {\appendtoks\notragged\to\everyraggedcommand}
-
-\setvalue{\@@ragged@@command\v!normal}%
- {\appendtoks\notragged\to\everyraggedcommand}
-
-\setvalue{\@@ragged@@command\v!inner}%
- {\ifdoublesided
- \appendtoks\signalinnerrealign\to\everyraggedcommand
- \fi
- \rightorleftpageaction
- {\getvalue{\@@ragged@@command\v!right}}%
- {\getvalue{\@@ragged@@command\v!left }}}
-
-\setvalue{\@@ragged@@command\v!outer}%
- {\ifdoublesided
- \appendtoks\signalouterrealign\to\everyraggedcommand
- \fi
- \rightorleftpageaction
- {\getvalue{\@@ragged@@command\v!left }}%
- {\getvalue{\@@ragged@@command\v!right}}}
-
-\setvalue{\@@ragged@@command\v!lesshyphenation}%
- {\appendtoks\lesshyphens\to\everyraggedcommand}
-\setvalue{\@@ragged@@command\v!morehyphenation}%
- {\appendtoks\morehyphens\to\everyraggedcommand}
+\unexpanded\def\ragged_command_tolerant {\tolerance3000\relax}
+\unexpanded\def\ragged_command_very_tolerant{\tolerance4500\relax}
+\unexpanded\def\ragged_command_stretch {\emergencystretch\bodyfontsize}
+
+\def\ragged_command_flush_align
+ {\ifcase\ragged_command_h_align_state
+ % 0
+ \notragged
+ \or
+ % 1 center
+ \ifcase\ragged_command_broad_state
+ \raggedcenter
+ \or
+ \veryraggedcenter
+ \or
+ \raggedwidecenter
+ \fi
+ \or
+ % 2 flush left
+ \ifcase\ragged_command_broad_state
+ \raggedright
+ \else
+ \veryraggedright
+ \fi
+ \or
+ % 3 flush right
+ \ifcase\ragged_command_broad_state
+ \raggedleft
+ \else
+ \veryraggedleft
+ \fi
+ \or
+ % 4 inner
+ \ifdoublesided
+ \signalinnerrealign
+ \fi
+ \rightorleftpageaction\raggedright\raggedleft
+ \or
+ % 5 outer
+ \ifdoublesided
+ \signalouterrealign
+ \fi
+ \rightorleftpageaction\raggedleft\raggedright
+ \or
+ % 6 oneliner
+ \ifcase\ragged_command_broad_state
+ \raggedright
+ \else
+ \veryraggedright
+ \fi
+ \parfillskip\zeropoint
+ \or
+ % 7 centered last line
+ \centeredlastline
+ \fi}
-\setvalue{\@@ragged@@command\v!lefttoright}{\appendtoks\lefttoright\to\everyraggedcommand}
-\setvalue{\@@ragged@@command\v!righttoleft}{\appendtoks\righttoleft\to\everyraggedcommand}
-\setvalue{\@@ragged@@command l2r}{\appendtoks\lefttoright\to\everyraggedcommand}
-\setvalue{\@@ragged@@command r2l}{\appendtoks\righttoleft\to\everyraggedcommand}
+\setvalue{\@@ragged@@command\v!broad }{\ragged_command_broad_state\plusone} % was donea
+\setvalue{\@@ragged@@command\v!wide }{\ragged_command_broad_state\plustwo} % was doneb
+
+\setvalue{\@@ragged@@command\v!hanging }{\everyraggedcommand\expandafter{\the\everyraggedcommand\enableprotruding}}
+\setvalue{\@@ragged@@command\v!nothanging }{\everyraggedcommand\expandafter{\the\everyraggedcommand\disableprotruding}}
+\setvalue{\@@ragged@@command\v!hz }{\everyraggedcommand\expandafter{\the\everyraggedcommand\enableadjusting}}
+\setvalue{\@@ragged@@command\v!nohz }{\everyraggedcommand\expandafter{\the\everyraggedcommand\disableadjusting}}
+%setvalue{\@@ragged@@command\v!spacing }{\everyraggedcommand\expandafter{\the\everyraggedcommand\enablespacehandling\enablekernhandling}}
+%setvalue{\@@ragged@@command\v!nospacing }{\everyraggedcommand\expandafter{\the\everyraggedcommand\disablespacehandling\disablekernhandling}}
+\setvalue{\@@ragged@@command\v!hyphenated }{\everyraggedcommand\expandafter{\the\everyraggedcommand\dohyphens}}
+\setvalue{\@@ragged@@command\v!nothyphenated }{\everyraggedcommand\expandafter{\the\everyraggedcommand\nohyphens}}
+
+\setvalue{\@@ragged@@command\v!tolerant }{\everyraggedcommand\expandafter{\the\everyraggedcommand\ragged_command_tolerant}}
+\setvalue{\@@ragged@@command\v!verytolerant }{\everyraggedcommand\expandafter{\the\everyraggedcommand\ragged_command_very_tolerant}}
+\setvalue{\@@ragged@@command\v!stretch }{\everyraggedcommand\expandafter{\the\everyraggedcommand\ragged_command_stretch}}
+
+\setvalue{\@@ragged@@command\v!flushright }{\ragged_command_h_align_state\plusthree}
+\setvalue{\@@ragged@@command\v!flushleft }{\ragged_command_h_align_state\plustwo}
+\setvalue{\@@ragged@@command\v!middle }{\ragged_command_h_align_state\plusone}
+\setvalue{\@@ragged@@command\v!no }{\ragged_command_h_align_state\plustwo}
+\setvalue{\@@ragged@@command\v!yes }{\ragged_command_h_align_state\zerocount}
+\setvalue{\@@ragged@@command\v!normal }{\ragged_command_h_align_state\zerocount}
+\setvalue{\@@ragged@@command\v!inner }{\ragged_command_h_align_state\plusfour}
+\setvalue{\@@ragged@@command\v!outer }{\ragged_command_h_align_state\plusfive}
+\setvalue{\@@ragged@@command\v!right }{\ragged_command_h_align_state\plustwo}
+\setvalue{\@@ragged@@command\v!left }{\ragged_command_h_align_state\plusthree}
+\setvalue{\@@ragged@@command\v!center }{\ragged_command_h_align_state\plusone}
+\setvalue{\@@ragged@@command\v!disable }{\ragged_command_h_align_state\plussix}
+\setvalue{\@@ragged@@command\v!last }{\ragged_command_h_align_state\plusseven}
+
+\setvalue{\@@ragged@@command\v!line }{\settrue\raggedonelinerstate}
+
+\setvalue{\@@ragged@@command\v!high }{\let\raggedbottomcommand\vfilll} % and since we lack a
+\setvalue{\@@ragged@@command\v!low }{\let\raggedtopcommand \vfilll} % proper keyword, but
+\setvalue{\@@ragged@@command\v!lohi }{\let\raggedbottomcommand\vfilll\let\raggedtopcommand\vfilll} % we do support the ugly laho (lohi)
+
+\setvalue{\@@ragged@@command\v!lesshyphenation}{\everyraggedcommand\expandafter{\the\everyraggedcommand\lesshyphens}}
+\setvalue{\@@ragged@@command\v!morehyphenation}{\everyraggedcommand\expandafter{\the\everyraggedcommand\morehyphens}}
+
+\setvalue{\@@ragged@@command\v!lefttoright }{\everyraggedcommand\expandafter{\the\everyraggedcommand\lefttoright}}
+\setvalue{\@@ragged@@command\v!righttoleft }{\everyraggedcommand\expandafter{\the\everyraggedcommand\righttoleft}}
+\setvalue{\@@ragged@@command l2r}{\everyraggedcommand\expandafter{\the\everyraggedcommand\lefttoright}}
+\setvalue{\@@ragged@@command r2l}{\everyraggedcommand\expandafter{\the\everyraggedcommand\righttoleft}}
+
+\setvalue{\@@ragged@@command\v!table }{\let\raggedbottomcommand\vfilll
+ \ragged_command_broad_state\plusone
+ \ragged_command_h_align_state\plustwo}
% compare:
%
% \framed[width=4cm,align=no] {\hfil xxx}
% \framed[width=4cm,align=disable]{\hfil xxx}
-\setvalue{\@@ragged@@command\v!disable}% for one liners
- {\appendtoks\raggedright\parfillskip\zeropoint\to\everyraggedcommand}
-
-\ifdefined\raggedonelinerstate \else \newconditional\raggedonelinerstate \fi
-
-\setvalue{\@@ragged@@command\v!line}%
- {\settrue\raggedonelinerstate}
-
% More alignments:
% \hyphenpenalty = ( 2.5 * \hsize ) / \raggedness
@@ -366,7 +398,7 @@
%D More hyphenation control, will be combined with align
%D setup.
-\def\nohyphens % % % % % not clever, we still hyphenate but supress application
+\unexpanded\def\nohyphens % % % % % not clever, we still hyphenate but supress application
{\ifx\dohyphens\relax
\edef\dohyphens
{\hyphenpenalty\the\hyphenpenalty
@@ -383,7 +415,7 @@
\newskip\@@raggedskipa
\newskip\@@raggedskipb
-\def\setraggedness#1%
+\unexpanded\def\setraggedness#1%
{\ifnum\tolerance<1500\relax % small values have
\tolerance1500\relax % unwanted side effects
\fi
@@ -431,7 +463,7 @@
\expandafter\doshowpardata
\fi}
-\def\showpardata
+\unexpanded\def\showpardata
{\edef\thepardata
{\hbox{font: \fontname\font}\endgraf
\doshowpardata
@@ -567,12 +599,12 @@
\setvalue{@@ngila@@\v!broad }{\!!doneatrue}
\setvalue{@@ngila@@\v!wide }{\!!donebtrue}
-\def\setraggedparagraphmode
+\unexpanded\def\setraggedparagraphmode
{\doifrightpageelse
{\ifdoublesided\signalinnerrealign\expandafter\firstoftwoarguments \fi}
{\ifdoublesided\signalouterrealign\expandafter\secondoftwoarguments\fi}}
-\def\installalign#1#2{\setvalue{@@align@@#1}{#2}} % can be used for overloads
+\unexpanded\def\installalign#1#2{\setvalue{@@align@@#1}{#2}} % can be used for overloads
\installalign \v!new {\@@asraggedfalse}
\installalign \v!old {\@@asraggedtrue}
@@ -674,7 +706,7 @@
\newtoks \everyleftofalignedline
\newtoks \everyrightofalignedline
-\def\shiftalignedline#1#2#3#4% left, right, inner, outer
+\unexpanded\def\shiftalignedline#1#2#3#4% left, right, inner, outer
{\rightorleftpageaction
{\everyleftofalignedline {\hskip\dimexpr#1+#3\relax}%
\everyrightofalignedline{\hskip\dimexpr#2+#4\relax}}
@@ -705,10 +737,10 @@
% directe commando's
-\def\leftaligned {\doalignline \relax \hss }
-\def\midaligned {\doalignline \hss \hss }
-\def\rightaligned{\doalignline \hss \relax}
-\def\maxaligned {\doalignline \relax \relax}
+\unexpanded\def\leftaligned {\doalignline \relax \hss }
+\unexpanded\def\midaligned {\doalignline \hss \hss }
+\unexpanded\def\rightaligned{\doalignline \hss \relax}
+\unexpanded\def\maxaligned {\doalignline \relax \relax}
\let\centeraligned\midaligned
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index 50327d51d..dc1f41f54 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 ba65c55fe..22c578196 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/tabl-xtb.lua b/tex/context/base/tabl-xtb.lua
index fffda698f..82cf38ad3 100644
--- a/tex/context/base/tabl-xtb.lua
+++ b/tex/context/base/tabl-xtb.lua
@@ -33,6 +33,7 @@ local texsetdimen = tex.setdimen
local format = string.format
local concat = table.concat
+local points = number.points
local context = context
local context_beginvbox = context.beginvbox
@@ -59,6 +60,7 @@ local v_stretch = variables.stretch
local v_normal = variables.normal
local v_width = variables.width
local v_repeat = variables["repeat"]
+local v_max = variables.max
xtables = { } -- maybe in typesetters
@@ -71,6 +73,14 @@ local foot_mode = 2
local more_mode = 3
local body_mode = 4
+local namedmodes = { [0] =
+ "null",
+ "head",
+ "foot",
+ "next",
+ "body",
+}
+
local stack, data = { }, nil
function xtables.create(settings)
@@ -133,6 +143,8 @@ function xtables.create(settings)
setmetatableindex(depths,add_zero)
setmetatableindex(distances,add_zero)
setmetatableindex(modes,add_zero)
+ setmetatableindex(fixedrows,add_zero)
+ setmetatableindex(fixedcolumns,add_zero)
--
settings.columndistance = tonumber(settings.columndistance) or 0
settings.rowdistance = tonumber(settings.rowdistance) or 0
@@ -140,10 +152,14 @@ function xtables.create(settings)
settings.rightmargindistance = tonumber(settings.rightmargindistance) or 0
settings.options = utilities.parsers.settings_to_hash(settings.option)
settings.textwidth = tonumber(settings.textwidth) or tex.hsize
+ settings.lineheight = tonumber(settings.lineheight) or texdimen.lineheight
settings.maxwidth = tonumber(settings.maxwidth) or settings.textwidth/8
-- if #stack > 0 then
-- settings.textwidth = tex.hsize
-- end
+ data.criterium_v = 2 * data.settings.lineheight
+ data.criterium_h = .75 * data.settings.textwidth
+
end
function xtables.initialize_reflow_width()
@@ -160,6 +176,9 @@ function xtables.initialize_reflow_width()
data.currentcolumn = c
end
+-- local function rather_fixed(n)
+-- for n in node.
+
function xtables.set_reflow_width()
local r = data.currentrow
local c = data.currentcolumn
@@ -187,13 +206,23 @@ function xtables.set_reflow_width()
end
--
local dimensionstate = texcount.frameddimensionstate
+ local fixedcolumns = data.fixedcolumns
+ local fixedrows = data.fixedrows
if dimensionstate == 1 then
- data.fixedcolumns[c] = width
+if width > fixedcolumns[c] then -- how about a span here?
+ fixedcolumns[c] = width
+end
elseif dimensionstate == 2 then
- data.fixedrows[r] = height
+ fixedrows[r] = height
elseif dimensionstate == 3 then
- data.fixedrows[r] = width
- data.fixedcolumns[c] = height
+ fixedrows[r] = width
+ fixedcolumns[c] = height
+ else -- probably something frozen, like an image -- we could parse the list
+ if width <= data.criterium_h and height >= data.criterium_v then
+ if width > fixedcolumns[c] then -- how about a span here?
+ fixedcolumns[c] = width
+ end
+ end
end
drc.dimensionstate = dimensionstate
--
@@ -264,7 +293,7 @@ function xtables.set_reflow_height()
-- end
local tb = texbox.x_table_box
local drc = row[c]
- if not data.fixedrows[r] then -- and drc.dimensionstate < 2
+ if data.fixedrows[r] == 0 then -- and drc.dimensionstate < 2
local heights, height = data.heights, tb.height
if height > heights[r] then
heights[r] = height
@@ -321,6 +350,14 @@ function xtables.set_construct()
-- data.currentcolumn = c
end
+local function showwidths(where,widths,autowidths)
+ local result = { }
+ for i=1,#widths do
+ result[#result+1] = format("%12s%s",points(widths[i]),autowidths[i] and "*" or " ")
+ end
+ return report_xtable("%s : %s",where,concat(result," "))
+end
+
function xtables.reflow_width()
local nofrows = data.nofrows
local nofcolumns = data.nofcolumns
@@ -348,7 +385,11 @@ function xtables.reflow_width()
local distance = 0
local nofwide = 0
local widetotal = 0
- if options[variables.max] then
+ local available = settings.textwidth - settings.leftmargindistance - settings.rightmargindistance
+ if trace_xtable then
+ showwidths("stage 1",widths,autowidths)
+ end
+ if options[v_max] then
for c=1,nofcolumns do
width = width + widths[c]
if width > maxwidth then
@@ -363,7 +404,7 @@ function xtables.reflow_width()
else
for c=1,nofcolumns do -- also keep track of forced
local fixedwidth = fixedcolumns[c]
- if fixedwidth then
+ if fixedwidth > 0 then
widths[c] = fixedwidth
width = width + fixedwidth
else
@@ -379,54 +420,91 @@ function xtables.reflow_width()
end
end
end
- local delta = settings.textwidth - width - distance - (nofcolumns-1) * settings.columndistance
- - settings.leftmargindistance - settings.rightmargindistance
- --
+ if trace_xtable then
+ showwidths("stage 2",widths,autowidths)
+ end
+ local delta = available - width - distance - (nofcolumns-1) * settings.columndistance
if delta == 0 then
-- nothing to be done
+ if trace_xtable then
+ report_xtable("perfect fit")
+ end
elseif delta > 0 then
-- we can distribute some
if not options[v_stretch] then
-- not needed
+ if trace_xtable then
+ report_xtable("too wide but no stretch, delta: %s",points(delta))
+ end
elseif options[v_width] then
+ local factor = delta / width
+ if trace_xtable then
+ report_xtable("proportional stretch, delta: %s, width: %s, factor: %s",
+ points(delta),points(width),factor)
+ end
for c=1,nofcolumns do
- widths[c] = widths[c] + delta * widths[c] / width
+ widths[c] = widths[c] + factor * widths[c]
end
else
- local plus = delta / nofcolumns
+ local extra = delta / nofcolumns
+ if trace_xtable then
+ report_xtable("normal stretch, delta: %s, extra: %s",
+ points(delta),points(extra))
+ end
for c=1,nofcolumns do
- widths[c] = widths[c] + plus
+ widths[c] = widths[c] + extra
end
end
elseif nofwide > 0 then
- if options[v_width] then
- -- proportionally
- for c=1,nofcolumns do
- local minus = - delta / nofwide
- if autowidths[c] then
- widths[c] = widths[c] - minus
- end
- end
- else
- -- we can also consider a loop adding small amounts till
- -- we have a fit etc which is sometimes nicer
+ while true do
+ done = false
local available = (widetotal + delta) / nofwide
+ if trace_xtable then
+ report_xtable("shrink check, total: %s, delta: %s, columns: %s, fixed: %s",
+ points(widetotal),points(delta),nofwide,points(available))
+ end
for c=1,nofcolumns do
if autowidths[c] and available >= widths[c] then
autowidths[c] = nil
nofwide = nofwide - 1
widetotal = widetotal - widths[c]
+ done = true
+ end
+ end
+ if not done then
+ break
+ end
+ end
+ -- maybe also options[v_width] here but tricky as width does not say
+ -- much about amount
+
+ if options[v_width] then -- not that much (we could have a clever vpack loop balancing .. no fun)
+ local factor = (widetotal + delta) / width
+ if trace_xtable then
+ report_xtable("proportional shrink used, total: %s, delta: %s, columns: %s, factor: %s",
+ points(widetotal),points(delta),nofwide,factor)
+ end
+ for c=1,nofcolumns do
+ if autowidths[c] then
+ widths[c] = factor * widths[c]
end
end
+ else
local available = (widetotal + delta) / nofwide
+ if trace_xtable then
+ report_xtable("normal shrink used, total: %s, delta: %s, columns: %s, fixed: %s",
+ points(widetotal),points(delta),nofwide,points(available))
+ end
for c=1,nofcolumns do
if autowidths[c] then
widths[c] = available
end
end
- -- maybe stretch
end
end
+ if trace_xtable then
+ showwidths("stage 3",widths,autowidths)
+ end
--
data.currentrow = 0
data.currentcolumn = 0
@@ -439,12 +517,14 @@ end
local function showspans(data)
local rows = data.rows
+ local modes = data.modes
local nofcolumns = data.nofcolumns
local nofrows = data.nofrows
for r=1,nofrows do
local line = { }
+ local row = rows[r]
for c=1,nofcolumns do
- local cell =rows[r][c]
+ local cell =row[c]
if cell.list then
line[#line+1] = "list"
elseif cell.span then
@@ -453,7 +533,7 @@ local function showspans(data)
line[#line+1] = "none"
end
end
- report_xtable("%3d : %s",r,concat(line," "))
+ report_xtable("%3d : %s : %s",r,namedmodes[modes[r]] or "----",concat(line," "))
end
end
@@ -599,7 +679,7 @@ local function inject(row,copy,package)
if row[4] then
-- nothing as we have a span
elseif row[3] then
- context_blank(row[3] .. "sp")
+ context_blank(row[3] .. "sp") -- why blank ?
else
context(new_glue(0))
end
@@ -632,6 +712,25 @@ end
-- end
-- end
+local function spanheight(body,i)
+ local height, n = 0, 1
+ while true do
+ local bi = body[i]
+ if bi then
+ height = height + bi[2] + (bi[3] or 0)
+ if bi[4] then
+ n = n + 1
+ i = i + 1
+ else
+ break
+ end
+ else
+ break
+ end
+ end
+ return height, n
+end
+
function xtables.flush(directives) -- todo split by size / no inbetween then .. glue list kern blank
local vsize = directives.vsize
local method = directives.method or v_normal
@@ -653,7 +752,7 @@ function xtables.flush(directives) -- todo split by size / no inbetween then ..
local footsize = total(foot,rowdistance)
local headsize = total(head,rowdistance)
local moresize = total(more,rowdistance)
- local firstsize = body[bodystart][2]
+ local firstsize, firstspans = spanheight(body,bodystart)
if bodystart == 1 then -- first chunk gets head
bodysize = bodysize - headsize - footsize
if headsize > 0 and bodysize >= firstsize then
@@ -691,14 +790,18 @@ function xtables.flush(directives) -- todo split by size / no inbetween then ..
bodysize = bodysize - footsize
end
if bodysize >= firstsize then
- for i=bodystart,bodystop do -- room for improvement
- local bi = body[i]
- local bs = bodysize - bi[2] - (bi[3] or 0)
+ local i = bodystart
+ while i <= bodystop do -- room for improvement
+ local total, spans = spanheight(body,i)
+ local bs = bodysize - total
if bs > 0 then
- inject(bi)
bodysize = bs
- bodystart = i + 1
- body[i] = nil
+ for s=1,spans do
+ inject(body[i])
+ body[i] = nil
+ i = i + 1
+ end
+ bodystart = i
else
break
end
@@ -734,9 +837,11 @@ function xtables.flush(directives) -- todo split by size / no inbetween then ..
else
if firstsize > vsize then
-- get rid of the too large cell
- inject(body[bodystart])
- body[bodystart] = nil
- bodystart = bodystart + 1
+ for s=1,firstspans do
+ inject(body[bodystart])
+ body[bodystart] = nil
+ bodystart = bodystart + 1
+ end
end
texsetcount("global","x_table_state",2) -- 1
end
diff --git a/tex/context/base/tabl-xtb.mkvi b/tex/context/base/tabl-xtb.mkvi
index 870ece75b..e9cd87368 100644
--- a/tex/context/base/tabl-xtb.mkvi
+++ b/tex/context/base/tabl-xtb.mkvi
@@ -116,6 +116,7 @@
% \c!framecolor=\s!black,
% \c!foregroundstyle=\xtableparameter\c!style, % not clean, better capture elsewhere
% \c!foregroundcolor=\xtableparameter\c!color, % not clean, better capture elsewhere
+ % \c!bodyfont=,
\c!width=\v!fit,
\c!height=\v!fit,
\c!maxwidth=8em,
@@ -205,11 +206,15 @@
{\ctxcommand{gettexbuffer("\x_table_current_buffer")}}
\unexpanded\def\x_table_process
- {\setbox\scratchbox\vbox{\xtableparameter\c!spaceinbetween}%
+ {\begingroup
+\doifsomething{\xtableparameter\c!bodyfont}
+ {\setupbodyfont[\xtableparameter\c!bodyfont]}%
+ \setbox\scratchbox\vbox{\xtableparameter\c!spaceinbetween}%
\ctxcommand{x_table_create {
option = "\xtableparameter\c!option",
textwidth = \number\dimexpr\xtableparameter\c!textwidth,
maxwidth = \number\dimexpr\xtableparameter\c!maxwidth,
+ lineheight = \number\openlineheight,
columndistance = \number\dimexpr\xtableparameter\c!columndistance,
leftmargindistance = \number\dimexpr\xtableparameter\c!leftmargindistance,
rightmargindistance = \number\dimexpr\xtableparameter\c!rightmargindistance,
@@ -217,6 +222,9 @@
header = "\xtableparameter\c!header",
footer = "\xtableparameter\c!footer",
} }%
+ % not so nice but needed as we use this in the setup
+ \linewidth\xtableparameter\c!rulethickness\relax
+ % so we freeze it
\begingroup
\let\start_x_row_yes \start_x_row_reflow_width_yes
\let\start_x_row_nop \start_x_row_reflow_width_nop
@@ -249,6 +257,7 @@
\x_table_get_buffer
\ctxcommand{x_table_construct()}\relax
\endgroup
+\endgroup
\ifinsidesplitfloat
\x_table_flush_float_split
\else\ifinsidefloat
@@ -359,6 +368,9 @@
% Although this becomes kind of messy. It saves already time that we only check
% for it when we have settings.
+\def\set_x_table_hsize
+ {\hsize.25\maxdimen} % let's be reasonable
+
\unexpanded\def\start_x_cell_reflow_width_yes[#settings]%
{\setbox\x_table_box\hbox\bgroup
\ifnum\x_table_nesting>\plusone
@@ -385,7 +397,8 @@
\x_table_distance\xtableparameter\c!distance\relax
\ctxcommand{x_table_init_reflow_width()}%
\inheritedxtableframed\bgroup
- \begin_of_cell}
+ \begin_of_cell
+ \set_x_table_hsize}
\unexpanded\def\start_x_cell_reflow_width_nop
{\setbox\x_table_box\hbox\bgroup
@@ -398,7 +411,8 @@
\x_table_distance\xtableparameter\c!distance\relax
\ctxcommand{x_table_init_reflow_width()}%
\inheritedxtableframed\bgroup
- \begin_of_cell}
+ \begin_of_cell
+ \set_x_table_hsize}
\unexpanded\def\stop_x_cell_reflow_width
{\end_of_cell
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 80066b3b9..a497302bf 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 : 11/21/11 18:27:10
+-- merge date : 11/23/11 16:20:27
do -- begin closure to overcome local limits and interference