diff options
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.mkiv | 134 |
1 files changed, 105 insertions, 29 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 4362ff25002..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}{optimize} +\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,6 +61,16 @@ \newtoks\everyresetalign % todo +%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}). + +\unexpanded\def\syst_fatal_dir_error#1% + {\writestatus{fatal error}{\string#1\space is forbidden}% + \wait} + +\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: \newconditional\layoutlefttoright \settrue\layoutlefttoright @@ -84,23 +94,63 @@ \unexpanded\def\spac_directions_lefttoright_vmode {\settrue\displaylefttoright \settrue\inlinelefttoright - \textdirection\directionlefttoright - \pardirection \directionlefttoright} + \textdir TLT\relax + \pardir TLT\relax} \unexpanded\def\spac_directions_righttoleft_vmode {\setfalse\displaylefttoright \setfalse\inlinelefttoright - \textdirection\directionrighttoleft - \pardirection \directionrighttoleft} + \textdir TRT\relax + \pardir TRT\relax} + +% % 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} \unexpanded\def\spac_directions_lefttoright_hmode - {\linedirection\directionlefttoright % linedir keeps subtype of skip + {\linedir TLT\relax % linedir keeps subtype of skip \settrue\inlinelefttoright} \unexpanded\def\spac_directions_righttoleft_hmode - {\linedirection\directionrighttoleft % linedir keeps subtype of skip + {\linedir TRT\relax % linedir keeps subtype of skip \setfalse\inlinelefttoright} +% \def\currentdirectionparameters +% {\ifconditional\inlinelefttoright \else +% idir {r2l}% +% \fi +% \ifconditional\displaylefttoright \else +% ddir {r2l}% +% \fi} + \unexpanded\def\synchronizelayoutdirection {\ifconditional\layoutlefttoright \spac_directions_synchronize_lr @@ -117,17 +167,16 @@ \def\spac_directions_synchronize_lr {\settrue\inlinelefttoright - \textdirection\directionlefttoright - \pardirection \directionlefttoright} + \textdir TLT\relax + \pardir TLT\relax} \def\spac_directions_synchronize_rl {\setfalse\inlinelefttoright - \textdirection\directionrighttoleft - \pardirection \directionrighttoleft} + \textdir TRT\relax + \pardir TRT\relax} \unexpanded\def\synchronizeinlinedirection - {% why not \linedirection here - \textdirection\ifconditional\inlinelefttoright\directionlefttoright\else\directionrighttoleft\fi} + {\textdir T\ifconditional\inlinelefttoright L\else R\fi T\relax} \unexpanded\def\checkedlefttoright {\ifvmode @@ -161,20 +210,49 @@ \unexpanded\def\usebidiparameter#1% {\begincsname\??bidi#1\c!bidi\endcsname} +% maybe some day: +% +% \newcount\postdirpenalty % \zerocount +% \newcount\predirpenalty % \zerocount +% +% \def\spac_directions_post_break +% {\ifhmode +% \removeunwantedspaces +% \penalty\postdirpenalty +% \fi} +% +% \def\spac_directions_pre_break +% {\ifhmode +% \penalty\predirpenalty +% \ignorespaces +% \fi} +% +% \unexpanded\def\spac_directions_lefttoright_hmode +% {\settrue\inlinelefttoright +% \textdir TLT\relax +% \aftergroup\spac_directions_post_break +% \spac_directions_pre_break} +% +% \unexpanded\def\spac_directions_righttoleft_hmode +% {\textdir TRT\relax +% \setfalse\inlinelefttoright +% \aftergroup\spac_directions_post_break +% \spac_directions_pre_break} + \unexpanded\def\showdirections {\dontleavehmode - \begingroup\infofont\textdirection\directionlefttoright[\space - layout: \ifconditional\layoutlefttoright l2r\else r2l\fi\space - display: \ifconditional\displaylefttoright l2r\else r2l\fi\space - inline: \ifconditional\inlinelefttoright l2r\else r2l\fi\space + \begingroup\infofont\textdir TLT[\space + layout:\ifconditional \layoutlefttoright l2r\else r2l\fi\space + display:\ifconditional\displaylefttoright l2r\else r2l\fi\space + inline:\ifconditional \inlinelefttoright l2r\else r2l\fi\space ]\endgroup} -\unexpanded\def\righttolefthbox#1#{\reversehbox#1\bgroup\righttoleft\let\next} \let\rtlhbox\righttolefthbox -\unexpanded\def\lefttorighthbox#1#{\naturalhbox#1\bgroup\lefttoright\let\next} \let\ltrhbox\lefttorighthbox -\unexpanded\def\righttoleftvbox#1#{\reversevbox#1\bgroup\righttoleft\let\next} \let\rtlvbox\righttoleftvbox -\unexpanded\def\lefttorightvbox#1#{\naturalvbox#1\bgroup\lefttoright\let\next} \let\ltrvbox\lefttorightvbox -\unexpanded\def\righttoleftvtop#1#{\reversevtop#1\bgroup\righttoleft\let\next} \let\rtlvtop\righttoleftvtop -\unexpanded\def\lefttorightvtop#1#{\naturalvtop#1\bgroup\lefttoright\let\next} \let\ltrvtop\lefttorightvtop +\unexpanded\def\righttolefthbox#1#{\normalhbox dir TRT #1\bgroup\righttoleft\let\next} \let\rtlhbox\righttolefthbox +\unexpanded\def\lefttorighthbox#1#{\normalhbox dir TLT #1\bgroup\lefttoright\let\next} \let\ltrhbox\lefttorighthbox +\unexpanded\def\righttoleftvbox#1#{\normalvbox dir TRT #1\bgroup\righttoleft\let\next} \let\rtlvbox\righttoleftvbox +\unexpanded\def\lefttorightvbox#1#{\normalvbox dir TLT #1\bgroup\lefttoright\let\next} \let\ltrvbox\lefttorightvbox +\unexpanded\def\righttoleftvtop#1#{\normalvtop dir TRT #1\bgroup\righttoleft\let\next} \let\rtlvtop\righttoleftvtop +\unexpanded\def\lefttorightvtop#1#{\normalvtop dir TLT #1\bgroup\lefttoright\let\next} \let\ltrvtop\lefttorightvtop \unexpanded\def\autodirhbox#1#{\hbox#1\bgroup\synchronizeinlinedirection\let\next} \unexpanded\def\autodirvbox#1#{\vbox#1\bgroup\synchronizeinlinedirection\let\next} % maybe also pardir or maybe just a \vbox @@ -277,8 +355,7 @@ \newconstant\c_spac_align_state_par_fill \def\v_spac_align_fill_amount {\plusone fil} -\def\v_spac_align_fill_amount_hard {\plusone fill} -\def\v_spac_align_fill_amount_extreme {\plustenthousand filll} +\def\v_spac_align_fill_amount_hard {\plusone fill} \def\v_spac_align_fill_amount_negative {\minusone fil} \def\v_spac_align_fill_amount_double {\plustwo fil} \def\v_spac_align_fill_amount_space {\plustwo fil} % can be added to xspace if we have a key @@ -402,8 +479,7 @@ \spaceskip \zeropoint\relax \xspaceskip \zeropoint\relax \parfillskip \zeropoint - \parfillleftskip\zeropoint\s!plus\v_spac_align_fill_amount_extreme\relax - \parfillleftmode\plustwo % \plusone checks for multiple lines + \parfillleftskip\zeropoint\s!plus\v_spac_align_fill_amount_hard\relax \parindent \zeropoint \relax} @@ -567,8 +643,8 @@ }}% kept, nice for tracing \edef\raggedcommand {\the\t_spac_align_collected }% \edef\updateraggedskips{\spac_align_flush_horizontal}% - \expandafter\glet\csname\??alignmentnormalcache\m_spac_align_asked\endcsname\raggedcommand - \expandafter\glet\csname\??alignmentraggedcache\m_spac_align_asked\endcsname\updateraggedskips} + \global\expandafter\let\csname\??alignmentnormalcache\m_spac_align_asked\endcsname\raggedcommand + \global\expandafter\let\csname\??alignmentraggedcache\m_spac_align_asked\endcsname\updateraggedskips} \def\spac_align_collect#1% {\csname\??aligncommand#1\endcsname} |