summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/mkiv/spac-ali.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/spac-ali.mkiv')
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/spac-ali.mkiv155
1 files changed, 91 insertions, 64 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/spac-ali.mkiv b/Master/texmf-dist/tex/context/base/mkiv/spac-ali.mkiv
index af02f76ae8e..fbcf45caa2e 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/spac-ali.mkiv
+++ b/Master/texmf-dist/tex/context/base/mkiv/spac-ali.mkiv
@@ -27,7 +27,7 @@
%
% but that also means myoption gets frozen due to caching.
-\registerctxluafile{spac-ali}{1.001}
+\registerctxluafile{spac-ali}{}
\definesystemattribute[realign] [public] % might be combined with the next one
\definesystemattribute[alignstate][public] % will make a single attributes for several states
@@ -61,17 +61,15 @@
\newtoks\everyresetalign % todo
-% We will not use bodydir and pagedir so we disable them. That way we get
-% normal hyperlink support.
+%D We will not use bodydir and pagedir so we disable them. That way we get
+%D normal hyperlink support. We back on it (too hard to fake \type {\the}).
-\let\spac_directions_normal_body_dir\normalbodydir
-\let\spac_directions_normal_page_dir\normalpagedir
+\unexpanded\def\syst_fatal_dir_error#1%
+ {\writestatus{fatal error}{\string#1\space is forbidden}%
+ \wait}
-\unexpanded\def\bodydir{\afterassignment\spac_directions_bodydir_indeed\spac_directions_normal_body_dir} \let\normalbodydir\bodydir
-\unexpanded\def\pagedir{\afterassignment\spac_directions_pagedir_indeed\spac_directions_normal_page_dir} \let\normalpagedir\pagedir
-
-\def\spac_directions_bodydir_indeed{\spac_directions_normal_body_dir TLT\relax}
-\def\spac_directions_pagedir_indeed{\spac_directions_normal_page_dir TLT\relax}
+\def\pagedir {\syst_fatal_dir_error\pagedir} \let\normalpagedir\pagedir
+\def\bodydir {\syst_fatal_dir_error\bodydir} \let\normalbodydir\bodydir
% This will become a more advanced layout controller soon:
@@ -105,59 +103,45 @@
\textdir TRT\relax
\pardir TRT\relax}
-\newconditional\c_spac_auto_line_dir \settrue\c_spac_auto_line_dir
-
-\ifdefined\linedir
-
- \unexpanded\def\spac_directions_lefttoright_hmode
- {\ifconditional\c_spac_auto_line_dir\linedir\else\textdir\fi TLT\relax % linedir keeps subtype
- \setfalse\inlinerighttoleft}
-
- \unexpanded\def\spac_directions_righttoleft_hmode
- {\ifconditional\c_spac_auto_line_dir\linedir\else\textdir\fi TRT\relax % linedir keeps subtype
- \setfalse\inlinelefttoright}
-
-\else % keep this as reference
-
- \unexpanded\def\spac_directions_lefttoright_hmode
- {\settrue\inlinelefttoright
- \textdir TLT\relax}
-
- \unexpanded\def\spac_directions_righttoleft_hmode
- {\textdir TRT\relax
- \setfalse\inlinelefttoright}
-
- \unexpanded\def\spac_directions_lefttoright_hmode
- {\ifconditional\c_spac_auto_line_dir
- \ifzeropt\lastskip
- \textdir TLT\relax
- \else
- \scratchskip\lastskip
- \unskip
- \textdir TLT\relax
- \hskip\scratchskip
- \fi
- \else
- \textdir TLT\relax
- \fi
- \setfalse\inlinerighttoleft}
-
- \unexpanded\def\spac_directions_righttoleft_hmode
- {\ifconditional\c_spac_auto_line_dir
- \ifzeropt\lastskip
- \textdir TRT\relax
- \else
- \scratchskip\lastskip
- \unskip
- \textdir TRT\relax
- \hskip\scratchskip
- \fi
- \else
- \textdir TRT\relax
- \fi
- \setfalse\inlinelefttoright}
+% % keep this as reference
+%
+% \unexpanded\def\spac_directions_lefttoright_hmode
+% {\textdir TLT\relax
+% \settrue\inlinelefttoright}
+%
+% \unexpanded\def\spac_directions_righttoleft_hmode
+% {\textdir TRT\relax
+% \setfalse\inlinelefttoright}
+%
+% \unexpanded\def\spac_directions_lefttoright_hmode
+% {\ifzeropt\lastskip
+% \textdir TLT\relax
+% \else
+% \scratchskip\lastskip
+% \unskip
+% \textdir TLT\relax
+% \hskip\scratchskip
+% \fi
+% \settrue\inlinelefttoright}
+%
+% \unexpanded\def\spac_directions_righttoleft_hmode
+% {\ifzeropt\lastskip
+% \textdir TRT\relax
+% \else
+% \scratchskip\lastskip
+% \unskip
+% \textdir TRT\relax
+% \hskip\scratchskip
+% \fi
+% \setfalse\inlinelefttoright}
-\fi
+\unexpanded\def\spac_directions_lefttoright_hmode
+ {\linedir TLT\relax % linedir keeps subtype of skip
+ \settrue\inlinelefttoright}
+
+\unexpanded\def\spac_directions_righttoleft_hmode
+ {\linedir TRT\relax % linedir keeps subtype of skip
+ \setfalse\inlinelefttoright}
% \def\currentdirectionparameters
% {\ifconditional\inlinelefttoright \else
@@ -194,6 +178,38 @@
\unexpanded\def\synchronizeinlinedirection
{\textdir T\ifconditional\inlinelefttoright L\else R\fi T\relax}
+\unexpanded\def\checkedlefttoright
+ {\ifvmode
+ \spac_directions_lefttoright_vmode
+ \else
+ \spac_directions_lefttoright_hmode_checked
+ \fi}
+
+\unexpanded\def\checkedrighttoleft
+ {\ifvmode
+ \spac_directions_righttoleft_vmode
+ \else
+ \spac_directions_righttoleft_hmode_checked
+ \fi}
+
+\unexpanded\def\spac_directions_lefttoright_hmode_checked
+ {\ifconditional\inlinelefttoright\else
+ \lefttoright
+ \fi}
+
+\unexpanded\def\spac_directions_righttoleft_hmode_checked
+ {\ifconditional\inlinelefttoright
+ \righttoleft
+ \fi}
+
+\installcorenamespace{bidi}
+
+\letvalue{\??bidi\v!left }\checkedlefttoright \letvalue{\??bidi l2r}\checkedlefttoright
+\letvalue{\??bidi\v!right}\checkedrighttoleft \letvalue{\??bidi r2l}\checkedrighttoleft
+
+\unexpanded\def\usebidiparameter#1%
+ {\begincsname\??bidi#1\c!bidi\endcsname}
+
% maybe some day:
%
% \newcount\postdirpenalty % \zerocount
@@ -791,10 +807,20 @@
\setvalue{\??aligncommand\v!extremestretch }{\toksapp\t_spac_align_collected{\spac_align_set_extreme_stretch}}
\setvalue{\??aligncommand \v!final}{\c_spac_align_state_par_fill\plusone}
+\setvalue{\??aligncommand1*\v!final}{\c_spac_align_state_par_fill\plusone}
\setvalue{\??aligncommand2*\v!final}{\c_spac_align_state_par_fill\plustwo} % hardcoded multiplier
\setvalue{\??aligncommand3*\v!final}{\c_spac_align_state_par_fill\plusthree}
\setvalue{\??aligncommand4*\v!final}{\c_spac_align_state_par_fill\plusfour}
+% a one shot (only usefull in e.g. framed, also needs tolerance and stretch)
+
+\setvalue{\??aligncommand \v!more}{\toksapp\t_spac_align_collected{\looseness\plusone}}
+\setvalue{\??aligncommand1*\v!more}{\toksapp\t_spac_align_collected{\looseness\plusone}}
+\setvalue{\??aligncommand2*\v!more}{\toksapp\t_spac_align_collected{\looseness\plustwo}}
+
+% \setvalue{\??aligncommand ... }{\toksapp\t_spac_align_collected{\nopenalties}}
+% \setvalue{\??aligncommand ... }{\toksapp\t_spac_align_collected{\setdefaultpenalties}}
+
\definehspace [\v!final] [\emspaceamount]
\def\spac_align_flush_parfill
@@ -963,13 +989,14 @@
\dontleavehmode
\begingroup
\inleftmargin{\vsmash{\infofont\framed[\c!align=\v!right]{\thepardata}}}%
- \endgroup}
+ \endgroup
+ \let\showpardata\relax}
\unexpanded\def\startshowpardata
{\begingroup
\showstruts
\tracingparagraphs\maxdimen
- \appendtoksonce\showpardata\let\showpardata\relax\to\everypar}
+ \appendtoksonce\showpardata\to\everypar}
\unexpanded\def\stopshowpardata
{\endgraf