summaryrefslogtreecommitdiff
path: root/tex/context/base/spac-ver.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/spac-ver.mkiv')
-rw-r--r--tex/context/base/spac-ver.mkiv299
1 files changed, 78 insertions, 221 deletions
diff --git a/tex/context/base/spac-ver.mkiv b/tex/context/base/spac-ver.mkiv
index 7fdf2f70f..72ee80d4f 100644
--- a/tex/context/base/spac-ver.mkiv
+++ b/tex/context/base/spac-ver.mkiv
@@ -68,8 +68,8 @@
\def\normalskipamount
{\openlineheight
\ifgridsnapping \else \ifblankflexible
- \s!plus \skipgluefactor\openlineheight
- \s!minus\skipgluefactor\openlineheight
+ \!!plus \skipgluefactor\openlineheight
+ \!!minus\skipgluefactor\openlineheight
\fi \fi
\relax}
@@ -91,16 +91,15 @@
\spac_linespacing_setup_specified_interline_space}
\def\spac_linespacing_setup_specified_interline_space
- {\edef\strutheightfactor {\interlinespaceparameter\c!height }%
- \edef\strutdepthfactor {\interlinespaceparameter\c!depth }%
- \edef\minimumstrutheight {\interlinespaceparameter\c!minheight}%
- \edef\minimumstrutdepth {\interlinespaceparameter\c!mindepth }%
- \edef\minimumlinedistance {\interlinespaceparameter\c!distance }%
- \edef\normallineheight {\interlinespaceparameter\c!line }%
- \edef\topskipfactor {\interlinespaceparameter\c!top }%
- \edef\maxdepthfactor {\interlinespaceparameter\c!bottom }%
- \edef\m_spac_vertical_baseline_stretch_factor{\interlinespaceparameter\c!stretch }%
- \edef\m_spac_vertical_baseline_shrink_factor {\interlinespaceparameter\c!shrink }%
+ {\edef\strutheightfactor {\interlinespaceparameter\c!height }%
+ \edef\strutdepthfactor {\interlinespaceparameter\c!depth }%
+ \edef\minimumstrutheight {\interlinespaceparameter\c!minheight}%
+ \edef\minimumstrutdepth {\interlinespaceparameter\c!mindepth }%
+ \edef\minimumlinedistance{\interlinespaceparameter\c!distance }%
+ \edef\normallineheight {\interlinespaceparameter\c!line }%
+ \edef\topskipfactor {\interlinespaceparameter\c!top }%
+ \edef\maxdepthfactor {\interlinespaceparameter\c!bottom }%
+ \edef\baselinegluefactor {\interlinespaceparameter\c!stretch }%
% often topskip does more bad than good, so:
\ifx\topskipfactor\v!height
\let\topskipfactor\strutheightfactor
@@ -182,12 +181,12 @@
\localinterlinespacefalse}
\unexpanded\def\dosetupcheckedinterlinespace#1% often a chain
- {\edef\p_spac_checked_interlinespace{#1}%
- \ifx\p_spac_checked_interlinespace\empty
+ {\edef\askedinterlinespace{#1}%
+ \ifx\askedinterlinespace\empty
\spac_linespacing_synchronize_local
- \else\ifcsname\namedinterlinespacehash\p_spac_checked_interlinespace\s!parent\endcsname % we could have a \s!check
+ \else\ifcsname\namedinterlinespacehash\askedinterlinespace\s!parent\endcsname % we could have a \s!check
\pushmacro\currentinterlinespace
- \let\currentinterlinespace\p_spac_checked_interlinespace
+ \let\currentinterlinespace\askedinterlinespace
\spac_linespacing_setup_specified_interline_space % \dosetupspecifiedinterlinespaceindeed
\iflocalinterlinespace
\the\everysetuplocalinterlinespace
@@ -198,8 +197,8 @@
\fi
\popmacro\currentinterlinespace
\else
- \normalexpanded{\noexpand\doifassignmentelse{\p_spac_checked_interlinespace}%
- \setupspecifiedinterlinespace\setuprelativeinterlinespace[\p_spac_checked_interlinespace]}%
+ \normalexpanded{\noexpand\doifassignmentelse{\askedinterlinespace}%
+ \setupspecifiedinterlinespace\setuprelativeinterlinespace[\askedinterlinespace]}%
\iflocalinterlinespace
\the\everysetuplocalinterlinespace
\else
@@ -218,6 +217,8 @@
\let\switchtointerlinespace\setuplocalinterlinespace
+% \definecomplexorsimple\setupinterlinespace
+
%D Helpers
\newskip \s_spac_lastskip
@@ -300,7 +301,7 @@
\def\spac_helpers_vglue_indeed
{\par
\d_spac_prevdepth\prevdepth
- \hrule\s!height\zeropoint
+ \hrule\!!height\zeropoint
\nobreak
\vskip\s_spac_lastskip
\prevdepth\d_spac_prevdepth}
@@ -308,7 +309,7 @@
\def\spac_helpers_hglue_indeed
{\dontleavehmode % \leavevmode
\c_spac_spacefactor\spacefactor
- \vrule\s!width\zeropoint
+ \vrule\!!width\zeropoint
\nobreak
\hskip\s_spac_lastskip
\spacefactor\c_spac_spacefactor}
@@ -413,10 +414,6 @@
\parskip\zeropoint
\let\v_spac_whitespace_current\v!none}
-\appendtoks
- \forgetparskip
-\to \everyforgetall
-
% \installwhitespacemethod \s!unknown {\s_spac_whitespace_parskip\commalistelement\relax}
%
% \def\spac_whitespace_setup_method#1%
@@ -425,9 +422,6 @@
\unexpanded\def\nowhitespace{\vspacing[\v!nowhite]}
\unexpanded\def\whitespace {\vspacing[\v!white]}
-\setupwhitespace
- [\v!none]
-
% Packed:
% todo: when packed blocks blank, we need to enable forced
@@ -533,6 +527,8 @@
{\removeunwantedspaces
\egroup}
+\newdimen\d_spac_prevdepth
+
\def\spac_lines_start_correction_yes[#1]%
{\edef\m_spac_lines_around{#1}%
\spac_lines_action_around
@@ -632,8 +628,6 @@
% niet bepaald mooi. Een hele kleine waarde (0.025) voldoet,
% omdat een positieve glue eindeloos rekbaar is.
-% more of the next will become private:
-
\newdimen\strutdimen
\newdimen\lineheight
\newdimen\openlineheight
@@ -646,14 +640,12 @@
\def\strutdepthfactor {.28}
\def\baselinefactor {2.8}
-
-\let\m_spac_vertical_baseline_stretch_factor \zerocount
-\let\m_spac_vertical_baseline_shrink_factor \zerocount
+\def\baselinegluefactor {0}
\def\minimumstrutheight {\zeropoint}
\def\minimumstrutdepth {\zeropoint}
-\def\normallineheight {\baselinefactor\exheight}
+\def\normallineheight {\baselinefactor ex}
\def\minimumlinedistance {\lineskip}
\def\strutheight {\zeropoint}
@@ -696,7 +688,7 @@
\else
\systemtopskipfactor\globalbodyfontsize
\ifcase\bottomraggednessmode % ragged bottom
- \s!plus5\globalbodyfontsize
+ \!!plus5\globalbodyfontsize
\fi
\fi
%\relax
@@ -740,8 +732,8 @@
\fi
\normalbaselineskip\openlineheight
\ifgridsnapping\else
- \s!plus \m_spac_vertical_baseline_stretch_factor\openlineheight
- \s!minus\m_spac_vertical_baseline_shrink_factor \openlineheight
+ \!!plus \baselinegluefactor\openlineheight
+ \!!minus\baselinegluefactor\openlineheight
\fi
\normallineskip\minimumlinedistance\relax % \onepoint\relax
\normallineskiplimit\zeropoint\relax
@@ -758,13 +750,6 @@
\setnormalbaselines
\setstrut}
-\unexpanded\def\forgetverticalstretch % \forgetspacing
- {\spacing\plusone}
-
-\appendtoks
- \forgetverticalstretch
-\to \everyforgetall % needed in otr
-
%D Sometimes one needs to freeze the interlinespacing
%D
%D \starttyping
@@ -795,7 +780,7 @@
\newbox\strutbox
-\setbox\strutbox\hbox{\vrule\s!height8.5pt\s!depth3.5pt\s!width\zeropoint} % just a start
+\setbox\strutbox\hbox{\vrule\!!height8.5pt\!!depth3.5pt\!!width\zeropoint} % just a start
\def\strut{\relax\ifmmode\copy\else\unhcopy\fi\strutbox}
@@ -861,13 +846,13 @@
\unexpanded\def\charhtstrut
{\begingroup
\setcharstrut{GJY}%
- \vrule\s!width\zeropoint\s!depth\zeropoint\s!height\strutht
+ \vrule\!!width\zeropoint\!!depth\zeropoint\!!height\strutht
\endgroup}
\unexpanded\def\chardpstrut
{\begingroup
\setcharstrut{gjy}%
- \vrule\s!width\zeropoint\s!depth\strutdp\s!height\zeropoint
+ \vrule\!!width\zeropoint\!!depth\strutdp\!!height\zeropoint
\endgroup}
% because of all the callbacks in mkiv, we avoid unnecessary boxes ...
@@ -896,22 +881,20 @@
\def\spac_struts_set_hide
{\setbox\strutbox\hbox
{\vrule
- \s!width \zeropoint
- \s!height\strutht
- \s!depth \strutdp}}
+ \!!width \zeropoint
+ \!!height\strutht
+ \!!depth \strutdp}}
\def\spac_struts_set_vide
{\setbox\strutbox\hbox
- {\spac_struts_vide_hbox to \zeropoint
+ {\hbox to \zeropoint
{% \hss % new, will be option
\vrule
- \s!width \strutwidth
- \s!height\strutht
- \s!depth \strutdp
+ \!!width \strutwidth
+ \!!height\strutht
+ \!!depth \strutdp
\hss}}}
-\let\spac_struts_vide_hbox\hbox % overloaded in trac-vis.mkiv
-
%D The dimen \type {\struttotal} holds the exact size of the
%D strut; occasionally a one scaled point difference can show
%D up with the lineheight.
@@ -1262,6 +1245,7 @@
\definesystemattribute[skipcategory] [public]
\definesystemattribute[skippenalty] [public]
\definesystemattribute[skiporder] [public]
+\definesystemattribute[displaymath] [public]
\definesystemattribute[snapmethod] [public]
\definesystemattribute[snapvbox] [public]
%definesystemattribute[snapcategory] [public]
@@ -1500,7 +1484,7 @@
\ruledvbox
\fi}
-\def\gridboxwidth{\ifcase\gridboxlinemode0\or.5\or.5\or0\else.5\fi\linewidth}
+\def\gridboxwidth{\ifcase\gridboxlinemode0\or.5\or.5\or0\else.5\fi\testrulewidth}
\unexpanded\def\setgridbox#1#2#3% maybe ifgridsnapping at outer level
{\setbox#1\gridboxvbox to #3 % given size
@@ -1508,10 +1492,10 @@
\resetteststrut
\offinterlineskip
\hsize#2%
+ \baselinerulefalse
\ifnum\gridboxlinenomode=\plusthree
\gridboxlinenomode\ifodd\realpageno\plusone\else\plustwo\fi
\fi
- \topskipcorrection
\gridboxvbox % calculated size
{\getrawnoflines{#3}% \getnoflines{#3}%
\scratchdimen\dimexpr#2+\lineheight\relax
@@ -1520,17 +1504,17 @@
\hskip-.5\lineheight\relax
\ifcase\gridboxlinenomode\or
\rlap
- {\hskip\dimexpr.2\bodyfontsize+\scratchdimen\relax
- \infofont\hbox to \emwidth{\hss\recurselevel}}%
+ {\hskip.2\bodyfontsize\hskip\scratchdimen
+ \infofont\hbox to 1em{\hss\recurselevel}}%
\or
\llap
- {\infofont\hbox to \emwidth{\hss\recurselevel}%
+ {\infofont\hbox to 1em{\hss\recurselevel}%
\hskip.2\bodyfontsize}%
\fi
\vrule
- \s!height \gridboxwidth
- \s!depth \gridboxwidth
- \s!width \scratchdimen
+ \!!height \gridboxwidth
+ \!!depth \gridboxwidth
+ \!!width \scratchdimen
\par}}
\vfill}}
@@ -1603,8 +1587,7 @@
\newtoks\everybeforeblankhandling
\newtoks\everyafterblankhandling
-\newconditional\c_space_vspacing_done
-\newconditional\c_space_vspacing_fixed
+\newconditional\someblankdone
\appendtoks
\s_spac_vspacing_temp\zeropoint
@@ -1612,41 +1595,40 @@
\attribute\skippenaltyattribute \attributeunsetvalue
\attribute\skiporderattribute \attributeunsetvalue
\ifgridsnapping
- \settrue\c_space_vspacing_fixed
+ \settrue\blankisfixed
\else
- \setfalse\c_space_vspacing_fixed
+ \setfalse\blankisfixed
\fi
\to \everybeforeblankhandling
\appendtoks
\s_spac_vspacing_temp\plusone\s_spac_vspacing_temp
- \ifconditional\c_space_vspacing_fixed \else
- \s!plus \skipgluefactor\s_spac_vspacing_temp
- \s!minus\skipgluefactor\s_spac_vspacing_temp
+ \ifconditional\blankisfixed \else
+ \!!plus \skipgluefactor\s_spac_vspacing_temp
+ \!!minus\skipgluefactor\s_spac_vspacing_temp
\fi
- \relax
\to \everyafterblankhandling
\def\setblankcategory#1%
- {\settrue\c_space_vspacing_done
+ {\settrue\someblankdone
\attribute\skipcategoryattribute#1\relax}
\def\setblankorder#1%
{\attribute\skiporderattribute#1\relax}
\def\fixedblankskip
- {\settrue\c_space_vspacing_fixed}
+ {\settrue\blankisfixed}
\def\flexibleblankskip
- {\setfalse\c_space_vspacing_fixed}
+ {\setfalse\blankisfixed}
\def\addblankskip#1#2#3%
- {\settrue\c_space_vspacing_done
+ {\settrue\someblankdone
\advance\s_spac_vspacing_temp#1\dimexpr\ifgridsnapping#3\else#2\fi\relax\relax}
\def\setblankpenalty#1%
{\flushblankhandling
- \settrue\c_space_vspacing_done
+ \settrue\someblankdone
\attribute\skipcategoryattribute \plusthree
\attribute\skippenaltyattribute #1\relax
\flushblankhandling}
@@ -1664,30 +1646,30 @@
\def\dostartblankhandling
{\begingroup
- \setfalse\c_space_vspacing_done
+ \setfalse\someblankdone
\the\everybeforeblankhandling}
\unexpanded\def\stopblankhandling
{\the\everyafterblankhandling
- \ifconditional\c_space_vspacing_done
+ \ifconditional\someblankdone
\vskip\s_spac_vspacing_temp
\fi
\endgroup}
\def\flushblankhandling
{\the\everyafterblankhandling
- \ifconditional\c_space_vspacing_done
+ \ifconditional\someblankdone
\vskip\s_spac_vspacing_temp
\fi
- \setfalse\c_space_vspacing_done
+ \setfalse\someblankdone
\the\everybeforeblankhandling}
\def\addpredefinedblankskip#1#2%
- {\settrue\c_space_vspacing_done
+ {\settrue\someblankdone
\advance\s_spac_vspacing_temp#1\dimexpr\csname\??vspacingamount#2\endcsname\relax}
\def\addaskedblankskip#1#2%
- {\settrue\c_space_vspacing_done
+ {\settrue\someblankdone
\advance\s_spac_vspacing_temp#1\dimexpr#2\relax}
% The main spacer:
@@ -1714,13 +1696,13 @@
\fi\fi}
\def\spac_vspacing_yes_indeed[#1]%
- {\ifmmode\else\par\ctxcommand{vspacing("#1")}\fi}
+ {\ifmmode\else\ctxcommand{vspacing("#1")}\fi}
\def\spac_vspacing_yes_ignore[#1]%
{\ifmmode\else\par\fi}
\def\spac_vspacing_nop_indeed
- {\ifmmode\else\par\ctxcommand{vspacing("\currentvspacing")}\fi}
+ {\ifmmode\else\ctxcommand{vspacing("\currentvspacing")}\fi}
\def\spac_vspacing_nop_ignore
{\ifmmode\else\par\fi}
@@ -1748,6 +1730,17 @@
\let\synchronizevspacing\setupvspacing_nop
+% used both
+
+\unexpanded\def\inhibitblank
+ {\vspacing[\v!disable]} % can be made faster
+
+\let\doinhibitblank\inhibitblank % keep this command, used in styles
+
+\let\setupblank \setupvspacing
+\let\blank \vspacing
+\let\synchronizeblank\synchronizevspacing
+
% category:4 is default
% this interface might change (into an \install, buw we will then keep this one hidden)
@@ -1797,27 +1790,12 @@
\dorecurse{10} % todo: other values < 4000
{\normalexpanded{\definevspacing[\v!samepage-\recurselevel][penalty:\the\numexpr4000+250*\recurselevel\relax]}}
-\definevspacing[\v!default] [\v!big] % todo: needs to adapt to \setupblank
-\definevspacing[\v!before] [\v!default] % but we need to avoid circular references
-\definevspacing[\v!inbetween][\v!default] % then
-\definevspacing[\v!after] [\v!before]
-
-\setupvspacing
- [\v!big] % alternatively [\v!standard]
-
%D Maybe at some point we will differ between \type {\vspacing} and
%D \type {\blank} (we needed the first one while playing with the
%D new code).
-\unexpanded\def\inhibitblank
- {\vspacing[\v!disable]} % can be made faster
-
-\let\doinhibitblank\inhibitblank % keep this command, used in styles
-
-\let\defineblank \definevspacing
-\let\setupblank \setupvspacing
\let\blank \vspacing
-\let\synchronizeblank \synchronizevspacing
+\let\defineblank \definevspacing
\let\defineblankmethod\definevspacingamount
%D The following command is for Wolfgang. It has to be used with
@@ -1872,125 +1850,4 @@
\relax
\fi}
-%D Some preliminary code: a simple and fast hanger, for usage in
-%D macros (moved from cont-new).
-
-\installcorenamespace {hanging}
-
-\installdirectcommandhandler \??hanging {hanging}
-
-\setuphanging
- [\c!distance=.5em]
-
-\unexpanded\def\starthanging
- {\noindent\bgroup
- \dowithnextboxcs\spac_hanging_finish\hbox}
-
-\def\spac_hanging_finish
- {\setbox\nextbox\hbox
- {\box\nextbox
- \hskip\directhangingparameter\c!distance}%
- \hangindent\wd\nextbox
- \hangafter\plusone
- \box\nextbox
- \ignorespaces}
-
-\unexpanded\def\stophanging
- {\endgraf
- \egroup}
-
-\unexpanded\def\starthangaround
- {\noindent\bgroup
- \dowithnextboxcs\spac_hanging_around_finish\hbox}
-
-\def\spac_hanging_around_finish
- {\ifdim\nextboxht>\strutht
- \setbox\nextbox\tbox
- {\box\nextbox}%
- \fi
- \setbox\nextbox\hbox
- {\box\nextbox
- \hskip\directhangingparameter\c!distance}%
- \getboxheight\scratchdimen\of\box\nextbox
- \getnoflines\scratchdimen
- \ht\nextbox\strutht
- \dp\nextbox\strutdp
- \hangindent\wd\nextbox
- \hangafter-\noflines
- \llap{\box\nextbox}%
- \ignorespaces}
-
-\unexpanded\def\stophangaround
- {\endgraf
- \egroup}
-
-%D \macros
-%D {startfixed}
-%D
-%D \starttyping
-%D \startitemize
-%D \startitem \externalfigure[cow][height=1cm] \stopitem
-%D \startitem \externalfigure[cow][height=1cm] \stopitem
-%D
-%D \startitem \startfixed \externalfigure[cow][height=1cm]\stopfixed \stopitem
-%D \startitem \startfixed[high]\externalfigure[cow][height=1cm]\stopfixed \stopitem
-%D \startitem \startfixed[low] \externalfigure[cow][height=1cm]\stopfixed \stopitem
-%D \startitem \startfixed[lohi]\externalfigure[cow][height=1cm]\stopfixed \stopitem
-%D
-%D \startitem test \par \startfixed \externalfigure[koe][height=1cm]\stopfixed \stopitem
-%D \startitem test \par \startfixed[high]\externalfigure[koe][height=1cm]\stopfixed \stopitem
-%D \startitem test \par \startfixed[low] \externalfigure[koe][height=1cm]\stopfixed \stopitem
-%D \startitem test \par \startfixed[lohi]\externalfigure[koe][height=1cm]\stopfixed \stopitem
-%D \stopitemize
-%D \stopbuffer
-%D
-%D \typebuffer \getbuffer
-
-\installcorenamespace{fixedalternatives}
-
-\unexpanded\def\startfixed
- {\bgroup
- \dosingleempty\typo_fixed_start}
-
-\def\typo_fixed_start
- {\ifhmode
- \expandafter\typo_fixed_start_h
- \else
- \expandafter\typo_fixed_start_v
- \fi}
-
-\def\typo_fixed_start_h[#1]%
- {\let\stopfixed\typo_fixed_stop_h
- \dowithnextbox{\typo_fixed_finish{#1}}%
- \vbox\bgroup
- %ignorespaces
- \setlocalhsize}
-
-\unexpanded\def\typo_fixed_stop_h
- {%removeunwantedspaces
- \egroup
- \egroup}
-
-\def\typo_fixed_start_v[#1]%
- {\let\stopfixed\typo_fixed_stop_v
- \startbaselinecorrection}
-
-\unexpanded\def\typo_fixed_stop_v
- {\stopbaselinecorrection
- \egroup}
-
-\letvalue{\??fixedalternatives \v!high}\bbox
-\letvalue{\??fixedalternatives \v!low}\tbox
-\letvalue{\??fixedalternatives \v!middle}\vcenter
-\letvalue{\??fixedalternatives \v!lohi}\vcenter
-\letvalue{\??fixedalternatives\s!unknown}\tbox
-\letvalue{\??fixedalternatives\s!default}\tbox
-
-\unexpanded\def\typo_fixed_finish#1%
- {\expandcheckedcsname\??fixedalternatives{#1}\s!default{\box\nextbox}}
-
-% %D Forgotten already:
-%
-% \def\shapefill{\vskip\zeropoint\s!plus\lineheight\s!minus\lineheight\relax}
-
\protect \endinput