diff options
author | Marius <mariausol@gmail.com> | 2012-01-11 12:20:16 +0200 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2012-01-11 12:20:16 +0200 |
commit | ee0d480c979cb344dc0bbeca2eda9166e062f2db (patch) | |
tree | eb842149083c07be88d04385e4a80ec67b4d6a3d /tex | |
parent | d44c3d2b9ac2a797c610b9b472527119c08bf206 (diff) | |
download | context-ee0d480c979cb344dc0bbeca2eda9166e062f2db.tar.gz |
beta 2012.01.11 10:58
Diffstat (limited to 'tex')
55 files changed, 1062 insertions, 1032 deletions
diff --git a/tex/context/base/anch-bck.mkvi b/tex/context/base/anch-bck.mkvi index af29668f8..a20a25468 100644 --- a/tex/context/base/anch-bck.mkvi +++ b/tex/context/base/anch-bck.mkvi @@ -152,15 +152,15 @@ \setvalue{\??textbackgroundlevel\v!text}% {\let\anch_backgrounds_text_start_indeed\anch_backgrounds_text_start_txt - \let\anch_backgrounds_text_stop_indeed \dostoptextbackgroundtxt} + \let\anch_backgrounds_text_stop_indeed \anch_backgrounds_text_stop_txt} \setvalue{\??textbackgroundlevel\v!paragraph}% {\ifnum\c_anch_backgrounds_text_level>\plusone \let\anch_backgrounds_text_start_indeed\anch_backgrounds_text_start_txt - \let\anch_backgrounds_text_stop_indeed \dostoptextbackgroundtxt + \let\anch_backgrounds_text_stop_indeed \anch_backgrounds_text_stop_txt \else \let\anch_backgrounds_text_start_indeed\anch_backgrounds_text_start_par - \let\anch_backgrounds_text_stop_indeed \dostoptextbackgroundpar + \let\anch_backgrounds_text_stop_indeed \anch_backgrounds_text_stop_par \fi} \setvalue{\??textbackgroundlevel\v!none}% @@ -191,10 +191,10 @@ \let\m_anch_backgrounds_text_background\!!zerocount \fi \startpositionoverlay{\textbackgroundoverlay{\textbackgroundparameter\c!level}}% - \anch_backgrounds_text_mp_graphic % gets expanded directly + \anch_backgrounds_text_meta_graphic % gets expanded directly \stoppositionoverlay} -\def\anch_backgrounds_text_mp_graphic +\def\anch_backgrounds_text_meta_graphic {\normalexpanded {\setMPpositiongraphicrange % needs to be optimized {\v_anch_backgrounds_anchor_current_b}% @@ -235,7 +235,7 @@ \usetextbackgroundstyleandcolor\c!style\c!color \fpos\v_anch_backgrounds_text_current\ignorespaces} -\def\dostoptextbackgroundtxt +\def\anch_backgrounds_text_stop_txt {\tpos\v_anch_backgrounds_text_current \endgroup} @@ -249,7 +249,7 @@ \resetallattributes % \attribute\linenumberattribute \attributeunsetvalue \noindent \ifgridsnapping - \doassignsomeskip\textbackgroundparameter\c!topoffset\to\textbackgroundskip + \spac_helpers_assign_skip\textbackgroundskip{\textbackgroundparameter\c!topoffset}% \ifdim\textbackgroundskip>\zeropoint \struttedbox{\hbox{\raise\textbackgroundskip\hbox{\fpos\v_anch_backgrounds_text_current}}}% \else @@ -264,7 +264,7 @@ \vskip-\lineheight \nobreak \ifgridsnapping \else - \doassignsomeskip\textbackgroundparameter\c!topoffset\to\textbackgroundskip + \spac_helpers_assign_skip\textbackgroundskip{\textbackgroundparameter\c!topoffset}% \ifdim\textbackgroundskip>\zeropoint \kern\textbackgroundskip\nobreak \fi @@ -284,10 +284,10 @@ \doinhibitblank % \blank[\v!disable]% new \par} -\def\dostoptextbackgroundpar +\def\anch_backgrounds_text_stop_par {\par \removelastskip % new - \doassignsomeskip\textbackgroundparameter\c!bottomoffset\to\textbackgroundskip + \spac_helpers_assign_skip\textbackgroundskip{\textbackgroundparameter\c!bottomoffset}% \ifdim\lastskip>\zeropoint \advance\textbackgroundskip-\lastskip \fi @@ -302,7 +302,7 @@ \forgeteverypar % NOT REALLY NEEDED, SAVES HASH/MEM \resetallattributes % \attribute\linenumberattribute \attributeunsetvalue \nobreak \noindent \strut \hfill \kern\zeropoint - \doassignsomeskip\textbackgroundparameter\c!bottomoffset\to\textbackgroundskip + \spac_helpers_assign_skip\textbackgroundskip{\textbackgroundparameter\c!bottomoffset}% \ifgridsnapping % experimental, pascal (todo: topoffset in same way) \ifdim\textbackgroundskip>\zeropoint \struttedbox\plusone{\hbox{\lower\textbackgroundskip\hbox{\tpos\v_anch_backgrounds_text_current}}}% diff --git a/tex/context/base/anch-pgr.mkiv b/tex/context/base/anch-pgr.mkiv index ebfbb7d1f..8c47581f3 100644 --- a/tex/context/base/anch-pgr.mkiv +++ b/tex/context/base/anch-pgr.mkiv @@ -375,14 +375,14 @@ \newbox\positiongraphicbox \def\startMPpositiongraphic % id setups - {\dodoublegroupempty\anch_positions_mp_graphic_start} + {\dodoublegroupempty\anch_positions_meta_graphic_start} -\def\anch_positions_mp_graphic_start#1#2#3\stopMPpositiongraphic % tag list mpcode - {\setgvalue{\??positiongraphic#1}{\anch_positions_mp_graphic_use{#1}{#2}{#3}}} +\def\anch_positions_meta_graphic_start#1#2#3\stopMPpositiongraphic % tag list mpcode + {\setgvalue{\??positiongraphic#1}{\anch_positions_meta_graphic_use{#1}{#2}{#3}}} \let\stopMPpositiongraphic\relax -\def\anch_positions_mp_graphic_prepare +\def\anch_positions_meta_graphic_prepare {\ifcsname\??gv\currentmpvariableclass:self\endcsname \else \letvalue{\??gv\currentmpvariableclass:self}\currentposition \fi @@ -390,51 +390,51 @@ \letvalue{\??gv\currentmpvariableclass:from}\currentposition \fi} -\def\anch_positions_mp_graphic_use#1#2#3% +\def\anch_positions_meta_graphic_use#1#2#3% {\begingroup \meta_prepare_variables{#2}% - \anch_positions_mp_graphic_prepare + \anch_positions_meta_graphic_prepare \startMPcode#3\stopMPcode \endgroup} \def\MPpositiongraphic - {\dodoublegroupempty\anch_positions_mp_graphic_direct} + {\dodoublegroupempty\anch_positions_meta_graphic_direct} -\def\anch_positions_mp_graphic_direct#1% tag setups +\def\anch_positions_meta_graphic_direct#1% tag setups {\ifcsname\??positionmethod#1\endcsname % method - \expandafter\anch_positions_mp_graphic_direct_indeed_method + \expandafter\anch_positions_meta_graphic_direct_indeed_method \else\ifcsname\??positiongraphic#1\endcsname - \doubleexpandafter\anch_positions_mp_graphic_direct_indeed_normal + \doubleexpandafter\anch_positions_meta_graphic_direct_indeed_normal \else - \doubleexpandafter\anch_positions_mp_graphic_direct_indeed_unknown + \doubleexpandafter\anch_positions_meta_graphic_direct_indeed_unknown \fi\fi{#1}} -\let\anch_positions_mp_graphic_direct_indeed_unknown\gobbletwoarguments +\let\anch_positions_meta_graphic_direct_indeed_unknown\gobbletwoarguments -\def\anch_positions_mp_graphic_direct_indeed_method - {\anch_positions_mp_graphic_direct_indeed\??positionmethod} +\def\anch_positions_meta_graphic_direct_indeed_method + {\anch_positions_meta_graphic_direct_indeed\??positionmethod} -\def\anch_positions_mp_graphic_direct_indeed_normal - {\anch_positions_mp_graphic_direct_indeed\??positiongraphic} +\def\anch_positions_meta_graphic_direct_indeed_normal + {\anch_positions_meta_graphic_direct_indeed\??positiongraphic} -\def\anch_positions_mp_graphic_direct_indeed#1#2#3% what tag setups +\def\anch_positions_meta_graphic_direct_indeed#1#2#3% what tag setups {\begingroup \setupMPvariables[#2][#3]% \edef\currentmpvariableclass{#2}% - \anch_positions_mp_graphic_prepare - \ignoreMPboxdepth - \def\anch_positions_mp_graphic_direct{\anch_positions_mp_graphic_nested{#3}}% takes two extra arguments + \anch_positions_meta_graphic_prepare + \obeyMPboxorigin % do we also set the size ? + \def\anch_positions_meta_graphic_direct{\anch_positions_meta_graphic_nested{#3}}% takes two extra arguments \setbox\positiongraphicbox\hbox {\ignorespaces\csname#1#2\endcsname\removelastspace}% \smashbox\positiongraphicbox \box\positiongraphicbox \endgroup} -\def\anch_positions_mp_graphic_nested#1#2#3% nesting used in prikkels / pascal (might go away) +\def\anch_positions_meta_graphic_nested#1#2#3% nesting used in prikkels / pascal (might go away) {\begingroup \setupMPvariables[#2][#1,#3]% \edef\currentmpvariableclass{#2}% - \anch_positions_mp_graphic_prepare + \anch_positions_meta_graphic_prepare \getvalue{\??positiongraphic#2}% \endgroup}% diff --git a/tex/context/base/anch-pos.mkiv b/tex/context/base/anch-pos.mkiv index 2ebeb69f6..a801a5763 100644 --- a/tex/context/base/anch-pos.mkiv +++ b/tex/context/base/anch-pos.mkiv @@ -406,9 +406,10 @@ \unexpanded\def\rawwpos#1% {\hpos{w:#1} {\strut - \hskip-\leftskip - \hskip\hsize - \hskip-\rightskip}} +% \hskip-\leftskip +% \hskip\hsize +% \hskip-\rightskip}} + \hskip\dimexpr\hsize-\leftskip-\rightskip\relax}} % the next macro disables par positions (in inner boxes) and % only registers the width diff --git a/tex/context/base/buff-ini.mkiv b/tex/context/base/buff-ini.mkiv index aa8ac8d1f..0d240e1a9 100644 --- a/tex/context/base/buff-ini.mkiv +++ b/tex/context/base/buff-ini.mkiv @@ -59,7 +59,7 @@ \expandafter\buff_grab_direct_indeed_b \fi} -\def\buff_grab_direct_indeed_a[#1][#2][#3][#4]{\buff_start_indeed{#1}{#2}{#3}{#4}} +\def\buff_grab_direct_indeed_a[#1][#2][#3][#4]{\buff_start_indeed {#1}{#2}{#3}{#4}} \def\buff_grab_direct_indeed_b[#1][#2][#3][#4]{\buff_start_indeed\empty{#1}{#2}{#3}} \unexpanded\def\buff_pickup#1#2#3#4#5% name, startsequence, stopsequence, before, after @@ -79,7 +79,7 @@ \buff_gobble} \unexpanded\def\buff_stop#1% - {\egroup + {% already done \egroup \getvalue{#1}} \unexpanded\def\setbuffer diff --git a/tex/context/base/buff-ver.mkiv b/tex/context/base/buff-ver.mkiv index 67ee200d5..52626166c 100644 --- a/tex/context/base/buff-ver.mkiv +++ b/tex/context/base/buff-ver.mkiv @@ -49,7 +49,7 @@ \setvalue{\??typingspace\v!normal }{} \setvalue{\??typingspace\v!fixed }{\let\obeyedspace\specialfixedspace} -\setvalue{\??typingblank\v!standard }{\ctxparskip} +\setvalue{\??typingblank\v!standard }{\s_spac_whitespace_parskip} \setvalue{\??typingblank\v!small }{\smallskipamount} \setvalue{\??typingblank\v!medium }{\medskipamount} \setvalue{\??typingblank\v!big }{\bigskipamount} diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index 48c6cd4ea..80af70a20 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{2012.01.09 10:08} +\newcontextversion{2012.01.11 10:58} %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 7c4855dcf..2627ecaee 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{2012.01.09 10:08} +\newcontextversion{2012.01.11 10:58} %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 Binary files differindex 538e5983c..93246db30 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png Binary files differindex 105c08445..3a5ddbd44 100644 --- a/tex/context/base/context-version.png +++ b/tex/context/base/context-version.png diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii index d5978661a..f27cee9bc 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{2012.01.09 10:08} +\edef\contextversion{2012.01.11 10:58} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 08671380f..1f34408c8 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -23,7 +23,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2012.01.09 10:08} +\edef\contextversion{2012.01.11 10:58} %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 515cca57f..1e21fc60c 100644 --- a/tex/context/base/core-mis.mkiv +++ b/tex/context/base/core-mis.mkiv @@ -1,3 +1,4 @@ + %D \module %D [ file=core-mis, %D version=1998.01.29, @@ -1252,63 +1253,7 @@ \def\referral {\dosingleargument\doreferral} - -% FUZZY OLD STUFF: will be removed when not used in some manual; -% rows instead of columns, i'd forgotten that this code exist -% -% \definesystemvariable{ri} -% -% \unexpanded\def\setuprows -% {\dodoubleargument\getparameters[\??ri]} -% -% \definecomplexorsimpleempty\startrows -% -% \def\complexstartrows[#1]% -% {\bgroup -% \setuprows[#1]% -% \let\do@@ribottom\relax -% \def\row -% {\do@@ribottom -% \egroup -% \dimen0\vsize -% \divide\dimen0 \@@rin -% \advance\dimen0 -\lineskip -% \vbox to \dimen0 -% \bgroup -% \@@ritop -% \let\do@@ribottom\@@ribottom -% \ignorespaces}% -% \bgroup -% \row} -% -% \unexpanded\def\stoprows -% {\do@@ribottom -% \egroup -% \egroup} -% -% \setuprows -% [\c!n=2, -% \c!top=, -% \c!bottom=\vfill] - -% THIS WAS MAIN-003.TEX - -% messages moved - -% messages moved - -% messages moved - -% messages moved -% messages moved - -% messages moved - -% messages moved - -% messages moved - \definetabulate [\v!legend] [|emj1|i1|mR|] @@ -1335,9 +1280,6 @@ \unexpanded\def\xxbox {\bgroup\aftergroup\egroup\hbox\bgroup\txx\let\next=} -% \def\mrm#1% -% {$\rm#1$} - %D \macros %D {definepairedbox, setuppairedbox, placepairedbox} %D @@ -2012,7 +1954,7 @@ \hsize#1\hsize} \setuphorizontaldivision - [\c!distance=\tfskipsize, + [\c!distance=\emwidth, \c!n=\v!fit] %D This one is for Daniel Pittman, who wanted tight diff --git a/tex/context/base/font-ini.mkvi b/tex/context/base/font-ini.mkvi index 3e9660cf3..2bf4c49dd 100644 --- a/tex/context/base/font-ini.mkvi +++ b/tex/context/base/font-ini.mkvi @@ -618,7 +618,7 @@ \def\font_helpers_set_math_family#mrfam#familytag% {\ifconditional\optimizemathfontdefinitions - \ifcsname*\fontclass\textface\s!mm#familytag1\fontsize1*\endcsname + \ifcsname\??fontsclass\fontclass\textface\s!mm#familytag1\fontsize1\endcsname \font_helpers_preset_math_family_indeed#mrfam#familytag% \else \font_helpers_set_math_family_indeed#mrfam#familytag% @@ -629,7 +629,7 @@ \def\font_helpers_set_math_family_bold#mbfam#familytag#mrfam% {\ifconditional\optimizemathfontdefinitions - \ifcsname*\fontclass\textface\s!mm#familytag1\fontsize1*\endcsname + \ifcsname\??fontsclass\fontclass\textface\s!mm#familytag1\fontsize1\endcsname \font_helpers_preset_math_family_indeed#mbfam#familytag% \else \font_helpers_set_math_family_bold_indeed#mbfam#familytag#mrfam% @@ -639,9 +639,9 @@ \fi} \def\font_helpers_preset_math_family_indeed#fam#familytag% - {\scriptscriptfont#fam\csname*\fontclass\scriptscriptface\s!mm#familytag3\fontsize3*\endcsname - \scriptfont #fam\csname*\fontclass\scriptface \s!mm#familytag2\fontsize2*\endcsname - \textfont #fam\csname*\fontclass\textface \s!mm#familytag1\fontsize1*\endcsname} + {\scriptscriptfont#fam\csname\??fontsclass\fontclass\scriptscriptface\s!mm#familytag3\fontsize3\endcsname + \scriptfont #fam\csname\??fontsclass\fontclass\scriptface \s!mm#familytag2\fontsize2\endcsname + \textfont #fam\csname\??fontsclass\fontclass\textface \s!mm#familytag1\fontsize1\endcsname} \let\font_helpers_reset_fontclass_math_families\gobbleoneargument @@ -1540,8 +1540,8 @@ % todo: now mathsize twice in name (so it can go here) % todo: check when mathsize is needed -\installcorenamespace {fontsbasic} -\installcorenamespace {fontsclass} +\installcorenamespace{fontsbasic} +\installcorenamespace{fontsclass} \newconditional\font_auto_font_size \settrue\font_auto_font_size @@ -1556,7 +1556,7 @@ \let\v_font_identifier_basic_saved\v_font_identifier_basic \let\v_font_identifier_class_saved\v_font_identifier_class -% \def\v_font_identifier_class{*\fontclass\lastfontidentifier\fontstyle\fontsize*} % no \currentmathsize +% \def\v_font_identifier_class{\??fontsclass\fontclass\lastfontidentifier\fontstyle\fontsize} % no \currentmathsize \def\font_basics_define_font_without_parameters#identifier#2% {\c_font_feature_inheritance_mode\c_font_feature_inheritance_fontonly @@ -2092,28 +2092,28 @@ \def\font_basics_define_body_font_nop_xx#style#body[#one#two#rest=#value]% {\ifcsname#style#one#two#rest\endcsname\else\font_basics_check_bodyfont{#style}{#one#two}{#rest}\fi - \expandafter\let\csname*#body#style#one#two#rest*\endcsname\undefined + \expandafter\let\csname\??fontsclass#body#style#one#two#rest\endcsname\undefined \unexpanded\expandafter\normaledef\csname#body#style#one#two#rest\endcsname{\font_helpers_trigger{#body#style#one#two#rest}{\number\p_font_rscale}{#body}{\normalunexpanded{#value}}}} \def\font_basics_define_body_font_yes_xx#style#body[#one#two#rest=#value]% {\ifcsname#style#one#two#rest\endcsname\else\font_basics_check_bodyfont{#style}{#one#two}{#rest}\fi - \global\expandafter\let\csname*\fontclass#body#style#one#two#rest*\endcsname\undefined + \global\expandafter\let\csname\??fontsclass\fontclass#body#style#one#two#rest\endcsname\undefined \unexpanded\expandafter\normalxdef\csname\fontclass#body#style#one#two#rest\endcsname{\font_helpers_trigger{#body#style#one#two#rest}{\number\p_font_rscale}{#body}{\normalunexpanded{#value}}}} \def\font_basics_define_body_font_nop_mm#style#body[#one#two#rest=#value]% {\ifcsname#style#one#two#rest\endcsname\else\font_basics_check_bodyfont{#style}{#one#two}{#rest}\fi - \expandafter\let\csname*#body#style#one#two#rest1*\endcsname\undefined - \expandafter\let\csname*#body#style#one#two#rest2*\endcsname\undefined - \expandafter\let\csname*#body#style#one#two#rest3*\endcsname\undefined + \expandafter\let\csname\??fontsclass#body#style#one#two#rest1\endcsname\undefined + \expandafter\let\csname\??fontsclass#body#style#one#two#rest2\endcsname\undefined + \expandafter\let\csname\??fontsclass#body#style#one#two#rest3\endcsname\undefined \unexpanded\expandafter\normaledef\csname#body#style#one#two#rest1\endcsname{\font_helpers_trigger{#body#style#one#two#rest1}{\number\p_font_rscale}{#body}{\normalunexpanded{#value}}}% \unexpanded\expandafter\normaledef\csname#body#style#one#two#rest2\endcsname{\font_helpers_trigger{#body#style#one#two#rest2}{\number\p_font_rscale}{#body}{\normalunexpanded{#value}}}% \unexpanded\expandafter\normaledef\csname#body#style#one#two#rest3\endcsname{\font_helpers_trigger{#body#style#one#two#rest3}{\number\p_font_rscale}{#body}{\normalunexpanded{#value}}}} \def\font_basics_define_body_font_yes_mm#style#body[#one#two#rest=#value]% {\ifcsname#style#one#two#rest\endcsname\else\font_basics_check_bodyfont{#style}{#one#two}{#rest}\fi - \global\expandafter\let\csname*\fontclass#body#style#one#two#rest1*\endcsname\undefined - \global\expandafter\let\csname*\fontclass#body#style#one#two#rest2*\endcsname\undefined - \global\expandafter\let\csname*\fontclass#body#style#one#two#rest3*\endcsname\undefined + \global\expandafter\let\csname\??fontsclass\fontclass#body#style#one#two#rest1\endcsname\undefined + \global\expandafter\let\csname\??fontsclass\fontclass#body#style#one#two#rest2\endcsname\undefined + \global\expandafter\let\csname\??fontsclass\fontclass#body#style#one#two#rest3\endcsname\undefined \unexpanded\expandafter\normalxdef\csname\fontclass#body#style#one#two#rest1\endcsname{\font_helpers_trigger{#body#style#one#two#rest1}{\number\p_font_rscale}{#body}{\normalunexpanded{#value}}}% \unexpanded\expandafter\normalxdef\csname\fontclass#body#style#one#two#rest2\endcsname{\font_helpers_trigger{#body#style#one#two#rest2}{\number\p_font_rscale}{#body}{\normalunexpanded{#value}}}% \unexpanded\expandafter\normalxdef\csname\fontclass#body#style#one#two#rest3\endcsname{\font_helpers_trigger{#body#style#one#two#rest3}{\number\p_font_rscale}{#body}{\normalunexpanded{#value}}}} @@ -3684,7 +3684,7 @@ %D Since we know what scaling it to be applied, we can %D implement a much faster alternative: -\installcorenamespace {symbolfont} +\installcorenamespace{symbolfont} \let\thedefinedfont\relax diff --git a/tex/context/base/font-tra.mkiv b/tex/context/base/font-tra.mkiv index 0f16dbc43..41bd3dd80 100644 --- a/tex/context/base/font-tra.mkiv +++ b/tex/context/base/font-tra.mkiv @@ -51,6 +51,7 @@ \tttf\language\minusone \veryraggedright \forgetparindent + \forgeteverypar \hangindent1em \hangafter\plusone \dontleavehmode\hbox{\detokenize{#1}}\removeunwantedspaces @@ -71,6 +72,7 @@ {\begingroup \veryraggedright \forgetparindent + \forgeteverypar \dontleavehmode\bgroup\tttf \language\minusone features: \showotfstepfeatures\egroup \blank \dontleavehmode\bgroup\tttf result:\egroup @@ -98,7 +100,8 @@ \startotfcollecting \begingroup \veryraggedright - \forgetparindent} + \forgetparindent + \forgeteverypar} \unexpanded\def\stopotfsample {\endgroup @@ -113,6 +116,7 @@ {\begingroup \veryraggedright \forgetparindent + \forgeteverypar \setupcolors[\c!state=\v!start]% can be option \startotfsample \global\setbox\otfcompositionbox\hbox{\definedfont[#1]\ifnum#2<0 \textdir TRT\else\ifnum#2>0 \textdir TLT\fi\fi\relax#3}% diff --git a/tex/context/base/grph-fig.mkiv b/tex/context/base/grph-fig.mkiv index c33949361..593e0f18a 100644 --- a/tex/context/base/grph-fig.mkiv +++ b/tex/context/base/grph-fig.mkiv @@ -447,7 +447,7 @@ \def\dodotypesetbufferindeed#1% {} - + % for me only (manuals and such) % % \definetypesetting [name] [options] [settings-a] @@ -462,17 +462,17 @@ % \typesetfile[oepsoeps.tex][width=10cm,frame=on] % \stoptext -\definesystemvariable{tz} +\installcorenamespace{typesettingfile} \unexpanded\def\definetypesetting{\dotripleempty\dodefinetypesetting} \unexpanded\def\typesetfile {\dotripleempty\dotypesetfile} \def\dodefinetypesetting[#1][#2][#3]% <name> options settings-a - {\doifsomething{#1}{\setvalue{\??tz#1}{\dodotypesetfile{#2}{#3}}}} + {\doifsomething{#1}{\setvalue{\??typesettingfile#1}{\dodotypesetfile{#2}{#3}}}} \def\dotypesetfile[#1][#2][#3]% <name> filename settings-b | filename options settings - {\ifcsname\??tz#1\endcsname - \csname\??tz#1\endcsname{#2}{#3}% + {\ifcsname\??typesettingfile#1\endcsname + \csname\??typesettingfile#1\endcsname{#2}{#3}% \else\ifthirdargument % filename options settings \dodotypesetfile{#2}{#3}{#1}{}% \else\ifsecondargument % filename settings diff --git a/tex/context/base/lang-def.mkiv b/tex/context/base/lang-def.mkiv index 8c2bec1cf..e838f60e1 100644 --- a/tex/context/base/lang-def.mkiv +++ b/tex/context/base/lang-def.mkiv @@ -106,33 +106,33 @@ \installlanguage [\s!nb] - [spacing=packed, - lefthyphenmin=2, - righthyphenmin=2, - leftsentence=\emdash, - rightsentence=\emdash, - leftsubsentence=\emdash, - rightsubsentence=\emdash, - leftquote=\upperleftsinglesixquote, - rightquote=\upperrightsingleninequote, - leftquotation=\leftguillemot, - rightquotation=\rightguillemot, - date={day,{.},\space,month,\space,year}] + [\c!spacing=\v!packed, + \s!lefthyphenmin=2, + \s!righthyphenmin=2, + \c!leftsentence=\emdash, + \c!rightsentence=\emdash, + \c!leftsubsentence=\emdash, + \c!rightsubsentence=\emdash, + \c!leftquote=\upperleftsinglesixquote, + \c!rightquote=\upperrightsingleninequote, + \c!leftquotation=\leftguillemot, + \c!rightquotation=\rightguillemot, + \c!date={\v!day,{.},\space,\v!month,\space,\v!year}] \installlanguage [\s!nn] - [spacing=packed, - lefthyphenmin=2, - righthyphenmin=2, - leftsentence=\emdash, - rightsentence=\emdash, - leftsubsentence=\emdash, - rightsubsentence=\emdash, - leftquote=\upperleftsinglesixquote, - rightquote=\upperrightsingleninequote, - leftquotation=\leftguillemot, - rightquotation=\rightguillemot, - date={day,{.},\space,month,\space,year}] + [\c!spacing=\v!packed, + \s!lefthyphenmin=2, + \s!righthyphenmin=2, + \c!leftsentence=\emdash, + \c!rightsentence=\emdash, + \c!leftsubsentence=\emdash, + \c!rightsubsentence=\emdash, + \c!leftquote=\upperleftsinglesixquote, + \c!rightquote=\upperrightsingleninequote, + \c!leftquotation=\leftguillemot, + \c!rightquotation=\rightguillemot, + \c!date={\v!day,{.},\space,\v!month,\space,\v!year}] \installlanguage [\s!no] [\s!nb] @@ -260,15 +260,13 @@ \c!rightquotation=\leftguillemot, \c!date={\v!day,{.},\space,\v!month,\space,\v!year}] -\installlanguage [polish] [\s!pl] -\installlanguage [czech] [\s!cs] -\installlanguage [slovak] [\s!sk] -\installlanguage [croatian] [\s!hr] -\installlanguage [slovenian] [\s!sl] +\installlanguage [\s!polish] [\s!pl] +\installlanguage [\s!czech] [\s!cs] +\installlanguage [\s!slovak] [\s!sk] +\installlanguage [\s!croatian] [\s!hr] +\installlanguage [\s!slovenian] [\s!sl] \installlanguage [slovene] [\s!sl] % both possible (mojca: still needed?) -\installlanguage [cz] [\s!cs] - \def\doconvertsloveniancharacters{\dodoconvertcharacters{25}} \def\sloveniancharacters{\doconvertsloveniancharacters\sloveniancharacter} @@ -286,16 +284,16 @@ %D language is Slovenian. If you feel uncomfortable with this, %D mail Mojca, since she promised to to take the heat. -\defineconversion [sl] [character] [\sloveniancharacter] -\defineconversion [sl] [Character] [\slovenianCharacter] +\defineconversion [\s!sl] [character] [\sloveniancharacter] +\defineconversion [\s!sl] [Character] [\slovenianCharacter] -\defineconversion [sl] [characters] [\sloveniancharacters] -\defineconversion [sl] [Characters] [\slovenianCharacters] +\defineconversion [\s!sl] [characters] [\sloveniancharacters] +\defineconversion [\s!sl] [Characters] [\slovenianCharacters] -\defineconversion [sl] [a] [\sloveniancharacters] -\defineconversion [sl] [A] [\slovenianCharacters] -\defineconversion [sl] [AK] [\smallcapped\sloveniancharacters] -\defineconversion [sl] [KA] [\smallcapped\sloveniancharacters] +\defineconversion [\s!sl] [a] [\sloveniancharacters] +\defineconversion [\s!sl] [A] [\slovenianCharacters] +\defineconversion [\s!sl] [AK] [\smallcapped\sloveniancharacters] +\defineconversion [\s!sl] [KA] [\smallcapped\sloveniancharacters] \def\sloveniancharacters#1{\ctxcommand{alphabetic(\number#1,"sl")}} \def\slovenianCharacters#1{\ctxcommand{Alphabetic(\number#1,"sl")}} @@ -333,8 +331,8 @@ \c!date={\v!day,\space,\v!month,\space,\v!year}, \s!patterns=\s!uk] -\installlanguage [russian] [\s!ru] -\installlanguage [ukrainian] [\s!ua] +\installlanguage [\s!russian] [\s!ru] +\installlanguage [\s!ukrainian] [\s!ua] % Uralic Languages: Cheremiss, Estonian, Finnish, Karelian, Laap, % Mordvinian, Permian tongues, Hungarian, Ostyak, Vogul, Samoyed @@ -365,8 +363,8 @@ \c!rightquotation=\upperrightdoubleninequote, \c!date={\v!year,.,\space,\v!month,\space,\v!day,.}] -\installlanguage [finish] [\s!fi] -\installlanguage [hungarian] [\s!hu] +\installlanguage [\s!finish] [\s!fi] +\installlanguage [\s!hungarian] [\s!hu] % Altaic Languages: Uigur, Uzbek, Azeri/Azerbaijani, Chuvash, % Turkish, Turkmen, Kazakh, Kazar, Kireghiz, Noghay, Talar, @@ -401,16 +399,13 @@ \s!lefthyphenmin=1, \s!righthyphenmin=2] -\installlanguage [turkish] [\s!tr] -\installlanguage [turkmen] [\s!tk] +\installlanguage [\s!turkish] [\s!tr] +\installlanguage [\s!turkmen] [\s!tk] % Anatolian Languages % Arabic Languages -\definesystemconstant {arabic} -\definesystemvariable {ar} - \installlanguage [\s!ar] [\c!spacing=\v!broad, @@ -473,16 +468,10 @@ \s!lefthyphenmin=2, \s!righthyphenmin=2] -\installlanguage [lithuanian] [\s!lt] +\installlanguage [\s!lithuanian] [\s!lt] % Celtic: Breton, Welsh, Irish, Manx, Scottish Gaelic -% CJK - -\definesystemconstant {chinese} \definesystemconstant {cn} -\definesystemconstant {japanese} \definesystemconstant {ja} -\definesystemconstant {korean} \definesystemconstant {kr} - \installlanguage [\s!cn] [\c!leftsentence=——, @@ -535,7 +524,7 @@ \c!date={\v!day\space\v!month\space\v!year}, \s!patterns=\s!agr] % ok? -\installlanguage [greek] [\s!gr] +\installlanguage [\s!greek] [\s!gr] \installlanguage [\s!agr] @@ -545,8 +534,7 @@ \c!leftquotation=\upperleftdoublesixquote, \c!rightquotation=\upperrightdoubleninequote] -\installlanguage [ancientgreek] [\s!agr] -\installlanguage [grk] [\s!agr] +\installlanguage [\s!ancientgreek] [\s!agr] % Indo-Iranian Languages: 34. @@ -554,8 +542,8 @@ % Sardian, Catalan, French, Ladino, Portuguese, Proven\c{c}al, % Spanish -\ifx\guillemotspace\undefined \let\guillemotspace\empty \fi -\ifx\sentencespace \undefined \let\sentencespace \empty \fi +\ifdefined\guillemotspace \else \let\guillemotspace\empty \fi +\ifdefined\sentencespace \else \let\sentencespace \empty \fi \installlanguage [\s!fr] @@ -657,15 +645,13 @@ %D For compatibility reasons we also define: -\installlanguage [fa] [\s!fr] % for dutchies only - -\installlanguage [french] [\s!fr] -\installlanguage [spanish] [\s!es] -\installlanguage [catalan] [\s!ca] -\installlanguage [italian] [\s!it] -\installlanguage [latin] [\s!la] -\installlanguage [portuguese] [\s!pt] -\installlanguage [romanian] [\s!ro] +\installlanguage [\s!french] [\s!fr] +\installlanguage [\s!spanish] [\s!es] +\installlanguage [\s!catalan] [\s!ca] +\installlanguage [\s!italian] [\s!it] +\installlanguage [\s!latin] [\s!la] +\installlanguage [\s!portuguese] [\s!pt] +\installlanguage [\s!romanian] [\s!ro] \defineconversion [\s!fr] [\v!day:mnem] [\frordinaldaynumber] @@ -684,7 +670,7 @@ \c!rightquotation=\quotedblright, \c!date={{ },dd,{/},mm,{/},yy}] -\installlanguage [vietnamese] [\s!vi] +\installlanguage [\s!vietnamese] [\s!vi] %D Todo: generate this one from languages.data @@ -692,5 +678,11 @@ \installlanguage[deu][\s!de] \installlanguage[eng][\s!en] \installlanguage[fra][\s!fr] +%installlanguage[grk][\s!agr] + +%D This might go: + +\installlanguage[cz][\s!cs] +%installlanguage[fa][\s!fr] % for dutchies only \protect \endinput diff --git a/tex/context/base/math-ali.mkiv b/tex/context/base/math-ali.mkiv index 0738666f0..bbc77ade6 100644 --- a/tex/context/base/math-ali.mkiv +++ b/tex/context/base/math-ali.mkiv @@ -531,7 +531,7 @@ \setupcurrentmathmatrix[#1]% \fi \emptyhbox - \math_matrix_handler_apply + \math_matrix_align_method_analyze \mathmatrixleft \mathmatrixbox\bgroup \pushmacro\domatrixNC @@ -584,10 +584,7 @@ \unexpanded\def\dodomatrixNC {\gdef\domatrixNC{\endmath&}} -\installcorenamespace{mathmatrixhandler} - -\def\installmathmatrixhandler#1#2% - {\setvalue{\??mathmatrixhandler#1}{#2}} +\installcorenamespace{mathmatrixalignmethod} \let\mathmatrixleft \empty % experimental hook \let\mathmatrixright\empty % experimental hook @@ -601,20 +598,23 @@ \mathmatrixparameter\c!right$}}% \vbox} -\installmathmatrixhandler\v!top {\def\mathmatrixbox{\math_matrix_process\plusthree\plusone }} -\installmathmatrixhandler\v!high {\def\mathmatrixbox{\math_matrix_process\plusthree\zerocount}} -\installmathmatrixhandler\v!lohi {\def\mathmatrixbox{\math_matrix_process\plustwo \zerocount}} -\installmathmatrixhandler\v!low {\def\mathmatrixbox{\math_matrix_process\plusone \zerocount}} -\installmathmatrixhandler\v!bottom{\def\mathmatrixbox{\math_matrix_process\plusone \plusone }} -\installmathmatrixhandler\v!normal{\def\mathmatrixbox{\math_matrix_process\plustwo \zerocount}} % lohi +\unexpanded\def\installmathmatrixalignmethod#1#2% + {\setvalue{\??mathmatrixalignmethod#1}{#2}} -\def\math_matrix_handler_apply - {\csname\??mathmatrixhandler\ifcsname\??mathmatrixhandler\mathmatrixparameter\c!location\endcsname +\def\math_matrix_align_method_analyze + {\csname\??mathmatrixalignmethod\ifcsname\??mathmatrixalignmethod\mathmatrixparameter\c!location\endcsname \mathmatrixparameter\c!location \else \v!normal \fi\endcsname} +\installmathmatrixalignmethod\v!top {\def\mathmatrixbox{\math_matrix_process\plusthree\plusone }} +\installmathmatrixalignmethod\v!high {\def\mathmatrixbox{\math_matrix_process\plusthree\zerocount}} +\installmathmatrixalignmethod\v!lohi {\def\mathmatrixbox{\math_matrix_process\plustwo \zerocount}} +\installmathmatrixalignmethod\v!low {\def\mathmatrixbox{\math_matrix_process\plusone \zerocount}} +\installmathmatrixalignmethod\v!bottom{\def\mathmatrixbox{\math_matrix_process\plusone \plusone }} +\installmathmatrixalignmethod\v!normal{\def\mathmatrixbox{\math_matrix_process\plustwo \zerocount}} % lohi + %D \startbuffer %D \placeformula \startformula[-] \startmatrix %D \NC 1 \NC x \NC a \NR diff --git a/tex/context/base/meta-ini.mkiv b/tex/context/base/meta-ini.mkiv index 69b717cfe..d4e98c100 100644 --- a/tex/context/base/meta-ini.mkiv +++ b/tex/context/base/meta-ini.mkiv @@ -63,8 +63,8 @@ {\dosingleempty\meta_start_inclusions} \def\meta_start_inclusions[#1]#2\stopMPinclusions - {\edef\m_mp_option{#1}% - \ifx\m_mp_option\!!plustoken \else + {\edef\m_meta_option{#1}% + \ifx\m_meta_option\!!plustoken \else \global\t_meta_userinclusions\emptytoks \fi \global\t_meta_userinclusions\expandafter{\the\t_meta_userinclusions#2}} @@ -75,8 +75,8 @@ {\dosingleempty\meta_inclusions} \def\meta_inclusions[#1]#2% - {\edef\m_mp_option{#1}% - \ifx\m_mp_option\!!plustoken \else + {\edef\m_meta_option{#1}% + \ifx\m_meta_option\!!plustoken \else \global\t_meta_userinclusions\emptytoks \fi \global\t_meta_userinclusions\expandafter{\the\t_meta_userinclusions#2}} @@ -168,7 +168,7 @@ \unexpanded\def\meta_process_graphic#1% todo: extensions and inclusions outside beginfig {\meta_start_current_graphic \forgetall - \setbox\b_mp_graphic\hbox\bgroup % ; added 20100901 (as in mkii) + \setbox\b_meta_graphic\hbox\bgroup % ; added 20100901 (as in mkii) \normalexpanded{\noexpand\ctxlua{metapost.graphic( "\currentMPgraphicinstance", "\currentMPgraphicformat", @@ -257,7 +257,7 @@ {\begingroup \edef\width {#2\space}\let\overlaywidth \width \edef\height{#3\space}\let\overlayheight\height - \ifcsname\??mpmpclip#1\endcsname + \ifcsname\??mpclip#1\endcsname \meta_start_current_graphic \xdef\MPclippath{\normalexpanded{\noexpand\ctxlua{metapost.theclippath( "\currentMPgraphicinstance", @@ -329,11 +329,11 @@ % currently the inheritance of backgrounds does not work and % we might drop it anyway (too messy) -\newbox\b_mp_variable_box +\newbox\b_meta_variable_box \let \currentmpvariableclass \empty -\let \m_mp_current_variable \empty -\let \m_mp_current_variable_template\empty +\let \m_meta_current_variable \empty +\let \m_meta_current_variable_template\empty \def \meta_prepare_variable_default {\MPcolor{black}} % just to be sure we use a color but ... \edef\meta_unknown_variable_template {\??gv:\s!unknown} @@ -375,37 +375,37 @@ {\processcommalist[#1]\meta_prepare_variable} \unexpanded\def\meta_prepare_variable#1% - {\edef\m_mp_current_variable_template + {\edef\m_meta_current_variable_template {\??gv\currentmpvariableclass:#1}% - \edef\m_mp_current_variable - {\csname\ifcsname\m_mp_current_variable_template\endcsname - \m_mp_current_variable_template\else\meta_unknown_variable_template + \edef\m_meta_current_variable + {\csname\ifcsname\m_meta_current_variable_template\endcsname + \m_meta_current_variable_template\else\meta_unknown_variable_template \fi\endcsname}% - \ifx\m_mp_current_variable\empty + \ifx\m_meta_current_variable\empty \expandafter\meta_prepare_variable_nop \else \expandafter\meta_prepare_variable_yes \fi} \def\meta_prepare_variable_nop - {\expandafter \let\csname\m_mp_current_variable_template\endcsname\meta_prepare_variable_default} + {\expandafter \let\csname\m_meta_current_variable_template\endcsname\meta_prepare_variable_default} \def\meta_prepare_variable_color - {\expandafter\edef\csname\m_mp_current_variable_template\endcsname{\MPcolor\m_mp_current_variable}} + {\expandafter\edef\csname\m_meta_current_variable_template\endcsname{\MPcolor\m_meta_current_variable}} \def\meta_prepare_variable_number - {\expandafter\edef\csname\m_mp_current_variable_template\endcsname{\number\m_mp_current_variable}}% also accepts 0.number + {\expandafter\edef\csname\m_meta_current_variable_template\endcsname{\number\m_meta_current_variable}}% also accepts 0.number \def\meta_prepare_variable_dimension - {\expandafter\edef\csname\m_mp_current_variable_template\endcsname{\the\dimexpr\m_mp_current_variable}} + {\expandafter\edef\csname\m_meta_current_variable_template\endcsname{\the\dimexpr\m_meta_current_variable}} \def\meta_prepare_variable_yes - {\defconvertedcommand\ascii\m_mp_current_variable % otherwise problems + {\defconvertedcommand\ascii\m_meta_current_variable % otherwise problems \doifcolorelse \ascii % with 2\bodyfontsize {\meta_prepare_variable_color} {\begingroup - \setbox\b_mp_variable_box\hbox{\scratchdimen\m_mp_current_variable sp}% - \ifzeropt\wd\b_mp_variable_box + \setbox\b_meta_variable_box\hbox{\scratchdimen\m_meta_current_variable sp}% + \ifzeropt\wd\b_meta_variable_box \endgroup\meta_prepare_variable_number \else \endgroup\meta_prepare_variable_dimension @@ -450,26 +450,26 @@ %D \uniqueMPgraphic{meta:hash}{gap=10pt,angle=30} %D \stoptyping -\newcount\c_mp_object_counter -\newbox \b_mp_graphic +\newcount\c_meta_object_counter +\newbox \b_meta_graphic % hm, isn't this already done elsewhere? \unexpanded\def\meta_obey_box_depth - {\setbox\b_mp_graphic\hbox\bgroup - \raise\MPlly\box\b_mp_graphic + {\setbox\b_meta_graphic\hbox\bgroup + \raise\MPlly\box\b_meta_graphic \egroup} \unexpanded\def\meta_ignore_box_depth {\normalexpanded {\meta_obey_box_depth % hence the \unexpanded - \wd\b_mp_graphic\the\wd\b_mp_graphic - \ht\b_mp_graphic\the\ht\b_mp_graphic - \dp\b_mp_graphic\the\dp\b_mp_graphic}} + \wd\b_meta_graphic\the\wd\b_meta_graphic + \ht\b_meta_graphic\the\ht\b_meta_graphic + \dp\b_meta_graphic\the\dp\b_meta_graphic}} \unexpanded\def\meta_obey_box_origin - {\setbox\b_mp_graphic\hbox\bgroup - \hskip\MPllx\raise\MPlly\box\b_mp_graphic + {\setbox\b_meta_graphic\hbox\bgroup + \hskip\MPllx\raise\MPlly\box\b_meta_graphic \egroup} \unexpanded\def\obeyMPboxdepth {\let\meta_relocate_box\meta_obey_box_depth } @@ -481,7 +481,7 @@ \unexpanded\def\placeMPgraphic % the converter also displaces so in fact we revert {\meta_relocate_box - \box\b_mp_graphic} + \box\b_meta_graphic} \unexpanded\def\meta_reuse_box#1#2#3#4#5% space delimiting would save some tokens {\MPllx#2\MPlly#3\MPurx#4\MPury#5% @@ -493,9 +493,9 @@ \extendMPoverlaystamp{#2}% incl prepare \ifcsname\??mpgraphic\overlaystamp:#1\endcsname\else \meta_enable_include % redundant - \global\advance\c_mp_object_counter\plusone - \setobject{MP}{\number\c_mp_object_counter}\hbox{\meta_process_graphic{#3}}% was vbox, graphic must end up as hbox - \setxvalue{\??mpgraphic\overlaystamp:#1}{\meta_reuse_box{\number\c_mp_object_counter}{\the\MPllx}{\the\MPlly}{\the\MPurx}{\the\MPury}}% + \global\advance\c_meta_object_counter\plusone + \setobject{MP}{\number\c_meta_object_counter}\hbox{\meta_process_graphic{#3}}% was vbox, graphic must end up as hbox + \setxvalue{\??mpgraphic\overlaystamp:#1}{\meta_reuse_box{\number\c_meta_object_counter}{\the\MPllx}{\the\MPlly}{\the\MPurx}{\the\MPury}}% \fi \getvalue{\??mpgraphic\overlaystamp:#1}% \endgroup} @@ -546,9 +546,9 @@ \edef\currentmpvariableclass{#1}% \meta_prepare_variables{#2}% \meta_enable_include % redundant - \global\advance\c_mp_object_counter\plusone - \setobject{MP}{\number\c_mp_object_counter}\hbox{\meta_process_graphic{#3}}% was vbox, graphic must end up as hbox - \setxvalue{\??mpgraphic#1}{\meta_reuse_box{\number\c_mp_object_counter}{\the\MPllx}{\the\MPlly}{\the\MPurx}{\the\MPury}}% + \global\advance\c_meta_object_counter\plusone + \setobject{MP}{\number\c_meta_object_counter}\hbox{\meta_process_graphic{#3}}% was vbox, graphic must end up as hbox + \setxvalue{\??mpgraphic#1}{\meta_reuse_box{\number\c_meta_object_counter}{\the\MPllx}{\the\MPlly}{\the\MPurx}{\the\MPury}}% \getvalue{\??mpgraphic#1}% \endgroup} @@ -581,10 +581,10 @@ %D %D Experimental. -\def\m_mp_page_prefix{\doifoddpageelse oe} +\def\m_meta_page_prefix{\doifoddpageelse oe} \def\overlaypagestamp - {\m_mp_page_prefix:\overlaywidth:\overlayheight:\overlaydepth:\MPcolor\overlaycolor:\MPcolor\overlaylinecolor} + {\m_meta_page_prefix:\overlaywidth:\overlayheight:\overlaydepth:\MPcolor\overlaycolor:\MPcolor\overlaylinecolor} \unexpanded\def\startuniqueMPpagegraphic {\dodoublegroupempty\meta_start_unique_page_graphic} @@ -601,8 +601,8 @@ \def\meta_unique_page_graphic#1#2% {\meta_begin_graphic_group{#1}% \let\overlaystamp\overlaypagestamp - \setupMPvariables[\m_mp_page_prefix:\currentMPgraphicname][#2]% prefix is new here - \getvalue{\??mpgraphic\m_mp_page_prefix:\currentMPgraphicname}{}% + \setupMPvariables[\m_meta_page_prefix:\currentMPgraphicname][#2]% prefix is new here + \getvalue{\??mpgraphic\m_meta_page_prefix:\currentMPgraphicname}{}% \meta_end_graphic_group} %D One way of defining a stamp is: @@ -682,12 +682,12 @@ {\dodoubleempty\dostartMPenvironment} \def\dostartMPenvironment[#1][#2]#3\stopMPenvironment - {\edef\m_mp_option{#1} - \ifx\m_mp_option\s!reset + {\edef\m_meta_option{#1} + \ifx\m_meta_option\s!reset \resetMPenvironment % reset mp toks - \else\ifx\m_mp_option\v!global + \else\ifx\m_meta_option\v!global #3% % use in main doc too - \else\ifx\m_mp_option\!!plustoken + \else\ifx\m_meta_option\!!plustoken #3% % use in main doc too \fi\fi\fi \ctxlua{metapost.tex.set(\!!bs\detokenize{#3}\!!es)}} diff --git a/tex/context/base/mult-dim.mkvi b/tex/context/base/mult-dim.mkvi index 04d391fde..0889b411e 100644 --- a/tex/context/base/mult-dim.mkvi +++ b/tex/context/base/mult-dim.mkvi @@ -86,13 +86,13 @@ \installcorenamespace{dimensionvalue} -\setvalue{\??dimensionvalue\v!small }#macro#small#medium#big{\edef#macro{#small}} -\setvalue{\??dimensionvalue\v!medium }#macro#small#medium#big{\edef#macro{#medium}} -\setvalue{\??dimensionvalue\v!big }#macro#small#medium#big{\edef#macro{#big}} -\setvalue{\??dimensionvalue\s!unknown}#macro#small#medium#big{\let #macro\empty} +\setvalue{\??dimensionvalue\v!small }#value#macro#small#medium#big{\edef#macro{#small}} +\setvalue{\??dimensionvalue\v!medium }#value#macro#small#medium#big{\edef#macro{#medium}} +\setvalue{\??dimensionvalue\v!big }#value#macro#small#medium#big{\edef#macro{#big}} +\setvalue{\??dimensionvalue\s!unknown}#value#macro#small#medium#big{\edef#macro{#value}} \unexpanded\def\assignvalue#value% - {\csname\??dimensionvalue\ifcsname\??dimensionvalue#value\endcsname#value\else\s!unknown\fi\endcsname} + {\csname\??dimensionvalue\ifcsname\??dimensionvalue#value\endcsname#value\else\s!unknown\fi\endcsname{#value}} %D \macros %D {assignwidth} diff --git a/tex/context/base/mult-sys.mkiv b/tex/context/base/mult-sys.mkiv index 9f322a960..816a32d4f 100644 --- a/tex/context/base/mult-sys.mkiv +++ b/tex/context/base/mult-sys.mkiv @@ -439,10 +439,7 @@ \definesystemvariable {br} % sideBaR \definesystemvariable {bx} % BackendExport \definesystemvariable {cb} % CollectBox -\definesystemvariable {ch} % CHaracterspacing \definesystemvariable {ci} % CItaat -\definesystemvariable {ck} % Character Kerning -\definesystemvariable {cn} % CollumN \definesystemvariable {cm} % CheMical \definesystemvariable {co} % COmbinaties \definesystemvariable {cp} % CliP @@ -504,6 +501,7 @@ \definesystemvariable {ml} % MultilingualLabel \definesystemvariable {mm} % MultilingualMath \definesystemvariable {mt} % inline MaTh +\definesystemvariable {mt} % multi column (!!! double usage) \definesystemvariable {mo} % Math Options \definesystemvariable {mp} % MetaPost \definesystemvariable {nn} % structurenumbering @@ -517,7 +515,6 @@ \definesystemvariable {ox} % OffsetBox \definesystemvariable {pb} % PuBlication \definesystemvariable {pc} % PageComment -\definesystemvariable {pe} % PagEhandler \definesystemvariable {ph} % ParagrapH \definesystemvariable {pn} % PaginaNummer \definesystemvariable {pr} % PRogrammas @@ -540,7 +537,6 @@ \definesystemvariable {se} % SEctie \definesystemvariable {sh} % ShapeText \definesystemvariable {si} % SplIt -\definesystemvariable {sl} % SmalLer \definesystemvariable {sp} % SelecteerPapier \definesystemvariable {st} % STickers \definesystemvariable {sx} % Selector @@ -549,7 +545,6 @@ \definesystemvariable {te} % TEmplate \definesystemvariable {ti} % TabelInstellingen \definesystemvariable {tl} % TekstLijnen -\definesystemvariable {to} % TOlerance \definesystemvariable {tt} % TabulaTe \definesystemvariable {tx} % TeXtflow \definesystemvariable {ur} % URl @@ -560,6 +555,11 @@ \definesystemvariable {zc} % columns \definesystemvariable {zo} % otr +% still used but defined locally + +\definesystemvariable{cs} % CharacterSpacing +\definesystemvariable{ts} % TypeScript + %D Next we define some language independant one letter %D variables and keywords. We can actually make these %D system variables. diff --git a/tex/context/base/pack-rul.mkiv b/tex/context/base/pack-rul.mkiv index 8248ba67a..6980f0b9d 100644 --- a/tex/context/base/pack-rul.mkiv +++ b/tex/context/base/pack-rul.mkiv @@ -2383,11 +2383,7 @@ \setfalse\c_framed_text_location_none \csname\??framedtextlocation\framedtextparameter\c!location\endcsname \resetframedtextparameter\c!location - % removed 06/2001 - % \forgetparindent - % added 06/2001 [see demo-bbv] \pack_framed_text_check - % so far \setbox\b_framed_normal\vbox \startboxedcontent \hsize\localhsize diff --git a/tex/context/base/page-brk.mkiv b/tex/context/base/page-brk.mkiv index 244036bc9..f3bdddaed 100644 --- a/tex/context/base/page-brk.mkiv +++ b/tex/context/base/page-brk.mkiv @@ -48,31 +48,36 @@ \let\page_breaks_current_option \empty \let\page_breaks_current_options\empty +\installcorenamespace{pagebreakmethod} +\installcorenamespace{pagebreaks} + \def\page_breaks_handle#1% {\edef\page_breaks_current_options{#1}% handy for tracing \processcommacommand[\page_breaks_current_options]\page_breaks_handle_indeed} \def\page_breaks_handle_indeed#1% {\edef\page_breaks_current_option{#1}% can be used in handler - \ifcsname\??pe:\page_breaks_current_option\endcsname - \csname\??pe:\page_breaks_current_option\endcsname - \else\ifcsname\??pe::\page_breaks_current_option\endcsname - \expandafter\page_breaks_handle\csname\??pe::\page_breaks_current_option\endcsname + \ifcsname\??pagebreakmethod\page_breaks_current_option\endcsname + \csname\??pagebreakmethod\page_breaks_current_option\endcsname + \else\ifcsname\??pagebreaks\page_breaks_current_option\endcsname + \expandafter\page_breaks_handle\csname\??pagebreaks\page_breaks_current_option\endcsname \else - \csname\??pe:\s!unknown\endcsname + \csname\??pagebreakmethod\s!unknown\endcsname \fi\fi} \def\page_breaks_handle_direct#1% - {\csname\??pe:#1\endcsname} + {\csname\??pagebreakmethod#1\endcsname} + +\unexpanded\def\installpagebreakmethod#1#2% low level definer + {\setvalue{\??pagebreakmethod#1}{#2}} -\def\installpagebreakhandler#1#2% low level definer - {\setvalue{\??pe:#1}{#2}} +\let\installpagebreakhandler\installpagebreakmethod % will go \unexpanded\def\definepagebreak {\dodoubleargument\page_breaks_define} \def\page_breaks_define[#1][#2]% - {\setvalue{\??pe::#1}{#2}} + {\setvalue{\??pagebreaks#1}{#2}} \unexpanded\def\pagebreak {\dosingleempty\page_breaks_process} @@ -115,19 +120,19 @@ \def\disablepagebreaks % to be used grouped ! {\def\page_breaks_process[##1]{}} -\installpagebreakhandler \s!dummy +\installpagebreakmethod \s!dummy {\page_otr_flush_all_floats \gotonextpage \page_otr_insert_dummy_page} -\installpagebreakhandler \v!frame +\installpagebreakmethod \v!frame {\page \begingroup \showframe \page[\v!empty] \endgroup} -\installpagebreakhandler \s!unknown +\installpagebreakmethod \s!unknown {\doifinstringelse{+}\page_breaks_current_option {\page_otr_flush_all_floats \gotonextpage @@ -143,17 +148,17 @@ \fi}} {}}} -\installpagebreakhandler \s!default +\installpagebreakmethod \s!default {} % do nothing if empty -\installpagebreakhandler \v!reset +\installpagebreakmethod \v!reset {% better not: \global\pageornamentstate\zerocount \resetpagebreak} -\installpagebreakhandler \v!disable +\installpagebreakmethod \v!disable {\global\setfalse\c_page_breaks_enabled} -\installpagebreakhandler \v!yes +\installpagebreakmethod \v!yes {\ifconditional\c_page_breaks_enabled \page_otr_flush_all_floats \gotonextpage @@ -162,22 +167,22 @@ \fi \fi} -\installpagebreakhandler \v!makeup +\installpagebreakmethod \v!makeup {\ifconditional\c_page_breaks_enabled \page_otr_fill_and_eject_page \fi} -\installpagebreakhandler \v!blank +\installpagebreakmethod \v!blank {\ifcase\pageornamentstate \global\pageornamentstate\plusone \fi} -\installpagebreakhandler \v!no +\installpagebreakmethod \v!no {\ifconditional\c_page_breaks_enabled \dosomebreak\nobreak \fi} -\installpagebreakhandler \v!preference +\installpagebreakmethod \v!preference {\ifconditional\c_page_breaks_enabled \ifinsidecolumns % this will move to MUL \dosomebreak\goodbreak @@ -186,7 +191,7 @@ \fi \fi} -\installpagebreakhandler \v!bigpreference +\installpagebreakmethod \v!bigpreference {\ifconditional\c_page_breaks_enabled \ifinsidecolumns % this will move to MUL \dosomebreak\goodbreak @@ -195,25 +200,25 @@ \fi \fi} -% \installpagebreakhandler \v!empty {} % defined in page-txt.mkiv -% \installpagebreakhandler \v!header{} % defined in page-txt.mkiv -% \installpagebreakhandler \v!footer{} % defined in page-txt.mkiv -% \installpagebreakhandler \v!left {} % defined in page-txt.mkiv +% \installpagebreakmethod \v!empty {} % defined in page-txt.mkiv +% \installpagebreakmethod \v!header{} % defined in page-txt.mkiv +% \installpagebreakmethod \v!footer{} % defined in page-txt.mkiv +% \installpagebreakmethod \v!left {} % defined in page-txt.mkiv -\installpagebreakhandler \v!right +\installpagebreakmethod \v!right {\page_otr_flush_all_floats \gotonextpageX % will become \gotonextpage \doifbothsidesoverruled{}{}{\resetcurrentstructuremarkswithpage\page_otr_insert_dummy_page}} -\installpagebreakhandler \v!even +\installpagebreakmethod \v!even {\page \doifoddpageelse{\resetcurrentstructuremarkswithpage\page_otr_insert_dummy_page}\donothing} -\installpagebreakhandler \v!odd +\installpagebreakmethod \v!odd {\page \doifoddpageelse\donothing{\resetcurrentstructuremarkswithpage\page_otr_insert_dummy_page}} -\installpagebreakhandler \v!quadruple % not yet ok inside columnsets +\installpagebreakmethod \v!quadruple % not yet ok inside columnsets {\ifdoublesided \ifnum\numexpr\realpageno/4\relax=\numexpr\realpageno/2\relax\else \page_breaks_handle_direct\v!yes @@ -222,7 +227,7 @@ \fi \fi} -\installpagebreakhandler \v!last +\installpagebreakmethod \v!last {\page_otr_flush_all_floats \gotonextpageX % will become \gotonextpage \relax @@ -233,7 +238,7 @@ \page_otr_insert_dummy_page}% \filluparrangedpages} -\installpagebreakhandler \v!lastpage % handy for backpage preceded by empty pages +\installpagebreakmethod \v!lastpage % handy for backpage preceded by empty pages {\page_breaks_handle_direct\v!yes \ifdoublesided \page_breaks_handle_direct\v!left @@ -241,11 +246,14 @@ \page_breaks_handle_direct\v!empty \fi} -\installpagebreakhandler \v!start {\global\settrue \c_otr_shipout_enabled} -\installpagebreakhandler \v!stop {\global\setfalse\c_otr_shipout_enabled} +\installpagebreakmethod \v!start {\global\settrue \c_otr_shipout_enabled} +\installpagebreakmethod \v!stop {\global\setfalse\c_otr_shipout_enabled} % Column breaks. +\installcorenamespace{columnbreakmethod} +\installcorenamespace{columnbreaks} + \newtoks\everybeforecolumnbreak \newtoks\everyaftercolumnbreak @@ -258,25 +266,27 @@ \def\page_breaks_columns_handle_indeed#1% {\edef\page_breaks_columns_current_option{#1}% - \ifcsname\??cn:\OTRidentifier:\page_breaks_columns_current_option\endcsname - \csname\??cn:\OTRidentifier:\page_breaks_columns_current_option\endcsname - \else\ifcsname\??cn::\page_breaks_columns_current_option\endcsname - \expandafter\csname\page_breaks_columns_handle\??cn::\page_breaks_columns_current_option\endcsname + \ifcsname\??columnbreakmethod\OTRidentifier:\page_breaks_columns_current_option\endcsname + \csname\??columnbreakmethod\OTRidentifier:\page_breaks_columns_current_option\endcsname + \else\ifcsname\??columnbreaks\page_breaks_columns_current_option\endcsname + \expandafter\csname\page_breaks_columns_handle\??columnbreaks\page_breaks_columns_current_option\endcsname \else - \csname\??cn:\OTRidentifier:\s!unknown\endcsname + \csname\??columnbreakmethod\OTRidentifier:\s!unknown\endcsname \fi\fi} \def\page_breaks_columns_handle_direct#1% - {\csname\??cn:\OTRidentifier:#1\endcsname} + {\csname\??columnbreakmethod\OTRidentifier:#1\endcsname} + +\unexpanded\def\installcolumnbreakmethod#1#2#3% #1=otr-id #2=tag #3=action + {\setvalue{\??columnbreakmethod#1:#2}{#3}} -\def\installcolumnbreakhandler#1#2#3% #1=otr-id #2=tag #3=action - {\setvalue{\??cn:#1:#2}{#3}} +\let\installcolumnbreakhandler\installcolumnbreakmethod % will go \unexpanded\def\definecolumnbreak {\dodoubleargument\page_break_columns_define} \def\page_break_columns_define[#1][#2]% - {\setvalue{\??cn::#1}{#2}} + {\setvalue{\??columnbreaks#1}{#2}} \unexpanded\def\columnbreak {\dosingleempty\page_breaks_columns_process} diff --git a/tex/context/base/page-imp.mkiv b/tex/context/base/page-imp.mkiv index f38033b36..626d9042f 100644 --- a/tex/context/base/page-imp.mkiv +++ b/tex/context/base/page-imp.mkiv @@ -51,7 +51,7 @@ % \def\pagestoshipout{1,3,5} % \stoptypen -\installcorenamespace{layouthandler} +\installcorenamespace{shipoutmethod} \installcorenamespace{layoutarranger} \installcorenamespace{layoutarrangeoption} @@ -65,27 +65,29 @@ \setnewconstant\shipoutfinalizemethod\plusone % this will be default (we will have two finalizers) -\def\installpagehandler#1#2% % a handler takes one argument: something to be boxed - {\setgvalue{\??layouthandler#1}##1{#2{##1}}} % and shipped out (don't depend on the exact package) +\unexpanded\def\installshipoutmethod#1#2% % a handler takes one argument: something to be boxed + {\setgvalue{\??shipoutmethod#1}##1{#2{##1}}} % and shipped out (don't depend on the exact package) + +\let\installpagehandler\installshipoutmethod % will go \unexpanded\def\invokepagehandler#1% - {\expandcheckedcsname{\??layouthandler}{#1}\v!normal} + {\expandcheckedcsname{\??shipoutmethod}{#1}\v!normal} \def\page_shipouts_handle - {\csname\??layouthandler\ifcsname\??layouthandler\v_page_target_method\endcsname + {\csname\??shipoutmethod\ifcsname\??shipoutmethod\v_page_target_method\endcsname \v_page_target_method \else \v!none \fi\endcsname} -\installpagehandler\v!normal +\installshipoutmethod \v!normal {\ifarrangingpages \expandafter\page_shipouts_arrange \else \expandafter\page_shipouts_normal \fi} -\installpagehandler\v!none +\installshipoutmethod \v!none {\page_shipouts_ignore} \def\page_boxes_shipout#1% or: \page_shipouts_apply diff --git a/tex/context/base/page-ini.mkiv b/tex/context/base/page-ini.mkiv index 1550b1405..757302518 100644 --- a/tex/context/base/page-ini.mkiv +++ b/tex/context/base/page-ini.mkiv @@ -424,9 +424,7 @@ \box\pagebox \egroup \ifconditional\c_page_boxes_save_page_body \copy\b_page_boxes_saved_page_body \fi} -\appendtoks \restoreouterspacing \to \everybeforepagebody \appendtoks \restoreglobalbodyfont \to \everybeforepagebody -%appendtoks \restoreouterspacing \to \everybeforepagebody \ifdefined\nestednewbox \else \newbox\nestednextbox \fi % hm, still needed? diff --git a/tex/context/base/page-lay.mkiv b/tex/context/base/page-lay.mkiv index e7a4f49d2..525017954 100644 --- a/tex/context/base/page-lay.mkiv +++ b/tex/context/base/page-lay.mkiv @@ -566,8 +566,8 @@ \fi -\ifdefined\setups \else \unexpanded\def\setups[#1]{\setdefaultpenalties} \fi % still needed? -\ifdefined\docheckgridsnapping \else \let\docheckgridsnapping\relax \fi +\ifdefined\setups \else \unexpanded\def\setups[#1]{\setdefaultpenalties} \fi % still needed? +\ifdefined\synchronizegridsnapping \else \let\synchronizegridsnapping\relax \fi \let\p_page_layouts_width \empty \let\p_page_layouts_height\empty @@ -585,10 +585,10 @@ \global\backspace \layoutparameter\c!backspace \global\topspace \layoutparameter\c!topspace \page_layouts_set_dimensions - \docheckgridsnapping + \synchronizegridsnapping \doprocesslocalsetups{\layoutparameter\c!setups}% depends on gridsnapping ! - \simplesetupwhitespace - \simplesetupblank + \synchronizewhitespace + \synchronizeblank \setupinterlinespace[\v!reset]% \synchronizegloballinespecs \global\cutspace\layoutparameter\c!cutspace\relax \edef\p_page_layouts_width{\layoutparameter\c!width}% diff --git a/tex/context/base/page-mul.mkiv b/tex/context/base/page-mul.mkiv index df8d38ee6..0a0ba5be4 100644 --- a/tex/context/base/page-mul.mkiv +++ b/tex/context/base/page-mul.mkiv @@ -1614,17 +1614,12 @@ \stretchcolumnsfalse \inheritcolumnstrue \doifsomething\@@klalign{\expanded{\setupalign[\@@klalign]}}% - \nofcolumns=\@@kln - % - % probably more is needed, and how about nesting save's - % - \saveouterspacing - % + \nofcolumns\@@kln \edef\fixedcolumnheight{\@@klheight}% \edef\minbalancetoplines{\@@klntop}% \setuptolerance[\@@kltolerance]% %% \startcolumns \setupblank[\@@klblank]% - \ifdim\ctxparskip>\zeropoint\relax + \ifdim\s_spac_whitespace_parskip>\zeropoint\relax \setupwhitespace[\@@klblank]% \fi \unexpanded\def\stopcolumns @@ -1636,11 +1631,11 @@ \beginmulticolumns \fi \fi} - -\installcolumnbreakhandler {MUL} \v!preference + +\installcolumnbreakmethod {MUL} \v!preference {\goodbreak} -\installcolumnbreakhandler {MUL} \v!yes +\installcolumnbreakmethod {MUL} \v!yes {\par % todo: since {\testrulewidth\zeropoint\ruledvskip\textheight} % we misuse a \penalty-200 % side effect diff --git a/tex/context/base/page-run.mkiv b/tex/context/base/page-run.mkiv index da3a05986..72c02e4f8 100644 --- a/tex/context/base/page-run.mkiv +++ b/tex/context/base/page-run.mkiv @@ -236,7 +236,7 @@ function commands.showlayout(options) end \stopluacode -\gdef\doshowframe[#1][#2]% +\gdef\page_layouts_show_frame[#1][#2]% {\ifsecondargument \setupbackgrounds [\v!page] @@ -269,15 +269,15 @@ end \setupbackgrounds [\c!state=\v!repeat]} -\gdef\doshowsetups[#1]% +\gdef\page_layouts_show_setups[#1]% {\ctxcommand{showlayoutvariables("#1")}} -\gdef\doshowlayout[#1]% +\gdef\page_layouts_show_layout[#1]% {\ctxcommand{showlayout("#1")}} -\unexpanded\gdef\showframe {\dodoubleempty\doshowframe} -\unexpanded\gdef\showsetups{\dodoubleempty\doshowsetups} -\unexpanded\gdef\showlayout{\dodoubleempty\doshowlayout} +\unexpanded\gdef\showframe {\dodoubleempty\page_layouts_show_frame } +\unexpanded\gdef\showsetups{\dosingleempty\page_layouts_show_setups} +\unexpanded\gdef\showlayout{\dosingleempty\page_layouts_show_layout} \unexpanded\gdef\showmargins {\starttabulate diff --git a/tex/context/base/page-set.mkiv b/tex/context/base/page-set.mkiv index e46c94006..45f6f7660 100644 --- a/tex/context/base/page-set.mkiv +++ b/tex/context/base/page-set.mkiv @@ -544,8 +544,6 @@ \egroup \fi} -\definesystemvariable {mc} -\definesystemvariable {mt} \definesystemconstant {colset} \definetwopasslist\s!colset @@ -615,7 +613,7 @@ \def\showbreaks {\let\OTRSETcolumnseparator\doOTRSETcolumnseparator} -% \installcolumnbreakhandler {SET} \v!ja +% \installcolumnbreakmethod {SET} \v!ja % {% hmmm: % \ifhmode % \bgroup @@ -630,14 +628,14 @@ % \page_otr_eject_page % \OTRSETsynchronizehsize} % no \OTRSETsethsize, can be mid smaller (like tabulate) % -% \installcolumnbreakhandler {SET} \v!forceer +% \installcolumnbreakmethod {SET} \v!forceer % {\OTRSETgotocolumn[\v!forceer]} -% \installcolumnbreakhandler {SET} \v!eerste +% \installcolumnbreakmethod {SET} \v!eerste % {\OTRSETgotocolumn[\v!eerste]} -% \installcolumnbreakhandler {SET} \v!laatste +% \installcolumnbreakmethod {SET} \v!laatste % {\OTRSETgotocolumn[\v!laatste]} % -% \installcolumnbreakhandler {SET} \v!pagina +% \installcolumnbreakmethod {SET} \v!pagina % {\simplepagebreak % \flushnotes \executepagebreakhandler\v!ja % \ifnum\mofcolumns>\plusone % \OTRSETgotocolumn[\v!laatste,\v!forceer]% @@ -653,7 +651,7 @@ \egroup \fi} -\installcolumnbreakhandler {SET} \v!local +\installcolumnbreakmethod {SET} \v!local {\OTRSETcolumnhbreak \page_otr_flush_all_floats \page_otr_eject_page @@ -667,7 +665,7 @@ % stay there (basically such a gap is a small empty page % then). -\installcolumnbreakhandler {SET} \v!yes +\installcolumnbreakmethod {SET} \v!yes {\OTRSETcolumnhbreak \edef\savedmofcolumns{\the\mofcolumns}% \edef\savedrealpageno{\the\realpageno}% @@ -685,10 +683,10 @@ \fi}% \OTRSETsynchronizehsize} -\installcolumnbreakhandler {SET} \s!unknown +\installcolumnbreakmethod {SET} \s!unknown {\expanded{\OTRSETgotocolumn[\@@columnspecification]}} -\installcolumnbreakhandler {SET} \v!page +\installcolumnbreakmethod {SET} \v!page {\page_otr_fill_and_eject_page \OTRSETgotonextpage} @@ -2051,9 +2049,9 @@ \setbox\scratchbox\vbox % kan beter ! {\forgetall \iftopofinsert - \ifdim\OTRSETtopoffset=\zeropoint - \moveongrid[\v!top] - \fi + %\ifdim\OTRSETtopoffset=\zeropoint + % \moveongrid[\v!top] + %\fi \else \betweenfloatblanko % inserts can't look back \fi diff --git a/tex/context/base/page-sid.mkiv b/tex/context/base/page-sid.mkiv index 2ff15bb37..f95cc0bb3 100644 --- a/tex/context/base/page-sid.mkiv +++ b/tex/context/base/page-sid.mkiv @@ -649,7 +649,7 @@ \else \page_sides_check_floats_reset \fi - \parskip\ctxparskip} + \parskip\s_spac_whitespace_parskip} \let\page_sides_check_floats\page_sides_check_floats_indeed diff --git a/tex/context/base/page-txt.mkvi b/tex/context/base/page-txt.mkvi index d2d996dea..10192a028 100644 --- a/tex/context/base/page-txt.mkvi +++ b/tex/context/base/page-txt.mkvi @@ -659,17 +659,17 @@ %D A few more page breakers: -\installpagebreakhandler \v!empty +\installpagebreakmethod \v!empty {\page_otr_flush_all_floats \gotonextpage \doifnot{\namedlayoutelementparameter\v!header\c!state}\v!stop{\setuplayoutelement[\v!header][\c!state=\v!empty]}% \doifnot{\namedlayoutelementparameter\v!footer\c!state}\v!stop{\setuplayoutelement[\v!footer][\c!state=\v!empty]}% \page_otr_insert_dummy_page} -\installpagebreakhandler \v!header +\installpagebreakmethod \v!header {\doifnot{\namedlayoutelementparameter\v!header\c!state}\v!stop{\setuplayoutelement[\c!state=\v!empty]}} -\installpagebreakhandler \v!footer +\installpagebreakmethod \v!footer {\doifnot{\namedlayoutelementparameter\v!footer\c!state}\v!stop{\setuplayoutelement[\c!state=\v!empty]}} %D While the header and footer lines are moved away from the diff --git a/tex/context/base/s-map-10.mkiv b/tex/context/base/s-map-10.mkiv index 169a0d4b3..8f6bff5bd 100644 --- a/tex/context/base/s-map-10.mkiv +++ b/tex/context/base/s-map-10.mkiv @@ -443,7 +443,7 @@ \page } -\installpagebreakhandler{last}{} +\installpagebreakmethod{last}{} %%% `logos' %%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/tex/context/base/scrn-but.mkvi b/tex/context/base/scrn-but.mkvi index 24a0f8bcf..557615738 100644 --- a/tex/context/base/scrn-but.mkvi +++ b/tex/context/base/scrn-but.mkvi @@ -600,19 +600,19 @@ \newcount \c_scrn_menu_position \newconstant \c_scrn_menu_page_mode % 0=notfound 1=found 2=currentpage \newconditional\c_scrn_menu_positioning -\newtoks \t_scrn_menu_mp_data +\newtoks \t_scrn_menu_meta_data -\def\scrn_menu_button_mp_template +\def\scrn_menu_button_meta_template {\askedinteractionmenulocation _menu_button(% \number\c_scrn_menu_position,% \number\c_scrn_menu_page_mode,% \MPpos{\askedinteractionmenulocation:\number\c_scrn_menu_position}% );} -\def\MPmenubuttons#1{\the\t_scrn_menu_mp_data} +\def\MPmenubuttons#1{\the\t_scrn_menu_meta_data} \appendtoks - \global\t_scrn_menu_mp_data\emptytoks + \global\t_scrn_menu_meta_data\emptytoks \to \everyshipout \def\scrn_menu_whole_position % cannot happen in previous due to align @@ -695,8 +695,8 @@ {\c_scrn_menu_page_mode\ifnum\currentreferencerealpage=\realpageno\plusone\else\plustwo\fi}% {\c_scrn_menu_page_mode\plustwo}% \doglobal\appendetoks - \scrn_menu_button_mp_template - \to \t_scrn_menu_mp_data + \scrn_menu_button_meta_template + \to \t_scrn_menu_meta_data \hpos {\askedinteractionmenulocation:\number\c_scrn_menu_position}% {\scrn_button_make diff --git a/tex/context/base/spac-def.mkiv b/tex/context/base/spac-def.mkiv index ae08f4d6e..0444fa9ef 100644 --- a/tex/context/base/spac-def.mkiv +++ b/tex/context/base/spac-def.mkiv @@ -17,35 +17,28 @@ \unprotect -\def\forgeteverypar +\unexpanded\def\forgeteverypar {\everypar{\the\neverypar}} % worth trying: % -% \def\forgeteverypar +% \unexpanded\def\forgeteverypar % {\everypar\neverypar} -\def\forgetparindent - {\forgeteverypar - \settrue\c_spac_indentation_indent_first % recently added - \ctxparindent\zeropoint - \parindent\zeropoint - \let\currentindentation\v!none} - -\def\forgetparskip - {\ctxparskip\zeropoint +\unexpanded\def\forgetparskip + {\s_spac_whitespace_parskip\zeropoint \parskip\zeropoint - \let\currentwhitespace\v!none} + \let\v_spac_whitespace_current\v!none} -\def\forgetbothskips +\unexpanded\def\forgetbothskips {\leftskip\zeropoint \rightskip\zeropoint \relax} -\def\forgethorizontalstretch +\unexpanded\def\forgethorizontalstretch {\emergencystretch\zeropoint} -\def\forgetverticalstretch +\unexpanded\def\forgetverticalstretch {\spacing\plusone} \newif\ifforgotten % rather good signal for inner @@ -69,8 +62,8 @@ \appendtoks \settopskip \to \everybodyfont % factors set in \forgetverticalstretch \appendtoks \setmaxdepth \to \everybodyfont % factors set in \forgetverticalstretch \appendtoks \synchronizeindenting \to \everybodyfont -\appendtoks \simplesetupblank \to \everybodyfont -\appendtoks \simplesetupwhitespace \to \everybodyfont +\appendtoks \synchronizeblank \to \everybodyfont +\appendtoks \synchronizewhitespace \to \everybodyfont \appendtoks \synchronizespacecodes \to \everybodyfont % not needed, frozen factors \appendtoks \setrelativeinterlinespace \to \everybodyfont diff --git a/tex/context/base/spac-hor.mkiv b/tex/context/base/spac-hor.mkiv index 4ef39b67a..1e2f07465 100644 --- a/tex/context/base/spac-hor.mkiv +++ b/tex/context/base/spac-hor.mkiv @@ -17,11 +17,10 @@ \registerctxluafile{spac-hor}{1.001} -\let\currentindentation\empty % amount/keyword -\let\currentindenting \empty % method +\let\v_spac_indentation_current\empty % amount/keyword -\newdimen \ctxparindent -\parindent\ctxparindent % for the show +\newdimen \d_spac_indentation_par +\parindent\d_spac_indentation_par % for the show \newconditional\c_spac_indentation_indent_first \settrue\c_spac_indentation_indent_first \newconstant \c_spac_indentation_toggle_state @@ -29,29 +28,31 @@ %D After a blank or comparable situation (left side floats) we %D need to check if the next paragraph has to be indented. -\def\presetindentation +\unexpanded\def\presetindentation {\doifoutervmode{\ifconditional\c_spac_indentation_indent_first\else\spac_indentation_variant_no\fi}} \unexpanded\def\setupindenting {\doifnextoptionalelse\spac_indentation_setup_options\spac_indentation_setup_size} \def\spac_indentation_setup_size - {\assigndimension\currentindentation\ctxparindent{1\emwidth}{1.5\emwidth}{2\emwidth}} + {\assigndimension\v_spac_indentation_current\d_spac_indentation_par{1\emwidth}{1.5\emwidth}{2\emwidth}} \let\synchronizeindenting\spac_indentation_setup_size +\let\m_spac_indentation_options\empty + \def\spac_indentation_setup_options[#1]% - {\edef\currentindenting{#1}% comma separated list - \ifx\currentindenting\empty \else + {\edef\m_spac_indentation_options{#1}% comma separated list + \ifx\m_spac_indentation_options\empty \else \spac_indentation_setup_indeed \fi} \def\spac_indentation_setup_indeed {% not here: \settrue\c_spac_indentation_indent_first - % not here: \parindent\ctxparindent + % not here: \parindent\d_spac_indentation_par % not here: \c_spac_indentation_toggle_state\zerocount - \processcommacommand[\currentindenting]\spac_indentation_apply_step_one % catch small, medium, etc - \processcommacommand[\currentindenting]\spac_indentation_apply_step_two % catch rest + \processcommacommand[\m_spac_indentation_options]\spac_indentation_apply_step_one % catch small, medium, etc + \processcommacommand[\m_spac_indentation_options]\spac_indentation_apply_step_two % catch rest \ifzeropt\parindent\else \doifemptytoks\everypar\spac_indentation_set_everypar \fi @@ -64,17 +65,17 @@ {\everypar{\checkindentation}} \def\spac_indentation_apply_step_one#1% - {\ifcsname\??indenting#1\endcsname + {\ifcsname\??indentingmethod#1\endcsname % case two \else - \edef\currentindentation{#1}% single entry in list - \let\normalindentation\currentindentation + \edef\v_spac_indentation_current{#1}% single entry in list + \let\normalindentation\v_spac_indentation_current \spac_indentation_setup_size \fi} \def\spac_indentation_apply_step_two#1% - {\ifcsname\??indenting#1\endcsname - \csname\??indenting#1\endcsname + {\ifcsname\??indentingmethod#1\endcsname + \csname\??indentingmethod#1\endcsname \else % case one \fi} @@ -84,47 +85,47 @@ % use \noindentation to suppress next indentation -\installcorenamespace{indenting} +\installcorenamespace{indentingmethod} -\unexpanded\def\defineindentingmethod[#1]#2% - {\setvalue{\??indenting#1}{#2}} +\unexpanded\def\installindentingmethod#1#2% + {\setvalue{\??indentingmethod#1}{#2}} -\defineindentingmethod [\v!no] {\parindent\zeropoint}% was: \ctxparindent\noindent} -\defineindentingmethod [\v!not] {\parindent\zeropoint}% was: \ctxparindent\noindent} +\installindentingmethod \v!no {\parindent\zeropoint} +\installindentingmethod \v!not {\parindent\zeropoint} -\defineindentingmethod [\v!first] {\settrue\c_spac_indentation_indent_first} -\defineindentingmethod [\v!next] {\setfalse\c_spac_indentation_indent_first} +\installindentingmethod \v!first {\settrue\c_spac_indentation_indent_first} +\installindentingmethod \v!next {\setfalse\c_spac_indentation_indent_first} -\defineindentingmethod [\v!yes] {\parindent\ctxparindent\relax} % no \indent ! -\defineindentingmethod [\v!always] {\parindent\ctxparindent\relax} % no \indent ! +\installindentingmethod \v!yes {\parindent\d_spac_indentation_par\relax} % not \indent ! +\installindentingmethod \v!always{\parindent\d_spac_indentation_par\relax} % not \indent ! -\defineindentingmethod [\v!never] {\parindent\zeropoint\relax % no \indent ! - \c_spac_indentation_toggle_state\zerocount} +\installindentingmethod \v!never {\parindent\zeropoint\relax % no \indent ! + \c_spac_indentation_toggle_state\zerocount} -\defineindentingmethod [\v!odd] {\c_spac_indentation_toggle_state\plusone} -\defineindentingmethod [\v!even] {\c_spac_indentation_toggle_state\plustwo} +\installindentingmethod \v!odd {\c_spac_indentation_toggle_state\plusone} +\installindentingmethod \v!even {\c_spac_indentation_toggle_state\plustwo} -\defineindentingmethod [\v!normal] {\ifx\normalindentation\empty\else - \let\currentindentation\normalindentation - \simplesetupindenting - \fi} +\installindentingmethod \v!normal{\ifx\normalindentation\empty\else + \let\v_spac_indentation_current\normalindentation + \simplesetupindenting + \fi} -\defineindentingmethod [\v!reset] {\settrue\c_spac_indentation_indent_first - \parindent\zeropoint - \c_spac_indentation_toggle_state\zerocount} +\installindentingmethod \v!reset {\settrue\c_spac_indentation_indent_first + \parindent\zeropoint + \c_spac_indentation_toggle_state\zerocount} -\defineindentingmethod [\v!toggle] {\parindent\ifdim\parindent=\zeropoint - \ctxparindent - \else - \zeropoint - \fi\relax} +\installindentingmethod \v!toggle{\parindent\ifdim\parindent=\zeropoint + \d_spac_indentation_par + \else + \zeropoint + \fi\relax} \unexpanded\def\noindenting{\indenting[\v!no, \v!next ]} \unexpanded\def\doindenting{\indenting[\v!yes,\v!first]} %D Here come the handlers (still rather messy ... we need states). -\newif\ifindentation \indentationtrue % documenteren, naar buiten +\newif\ifindentation \indentationtrue % will become a mode \let\checkindentation\relax @@ -277,7 +278,17 @@ %D \input tufte \startformula a = b \stopformula %D \stoptyping -\def\softbreak +% maybe an everyforgetparindent + +\unexpanded\def\forgetparindent + {\settrue\c_spac_indentation_indent_first % recently added + \d_spac_indentation_par\zeropoint + \parindent\zeropoint + \let\v_spac_indentation_current\v!none} + +%D Helper: + +\unexpanded\def\softbreak {\relax\ifhmode\hskip\parfillskip\break\fi} %D \macros @@ -289,7 +300,7 @@ %D Hm ... todo: -\installcorenamespace{spacecodemethods} +\installcorenamespace{spacecodemethod} \sfcode`\)=\zerocount \sfcode`\'=\zerocount @@ -309,18 +320,18 @@ \unexpanded\def\newfrenchspacing{\spac_spacecodes_set_fixed{1050}} \unexpanded\def\nonfrenchspacing{\spac_spacecodes_set_stretch} -\unexpanded\def\definespacingmethod[#1]#2{\setvalue{\??spacecodemethods#1}{#2}} +\unexpanded\def\installspacingmethod#1#2{\setvalue{\??spacecodemethod#1}{#2}} -\definespacingmethod[\empty] {} % keep values -\definespacingmethod[\v!fixed] {\frenchspacing } % equal spaces everywhere -\definespacingmethod[\v!packed]{\newfrenchspacing} % slighly more after punctuation -\definespacingmethod[\v!broad ]{\nonfrenchspacing} % more depending on what punctuation +\installspacingmethod \empty {} % keep values +\installspacingmethod \v!fixed {\frenchspacing } % equal spaces everywhere +\installspacingmethod \v!packed {\newfrenchspacing} % slighly more after punctuation +\installspacingmethod \v!broad {\nonfrenchspacing} % more depending on what punctuation \unexpanded\def\setupspacing {\doifnextoptionalelse\spac_spacecodes_setup_yes\spac_spacecodes_setup_nop} \def\spac_spacecodes_setup_yes[#1]% - {\csname\??spacecodemethods#1\endcsname + {\csname\??spacecodemethod#1\endcsname \updateraggedskips} % not needed, as sf codes are static \def\spac_spacecodes_setup_nop @@ -370,9 +381,9 @@ \letcatcodecommand \ctxcatcodes \tildeasciicode \nonbreakablespace % overloaded later -\def\space { } -\def\removelastspace{\ifhmode\unskip\fi} -\def\nospace {\removelastspace\ignorespaces} + \def\space { } +\unexpanded\def\removelastspace{\ifhmode\unskip\fi} +\unexpanded\def\nospace {\removelastspace\ignorespaces} \ifdefined\softhyphen \else \let\softhyphen\- \fi @@ -389,7 +400,7 @@ {\setbox\scratchbox\hbox{\mathortext{0}{0}}% \hskip\wd\scratchbox\relax} -\def\fixedspaces +\unexpanded\def\fixedspaces {\letcatcodecommand \ctxcatcodes \tildeasciicode \fixedspace} \appendtoks @@ -406,7 +417,7 @@ {\ifnum\lastnodetype=\gluenodecode \unskip \expandafter\spac_helpers_remove_unwantedspace \fi} - + % \startbuffer % \startlines \tt \fixedspaces % 0~1~~2~~~3~~~~4~~~~~5 @@ -431,7 +442,7 @@ %D A couple of plain macros: -\ifx\thinspace\undefined +\ifdefined\thinspace \else \def\thinspace {\kern .16667\emwidth} \def\negthinspace{\kern-.16667\emwidth} @@ -439,7 +450,7 @@ \fi -\ifx\quad\undefined +\ifdefined\quad \else \def\enskip{\hskip.5\emwidth} \def\quad {\hskip \emwidth} @@ -455,242 +466,210 @@ % Bovendien definieren we enkele extra \fill's: -\def\hfilll{\hskip\zeropoint\!!plus1filll\relax} -\def\vfilll{\vskip\zeropoint\!!plus1filll\relax} - -% De onderstaande hulpmacro's moeten nog eens instelbaar worden -% gemaakt. +\unexpanded\def\hfilll{\hskip\zeropoint\!!plus1filll\relax} +\unexpanded\def\vfilll{\vskip\zeropoint\!!plus1filll\relax} -\def\tfskipsize{1em\relax} -\def\tfkernsize{1ex\relax} +\unexpanded\def\tfskip {\begingroup\tf\hskip\emwidth\endgroup} +\unexpanded\def\dotfskip#1{\begingroup\tf\hskip #1\endgroup} % used elsewhere -\def\tfskip{\dotfskip\tfskipsize} -\def\tfkern{\dotfkern\tfkernsize} - -\def\dotfskip#1{{\tf\hskip#1}} -\def\dotfkern#1{{\tf\kern #1}} - % needs a proper \definenarrower or installnarrower - -\newskip\ctxleftskip -\newskip\ctxrightskip -\newskip\ctxmidskip - -% \def\dosinglenarrower#1% -% {\processaction -% [#1] -% [ \v!left=>\global\advance\ctxleftskip \@@slleft, -% \v!middle=>\global\advance\ctxmidskip \@@slmiddle, -% \v!right=>\global\advance\ctxrightskip \@@slright, -% \v!reset=>\global\ctxleftskip \zeropoint -% \global\ctxmidskip \zeropoint -% \global\ctxrightskip\zeropoint, -% \v!none=>, -% \s!unknown=>\global\advance\ctxmidskip \commalistelement]} - -\def\donarrower[#1]% hm, can be dorepeat directly - {\dorepeatwithcommand[#1]\donarrowermethod} - -\unexpanded\def\definenarrowermethod[#1]#2% - {\setvalue{\??sl:#1}{#2}} - -\def\donarrowermethod#1% - {\ifcsname\??sl:#1\endcsname\csname\??sl:#1\endcsname\else\global\advance\ctxmidskip#1\relax\fi} - -\definenarrowermethod[\v!left ]{\global\advance\ctxleftskip \@@slleft \relax} -\definenarrowermethod[\v!middle ]{\global\advance\ctxmidskip \@@slmiddle\relax} -\definenarrowermethod[\v!right ]{\global\advance\ctxrightskip \@@slright \relax} -\definenarrowermethod[-\v!left ]{\global\advance\ctxleftskip -\@@slleft \relax} -\definenarrowermethod[-\v!middle]{\global\advance\ctxmidskip -\@@slmiddle\relax} -\definenarrowermethod[-\v!right ]{\global\advance\ctxrightskip-\@@slright \relax} -\definenarrowermethod[\v!reset ]{\global\ctxleftskip \zeropoint - \global\ctxmidskip \zeropoint - \global\ctxrightskip\zeropoint\relax} -\definenarrowermethod[\v!none ]{} - -% todo: definenarrower -% -% \definecomplexorsimple\startnarrower -% -% \def\simplestartnarrower -% {\startnarrower[\v!middle]} -% -% \def\complexstartnarrower[#1]% -% {\@@slbefore % was hard coded \par -% \bgroup -% \global\ctxleftskip \zeropoint -% \global\ctxrightskip\zeropoint -% \global\ctxmidskip \zeropoint -% \processcommalistwithparameters[#1]\donarrower -% \advance\leftskip \dimexpr\ctxleftskip +\ctxmidskip\relax -% \advance\rightskip \dimexpr\ctxrightskip+\ctxmidskip\relax -% \seteffectivehsize} -% -% \unexpanded\def\stopnarrower -% {\@@slafter % was hard coded \par / needed, else skips forgotten -% \egroup} % -% \unexpanded\def\setupnarrower -% {\dodoubleargument\getparameters[\??sl]} +% maybe we should hash the analysis -%D Contrary to \MKII\ we can now define classes of narrower (generalized -%D by Wolfgang). This environment will be enhanced for bidi. +\installcorenamespace{narrower} +\installcorenamespace{narrowermethod} -\def\narrowerparameter #1{\csname\donarrowerparameter{\??sl\@@narrower}#1\endcsname} -\def\donarrowerparameter #1#2{\ifcsname#1#2\endcsname#1#2\else\expandafter\donarrowerparentparameter\csname#1\s!parent\endcsname#2\fi} -\def\donarrowerparentparameter#1#2{\ifx#1\relax\s!empty\else\donarrowerparameter#1#2\fi} +\newskip\s_spac_narrower_left +\newskip\s_spac_narrower_right +\newskip\s_spac_narrower_mid -\getparameters - [\??sl] +\installcommandhandler \??narrower {narrower} \??narrower + +\setupnarrower [\c!before=\endgraf, \c!after=\endgraf, - \c!left=1.5em, - \c!right=1.5em, - \c!middle=1.5em] - -\unexpanded\def\definenarrower - {\dodoubleempty\dodefinenarrower} - -\def\dodefinenarrower[#1][#2]% - {\getparameters[\??sl#1][\s!parent=\??sl,#2]% - \unexpanded\setvalue{\e!start#1}{\dodoubleempty\dostartnarrower[#1]}% - \unexpanded\setvalue{\e!stop #1}{\dostopnarrower}} - -\unexpanded\def\setupnarrower - {\dodoubleempty\dosetupnarrower} - -\def\dosetupnarrower[#1][#2]% - {\doifelsenothing{#2} - {\getparameters[\??sl][#1]} - {\def\docommand##1{\getparameters[\??sl##1][#2]}% - \processcommacommand[#1]\docommand}} - -\definenarrowermethod[\v!left ]{\global\advance\ctxleftskip \narrowerparameter\c!left \relax} -\definenarrowermethod[\v!middle ]{\global\advance\ctxmidskip \narrowerparameter\c!middle\relax} -\definenarrowermethod[\v!right ]{\global\advance\ctxrightskip \narrowerparameter\c!right \relax} -\definenarrowermethod[-\v!left ]{\global\advance\ctxleftskip -\narrowerparameter\c!left \relax} -\definenarrowermethod[-\v!middle]{\global\advance\ctxmidskip -\narrowerparameter\c!middle\relax} -\definenarrowermethod[-\v!right ]{\global\advance\ctxrightskip-\narrowerparameter\c!right \relax} -\definenarrowermethod[\v!reset ]{\global\ctxleftskip \zeropoint - \global\ctxmidskip \zeropoint - \global\ctxrightskip\zeropoint\relax} -\definenarrowermethod[\v!none ]{} - -\def\dostartnarrower[#1][#2]% - {\bgroup - \ifsecondargument % \doifsomethingelse{#2}? - \dodostartnarrower[#1][#2]% + \c!left=1.5\emwidth, + \c!right=1.5\emwidth, + \c!middle=1.5\emwidth, + \c!default=\v!middle] + +\appendtoks + \setuevalue{\e!start\currentnarrower}{\spac_narrower_start{\currentnarrower}}% + \setuevalue{\e!stop \currentnarrower}{\spac_narrower_stop}% +\to \everydefinenarrower + +\unexpanded\def\installnarrowermethod#1#2% + {\setvalue{\??narrowermethod#1}{#2}} + +\unexpanded\def\spac_narrower_method_analyze#1% + {\ifcsname\??narrowermethod#1\endcsname + \csname\??narrowermethod#1\endcsname + \else + \global\advance\s_spac_narrower_mid#1\relax + \fi} + +\def\spac_narrower_initialize[#1]% hm, can be dorepeat directly + {\dorepeatwithcommand[#1]\spac_narrower_method_analyze} + +\installnarrowermethod \v!left {\global\advance\s_spac_narrower_left \narrowerparameter\c!left \relax} +\installnarrowermethod \v!middle{\global\advance\s_spac_narrower_mid \narrowerparameter\c!middle\relax} +\installnarrowermethod \v!right {\global\advance\s_spac_narrower_right \narrowerparameter\c!right \relax} +\installnarrowermethod-\v!left {\global\advance\s_spac_narrower_left -\narrowerparameter\c!left \relax} +\installnarrowermethod-\v!middle{\global\advance\s_spac_narrower_mid -\narrowerparameter\c!middle\relax} +\installnarrowermethod-\v!right {\global\advance\s_spac_narrower_right-\narrowerparameter\c!right \relax} +\installnarrowermethod \v!reset {\global \s_spac_narrower_left \zeropoint + \global \s_spac_narrower_mid \zeropoint + \global \s_spac_narrower_right \zeropoint\relax} +\installnarrowermethod\v!none {} + +\unexpanded\def\spac_narrower_start#1% + {\begingroup + \edef\currentnarrower{#1}% + \dosingleempty\spac_narrower_start_indeed} + +\unexpanded\def\spac_narrower_start_indeed[#1]% + {\iffirstargument + \spac_narrower_start_apply{#1}% \else - \dodostartnarrower[#1][\v!middle]% + \spac_narrower_start_apply{\narrowerparameter\v!default}% \fi} -\def\dodostartnarrower[#1][#2]% - {\edef\@@narrower{#1}% - \narrowerparameter\c!before - \global\ctxleftskip \zeropoint - \global\ctxrightskip\zeropoint - \global\ctxmidskip \zeropoint - \processcommalistwithparameters[#2]\donarrower - \advance\leftskip \dimexpr\ctxleftskip +\ctxmidskip\relax - \advance\rightskip\dimexpr\ctxrightskip+\ctxmidskip\relax +\def\spac_narrower_start_apply#1% + {\narrowerparameter\c!before + \global\s_spac_narrower_left \zeropoint + \global\s_spac_narrower_right\zeropoint + \global\s_spac_narrower_mid \zeropoint + \processcommalistwithparameters[#1]\spac_narrower_initialize + \advance\leftskip \dimexpr\s_spac_narrower_left +\s_spac_narrower_mid\relax + \advance\rightskip\dimexpr\s_spac_narrower_right+\s_spac_narrower_mid\relax \seteffectivehsize} -\def\dostopnarrower +\unexpanded\def\spac_narrower_stop {\narrowerparameter\c!after - \egroup} + \endgroup} -\def\v!narrower{narrower} +\unexpanded\def\startnarrower + {\dosingleempty\spac_narrower_start_basic} -\definenarrower[\v!narrower] - -\newdimen\@@effectivehsize \def\effectivehsize {\hsize} -\newdimen\@@effectiveleftskip \def\effectiveleftskip {\leftskip} -\newdimen\@@effectiverightskip \def\effectiverightskip{\rightskip} +\unexpanded\def\spac_narrower_start_basic[#1]% + {\begingroup + \let\currentnarrower\empty + \iffirstargument + \spac_narrower_start_apply{#1}% + \else + \spac_narrower_start_apply{\narrowerparameter\v!default}% + \fi} + +\let\stopnarrower\spac_narrower_stop + +\unexpanded\def\startnarrow % current how + {\begingroup + \dodoubleempty\spac_narrower_start_named} + +\def\spac_narrower_start_named[#1][#2]% + {\edef\currentnarrower{#1}% + \ifsecondargument + \spac_narrower_start_apply{#2}% + \else + \spac_narrower_start_apply{\narrowerparameter\v!default}% + \fi} + +\let\stopnarrow\spac_narrower_stop -\def\seteffectivehsize +% \def\v!narrower{narrower} +% \definenarrower[\v!narrower] + +\newdimen\d_spac_effective_hsize \def\effectivehsize {\hsize} +\newdimen\d_spac_effective_leftskip \def\effectiveleftskip {\leftskip} +\newdimen\d_spac_effective_rightskip \def\effectiverightskip{\rightskip} + +\unexpanded\def\seteffectivehsize {\setlocalhsize - \@@effectivehsize \localhsize - \@@effectiveleftskip \leftskip - \@@effectiverightskip \rightskip - \let\effectivehsize \@@effectivehsize - \let\effectiveleftskip \@@effectiveleftskip - \let\effectiverightskip\@@effectiverightskip} + \d_spac_effective_hsize \localhsize + \d_spac_effective_leftskip \leftskip + \d_spac_effective_rightskip\rightskip + \let\effectivehsize \d_spac_effective_hsize + \let\effectiveleftskip \d_spac_effective_leftskip + \let\effectiverightskip\d_spac_effective_rightskip} + +\installcorenamespace{skipadaptionleft} +\installcorenamespace{skipadaptionright} \newskip\leftskipadaption \newskip\rightskipadaption -\setvalue{@lsa@\v!standard}{\ifdim\ctxparindent=\zeropoint\@@slleft\else\ctxparindent\fi} -\setvalue{@lsa@\v!yes }{\ifdim\ctxparindent=\zeropoint\@@slleft\else\ctxparindent\fi} -\letvalue{@lsa@\v!no }\zeropoint -\letvalue{@lsa@\empty }\zeropoint -\setvalue{@rsa@\v!standard}{\@@slright} -\setvalue{@rsa@\v!yes }{\@@slright} -\letvalue{@rsa@\v!no }\zeropoint -\letvalue{@rsa@\empty }\zeropoint +\setvalue{\??skipadaptionleft \v!standard}{\ifdim\d_spac_indentation_par=\zeropoint\narrowerparameter\c!left\else\d_spac_indentation_par\fi} +\setvalue{\??skipadaptionleft \v!yes }{\ifdim\d_spac_indentation_par=\zeropoint\narrowerparameter\c!left\else\d_spac_indentation_par\fi} +\letvalue{\??skipadaptionleft \v!no }\zeropoint +\letvalue{\??skipadaptionleft \empty }\zeropoint +\setvalue{\??skipadaptionright\v!standard}{\narrowerparameter\c!right} +\setvalue{\??skipadaptionright\v!yes }{\narrowerparameter\c!right} +\letvalue{\??skipadaptionright\v!no }\zeropoint +\letvalue{\??skipadaptionright\empty }\zeropoint -\def\dosetleftskipadaption #1{\leftskipadaption \ifcsname @lsa@#1\endcsname\csname @lsa@#1\endcsname\else#1\fi\relax} -\def\dosetrightskipadaption#1{\rightskipadaption\ifcsname @rsa@#1\endcsname\csname @rsa@#1\endcsname\else#1\fi\relax} +\unexpanded\def\dosetleftskipadaption #1{\leftskipadaption \ifcsname\??skipadaptionleft #1\endcsname\csname\??skipadaptionleft #1\endcsname\else#1\fi\relax} +\unexpanded\def\dosetrightskipadaption#1{\rightskipadaption\ifcsname\??skipadaptionright#1\endcsname\csname\??skipadaptionright#1\endcsname\else#1\fi\relax} -\def\doadaptleftskip #1{\dosetleftskipadaption {#1}\advance\leftskip \leftskipadaption } -\def\doadaptrightskip#1{\dosetrightskipadaption{#1}\advance\rightskip\rightskipadaption} +\unexpanded\def\doadaptleftskip #1{\dosetleftskipadaption {#1}\advance\leftskip \leftskipadaption } +\unexpanded\def\doadaptrightskip#1{\dosetrightskipadaption{#1}\advance\rightskip\rightskipadaption} -%D Tolerance: +%D Tolerance (can also be set with align): -\unexpanded\def\definetolerancemethod - {\dodoubleargument\dodefinetolerancemethod} +\installcorenamespace{tolerancemethods} -\def\dodefinetolerancemethod[#1][#2]#3% - {\setvalue{\??to:#1:#2}{#3}} +\unexpanded\def\installtolerancemethod#1#2#3% + {\setvalue{\??tolerancemethods#1:#2}{#3}} -\definetolerancemethod [\v!vertical] [\v!verystrict ] {\let\bottomtolerance\empty} -\definetolerancemethod [\v!vertical] [\v!strict ] {\def\bottomtolerance{.050}} -\definetolerancemethod [\v!vertical] [\v!tolerant ] {\def\bottomtolerance{.075}} -\definetolerancemethod [\v!vertical] [\v!verytolerant] {\def\bottomtolerance{.100}} +\installtolerancemethod \v!vertical \v!verystrict {\let\bottomtolerance\empty} +\installtolerancemethod \v!vertical \v!strict {\def\bottomtolerance{.050}} +\installtolerancemethod \v!vertical \v!tolerant {\def\bottomtolerance{.075}} +\installtolerancemethod \v!vertical \v!verytolerant {\def\bottomtolerance{.100}} -\definetolerancemethod [\v!horizontal] [\v!stretch ] {\emergencystretch\bodyfontsize} -\definetolerancemethod [\v!horizontal] [\v!space ] {\spaceskip.5em\!!plus.25em\!!minus.25em\relax} -\definetolerancemethod [\v!horizontal] [\v!verystrict ] {\tolerance 200 } -\definetolerancemethod [\v!horizontal] [\v!strict ] {\tolerance1500 } -\definetolerancemethod [\v!horizontal] [\v!tolerant ] {\tolerance3000 } -\definetolerancemethod [\v!horizontal] [\v!verytolerant] {\tolerance4500 } +\installtolerancemethod \v!horizontal \v!stretch {\emergencystretch\bodyfontsize} +\installtolerancemethod \v!horizontal \v!space {\spaceskip.5em\!!plus.25em\!!minus.25em\relax} +\installtolerancemethod \v!horizontal \v!verystrict {\tolerance 200 } +\installtolerancemethod \v!horizontal \v!strict {\tolerance1500 } +\installtolerancemethod \v!horizontal \v!tolerant {\tolerance3000 } +\installtolerancemethod \v!horizontal \v!verytolerant {\tolerance4500 } -\def\dotolerancencemethodvertical #1{\csname\??to:\v!vertical :#1\endcsname} -\def\dotolerancencemethodhorizontal#1{\csname\??to:\v!horizontal:#1\endcsname} - -\def\dosetuptolerance[#1]% - {\doifinsetelse\v!vertical{#1}% - {\processcommacommand[#1]\dotolerancencemethodvertical} - {\processcommacommand[#1]\dotolerancencemethodhorizontal}} +\def\spac_tolerances_step_vertical #1{\csname\??tolerancemethods\v!vertical :#1\endcsname} +\def\spac_tolerances_step_horizontal#1{\csname\??tolerancemethods\v!horizontal:#1\endcsname} \unexpanded\def\setuptolerance - {\dosingleargument\dosetuptolerance} + {\dosingleargument\spac_tolerances_setup} + +\def\spac_tolerances_setup[#1]% + {\doifinsetelse\v!vertical{#1}% + {\processcommacommand[#1]\spac_tolerances_step_vertical } + {\processcommacommand[#1]\spac_tolerances_step_horizontal}} %D \macros %D {pushindentation,popindentation} %D %D The pushing and popping is done by: -\newbox\indentationboxA -\newbox\indentationboxB +\newbox\b_spac_indentations_a +\newbox\b_spac_indentations_b -\def\pushindentation - {\bgroup +\unexpanded\def\pushindentation + {\begingroup \ifhmode \unskip - \setbox\indentationboxA\lastbox % get \strut if present + \setbox\b_spac_indentations_a\lastbox % get \strut if present \unskip - \setbox\indentationboxB\lastbox % get \indent generated box + \setbox\b_spac_indentations_b\lastbox % get \indent generated box \unskip \else - \hskip\zeropoint % switch to horizontal mode + \dontleavehmode % was \hskip\zeropoint % switch to horizontal mode \unskip - \setbox\indentationboxA\lastbox % get \indent generated box - \setbox\indentationboxB\emptybox + \setbox\b_spac_indentations_a\lastbox % get \indent generated box + \setbox\b_spac_indentations_b\emptybox \fi} -\def\popindentation - {\box\indentationboxB\box\indentationboxA % put back the boxes - \egroup} +\unexpanded\def\popindentation + {\box\b_spac_indentations_b + \box\b_spac_indentations_a + \endgroup} %D The only complication lays in \type{\strut}. In \PLAIN\ %D \TEX\ a \type{\strut} is defined as: @@ -736,7 +715,7 @@ % \unexpanded \def\crlf % {\ifhmode\unskip\else\strut\fi\ifcase\raggedstatus\hfil\fi\break} -\unexpanded \def\crlf +\unexpanded\def\crlf {\ifhmode \unskip \prewordbreak\crlfplaceholder @@ -747,11 +726,11 @@ \endgraf \fi} -\def\crlfplaceholder +\unexpanded\def\crlfplaceholder {\strut} -\def\settestcrlf - {\def\crlfplaceholder +\unexpanded\def\settestcrlf + {\unexpanded\def\crlfplaceholder {\hbox to \zeropoint {\strut{\infofont\kern.25em}\lohi{\infofont CR}{\infofont LF}\hss}}} @@ -822,6 +801,8 @@ \ifcsname\??hspace#1:#2\endcsname#1:#2\else:\v!none\fi \endcsname} +% no installhspace here (this is already an old command) + \definehspace [\v!small] [.25\emspaceamount] \definehspace [\v!medium] [.5\emspaceamount] \definehspace [\v!big] [1\emspaceamount] @@ -887,38 +868,38 @@ % % do we need \normalspaceprimitive here? -\installcorenamespace{spaces} +\installcorenamespace{spacemethods} + +\unexpanded\def\installspacemethod#1#2% needs to set \obeyedspace + {\setvalue{\??spacemethods#1}{#2}} -\def\installspacehandler#1#2% needs to set \obeyedspace - {\setvalue{\??spaces#1}{#2}} +\def\activatespacehandler#1% + {\csname\??spacemethods\ifcsname\??spacemethods#1\endcsname#1\else\v!off\fi\endcsname} \unexpanded\def\spac_spaces_checked_control{\mathortext\normalspace{\dontleavehmode{\tt\controlspace}}}% \unexpanded\def\spac_spaces_checked_normal {\mathortext\normalspace{\dontleavehmode\normalspace}}% \unexpanded\def\spac_spaces_checked_fixed {\mathortext\normalspace{\dontleavehmode\fixedspace}}% -\installspacehandler \v!on +\installspacemethod \v!on {\obeyspaces \let\obeyedspace\spac_spaces_checked_control \let\ =\obeyedspace} -\installspacehandler \v!yes +\installspacemethod \v!yes {\obeyspaces \let\obeyedspace\spac_spaces_checked_normal \let\ =\obeyedspace} -\installspacehandler \v!off % == default +\installspacemethod \v!off % == default {\normalspaces \let\obeyedspace\normalspace \let\ =\normalspaceprimitive} % was \normalspace -\installspacehandler \v!fixed +\installspacemethod \v!fixed {\obeyspaces \let\obeyedspace\spac_spaces_checked_fixed \let\ =\obeyedspace} -\def\activatespacehandler#1% - {\csname\??spaces\ifcsname\??spaces#1\endcsname#1\else\v!off\fi\endcsname} - \appendtoks \normalspaces % to be sure \to \everybeforeoutput diff --git a/tex/context/base/spac-ver.lua b/tex/context/base/spac-ver.lua index f9ef14da1..e22cb3e84 100644 --- a/tex/context/base/spac-ver.lua +++ b/tex/context/base/spac-ver.lua @@ -571,7 +571,7 @@ do -- todo: interface.variables local function analyze(str,oldcategory) -- we could use shorter names for s in gmatch(str,"([^ ,]+)") do - local amount, keyword, detail = lpegmatch(splitter,s) + local amount, keyword, detail = lpegmatch(splitter,s) -- the comma splitter can be merged if not keyword then report_vspacing("unknown directive: %s",s) else @@ -1344,3 +1344,11 @@ callbacks.register('buildpage_filter', nodes.builders.buildpage_filter, "vertica statistics.register("v-node processing time", function() return statistics.elapsedseconds(builders) end) + +-- interface + +commands.vspacing = vspacing.analyze +commands.vspacingsetamount = vspacing.setskip +commands.vspacingdefine = vspacing.setmap +commands.vspacingcollapse = vspacing.collapsevbox +commands.vspacingsnap = vspacing.snapbox diff --git a/tex/context/base/spac-ver.mkiv b/tex/context/base/spac-ver.mkiv index ee770656f..d1dd1b979 100644 --- a/tex/context/base/spac-ver.mkiv +++ b/tex/context/base/spac-ver.mkiv @@ -19,6 +19,8 @@ % Isn't it about time to get rid of topskip i.e. make it equivalent to % \openstrutheight so that we can remove delta code. +% +% There might be more namespace protection. %D There are two ways to influence the interline spacing. The %D most general and often most consistent way is using @@ -156,28 +158,28 @@ \spac_linespacing_setup_specified_interline_space %\dosetupspecifiedinterlinespaceindeed \else - \space_linespacing_setup_specified_or_relative[#1]% + \spac_linespacing_setup_specified_or_relative[#1]% \fi \else \let\currentinterlinespace\empty - \space_linespacing_synchronize_local + \spac_linespacing_synchronize_local \fi\fi} -\def\space_linespacing_setup_specified_or_relative[#1]% +\def\spac_linespacing_setup_specified_or_relative[#1]% {\doifassignmentelse{#1}\setupspecifiedinterlinespace\setuprelativeinterlinespace[#1]% \the\iflocalinterlinespace\everysetuplocalinterlinespace\else\everysetupglobalinterlinespace\fi} -\def\space_linespacing_synchronize_local % adapts to the font +\def\spac_linespacing_synchronize_local % adapts to the font {\localinterlinespacetrue \setfontparameters \updateraggedskips % funny one here \the\everysetuplocalinterlinespace \localinterlinespacefalse} -\def\dosetupcheckedinterlinespace#1% often a chain +\unexpanded\def\dosetupcheckedinterlinespace#1% often a chain {\edef\askedinterlinespace{#1}% \ifx\askedinterlinespace\empty - \space_linespacing_synchronize_local + \spac_linespacing_synchronize_local \else\ifcsname\namedinterlinespacehash\askedinterlinespace\s!parent\endcsname % we could have a \s!check \pushmacro\currentinterlinespace \let\currentinterlinespace\askedinterlinespace @@ -313,91 +315,102 @@ \unexpanded\def\removelastskip % also in supp-box {\ifvmode\ifzeropt\lastskip\else\vskip-\lastskip\fi\fi} -% The whitespace handler. +% The whitespace handler. We could cache settings but normally there are not +% that many in a set. \installcorenamespace{whitespacemethod} -\newskip \ctxparskip \ctxparskip\zeropoint -\newconditional \flexiblewhitespace \settrue\flexiblewhitespace +\newskip \s_spac_whitespace_parskip \s_spac_whitespace_parskip\zeropoint +\newconditional\c_spac_whitespace_flexible \settrue\c_spac_whitespace_flexible +\newconstant \c_spac_whitespace_grid_mode % option in layout / 1=permit_half_lines -\def\currentwhitespace{\zeropoint} +%def\v_spac_whitespace_current{\zeropoint} +\let\v_spac_whitespace_current\v!none -\definecomplexorsimple\setupwhitespace +\unexpanded\def\setupwhitespace + {\doifnextoptionalelse\spac_whitespace_setup_yes\spac_whitespace_setup_nop} -\def\simplesetupwhitespace - {\doifnot\currentwhitespace\v!none\spac_whitespace_setup} +\def\spac_whitespace_setup_nop + {\ifx\v_spac_whitespace_current\v!none\else + \spac_whitespace_setup + \fi} -\def\complexsetupwhitespace[#1]% - {\edef\nextcurrentwhitespace{#1}% - \ifx\nextcurrentwhitespace\empty - \simplesetupwhitespace +\let\synchronizewhitespace\spac_whitespace_setup_nop + +\def\spac_whitespace_setup_yes[#1]% + {\edef\m_spac_whitespace_asked{#1}% + \ifx\m_spac_whitespace_asked\empty + \spac_whitespace_setup_nop \else - \let\currentwhitespace\nextcurrentwhitespace + \let\v_spac_whitespace_current\m_spac_whitespace_asked \spac_whitespace_setup \fi} -\newconstant\baselinegridmode % option in layout / 1=permit_half_lines - \def\spac_whitespace_setup % quick test for no list - {\ifcsname\??whitespacemethod\currentwhitespace\endcsname - \csname\??whitespacemethod\currentwhitespace\endcsname + {\ifcsname\??whitespacemethod\v_spac_whitespace_current\endcsname + \csname\??whitespacemethod\v_spac_whitespace_current\endcsname \else - \expandafter\processcommalist\expandafter[\currentwhitespace]\spac_whitespace_setup_method % can be raw + \expandafter\processcommalist\expandafter[\v_spac_whitespace_current]\spac_whitespace_setup_method % can be raw \fi\relax \ifgridsnapping \spac_whitespace_setup_grid \else \spac_whitespace_setup_normal \fi - \parskip\ctxparskip} + \parskip\s_spac_whitespace_parskip} \def\spac_whitespace_setup_normal - {\ifconditional\flexiblewhitespace \else - \ctxparskip1\ctxparskip + {\ifconditional\c_spac_whitespace_flexible \else + \s_spac_whitespace_parskip\plusone\s_spac_whitespace_parskip \fi} \def\spac_whitespace_setup_grid - {\setfalse\flexiblewhitespace - \ifdim\ctxparskip>\zeropoint - \ctxparskip - \ifcase\baselinegridmode - \baselineskip % normal ! ! ! ! !! + {\setfalse\c_spac_whitespace_flexible + \ifdim\s_spac_whitespace_parskip>\zeropoint + \s_spac_whitespace_parskip + \ifcase\c_spac_whitespace_grid_mode + \baselineskip \or \ifdim\scratchdimen=\baselineskip % maybe range - \baselineskip % normal ! ! ! ! !! + \baselineskip \else - \numexpr\ctxparskip/\dimexpr.5\lineheight\relax\relax\dimexpr.5\lineheight\relax + \numexpr\s_spac_whitespace_parskip/\dimexpr.5\lineheight\relax\relax\dimexpr.5\lineheight\relax \fi \else - \baselineskip % normal ! ! ! ! !! + \baselineskip \fi \fi} -% this will become \installwhitespacemethod{}{} +\unexpanded\def\installwhitespacemethod#1#2% + {\setvalue{\??whitespacemethod#1}{#2}} -\unexpanded\def\definewhitespacemethod[#1]#2{\setvalue{\??whitespacemethod#1}{#2}} +\installwhitespacemethod \v!fix {} +\installwhitespacemethod \v!fixed {\setfalse\c_spac_whitespace_flexible} +\installwhitespacemethod \v!flexible {\settrue \c_spac_whitespace_flexible} -\definewhitespacemethod [\v!fix] {} -\definewhitespacemethod [\v!fixed] {\setfalse\flexiblewhitespace} -\definewhitespacemethod [\v!flexible] {\settrue \flexiblewhitespace} +\installwhitespacemethod \v!line {\s_spac_whitespace_parskip \baselineskip} +\installwhitespacemethod \v!halfline {\s_spac_whitespace_parskip.5\baselineskip} +\installwhitespacemethod \v!none {\s_spac_whitespace_parskip \zeropoint} +\installwhitespacemethod \v!big {\s_spac_whitespace_parskip \bigskipamount} +\installwhitespacemethod \v!medium {\s_spac_whitespace_parskip \medskipamount} +\installwhitespacemethod \v!small {\s_spac_whitespace_parskip \smallskipamount} -\definewhitespacemethod [\v!line] {\ctxparskip \baselineskip} -\definewhitespacemethod [\v!halfline] {\ctxparskip.5\baselineskip} -\definewhitespacemethod [\v!none] {\ctxparskip \zeropoint} -\definewhitespacemethod [\v!big] {\ctxparskip \bigskipamount} -\definewhitespacemethod [\v!medium] {\ctxparskip \medskipamount} -\definewhitespacemethod [\v!small] {\ctxparskip \smallskipamount} - -\definewhitespacemethod [\s!default] {\simplesetupwhitespace} +\installwhitespacemethod \s!default {\spac_whitespace_setup_nop} \def\spac_whitespace_setup_method#1% {\ifcsname\??whitespacemethod#1\endcsname \csname\??whitespacemethod#1\endcsname \else - \ctxparskip#1\fi + \s_spac_whitespace_parskip#1\fi \relax} -% \definewhitespacemethod [\s!unknown] {\ctxparskip\commalistelement\relax} + +\unexpanded\def\forgetparskip + {\s_spac_whitespace_parskip\zeropoint + \parskip\zeropoint + \let\v_spac_whitespace_current\v!none} + +% \installwhitespacemethod \s!unknown {\s_spac_whitespace_parskip\commalistelement\relax} % % \def\spac_whitespace_setup_method#1% % {\csname\??whitespacemethod\ifcsname\??whitespacemethod#1\endcsname#1\else\s!unknown\endcsname\relax} @@ -405,12 +418,11 @@ \unexpanded\def\nowhitespace{\vspacing[\v!nowhite]} \unexpanded\def\whitespace {\vspacing[\v!white]} -% De onderstaande macro handelt ook de situatie dat er geen -% tekst tussen \start ... \stop is geplaatst. Daartoe wordt de -% laatste skip over de lege tekst heen gehaald. Dit komt goed -% van pas bij het plaatsen van (mogelijk lege) lijsten. +% Packed: -\newconditional\noblankinpacked +% todo: when packed blocks blank, we need to enable forced + +\newconditional\c_spac_packed_blank \settrue\c_spac_packed_blank \newcount \c_spac_packed_level \unexpanded\def\startpacked @@ -423,7 +435,7 @@ \begingroup \whitespace % not combined \blank[\v!disable]% - \doifelse{#1}\v!blank\setfalse\settrue\noblankinpacked + \doifelse{#1}\v!blank\settrue\setfalse\c_spac_packed_blank \setupwhitespace[\v!none]% \fi \fi} @@ -446,32 +458,38 @@ % % todo: a version that works ok inside a box -\let\doaroundlinecorrection\relax +\installcorenamespace{linesaround} + +\let\v_spac_lines_around_action_set\relax +\let\m_spac_lines_around \empty + +\setvalue{\??linesaround\v!blank }{\blank} +\letvalue{\??linesaround\empty }\relax +\setvalue{\??linesaround\s!unknown}{\blank[\m_spac_lines_around]} \unexpanded\def\startlinecorrection - {\dodoubleempty\dostartlinecorrection} + {\dodoubleempty\spac_lines_start_correction} -\def\dostartlinecorrection[#1][#2]% #2 gobbles spaces +\def\spac_lines_start_correction[#1][#2]% #2 gobbles spaces {\bgroup - \processaction - [#1] - [ \v!blank=>\let\doaroundlinecorrection\blank, - \s!default=>\let\doaroundlinecorrection\relax, - \s!unknown=>{\def\doaroundlinecorrection{\blank[#1]}}]% - \doaroundlinecorrection + \edef\m_spac_lines_around{#1}% + \expandafter\let\expandafter\spac_lines_action_around\csname\??linesaround + \ifcsname\??linesaround\m_spac_lines_around\endcsname\m_spac_lines_around\else\s!unknown\fi + \endcsname + \spac_lines_action_around \startbaselinecorrection \offbaselinecorrection \ignorespaces} \unexpanded\def\stoplinecorrection {\stopbaselinecorrection - \doaroundlinecorrection + \spac_lines_action_around \egroup} \unexpanded\def\correctwhitespace {\dowithnextboxcs\correctwhitespacefinish\vbox} -\def\correctwhitespacefinish +\unexpanded\def\correctwhitespacefinish {\startbaselinecorrection \flushnextbox \stopbaselinecorrection} @@ -558,12 +576,12 @@ \def\normalizedbodyfontsize{12pt} \fi -\def\topskipcorrection +\unexpanded\def\topskipcorrection {\simpletopskipcorrection \vskip-\struttotal \verticalstrut} -\def\simpletopskipcorrection +\unexpanded\def\simpletopskipcorrection {\ifdim\topskip>\openstrutheight % == \vskip\topskipgap \vskip\topskip @@ -647,8 +665,8 @@ \let\restoreinterlinespace\relax -\def\saveinterlinespace - {\edef\restoreinterlinespace +\unexpanded\def\saveinterlinespace + {\unexpanded\edef\restoreinterlinespace {\lineheight \the\lineheight \openstrutheight \the\openstrutheight \openstrutdepth \the\openstrutdepth @@ -995,7 +1013,7 @@ %D My own one: -\unexpanded\def\dopushinterlineskip +\unexpanded\def\spac_helpers_push_interlineskip_yes {\edef\oninterlineskip {\baselineskip\the\baselineskip \lineskip\the\lineskip @@ -1003,14 +1021,14 @@ \noexpand\edef\noexpand\minimumlinedistance{\the\dimexpr\minimumlinedistance}% \let\noexpand\offinterlineskip\noexpand\normaloffinterlineskip}} % \noexpand not needed -\unexpanded\def\nopushinterlineskip +\unexpanded\def\spac_helpers_push_interlineskip_nop {\let\oninterlineskip\setnormalbaselines} \unexpanded\def\offinterlineskip {\ifdim\baselineskip>\zeropoint - \dopushinterlineskip + \spac_helpers_push_interlineskip_yes \else - \nopushinterlineskip + \spac_helpers_push_interlineskip_nop \fi \normaloffinterlineskip} @@ -1031,9 +1049,6 @@ #1\numexpr#2+\plusone\relax\space\doexpandedrecurse{\the\numexpr#2\relax}{ #3}\zerocount\relax \fi} -\def\doexpandedrecurse#1#2% - {\ifnum#1>\zerocount#2\@EA\doexpandedrecurse\@EA{\the\numexpr#1-1\relax}{#2}\fi} - %D \macros %D {keeplinestogether} %D @@ -1042,19 +1057,19 @@ % just before margintexts ... will eventually be done differently in mkiv using % attributes -\newcount\nofkeeplinestogether +\newcount\c_spac_keep_lines_together \let\restoreinterlinepenalty\relax -\unexpanded\def\dorestoreinterlinepenalty +\unexpanded\def\spac_penalties_restore {\global\let\restoreinterlinepenalty\relax \global\resetpenalties\interlinepenalties - \global\nofkeeplinestogether\zerocount} + \global\c_spac_keep_lines_together\zerocount} \unexpanded\def\keeplinestogether#1% - {\ifnum#1>\nofkeeplinestogether - \global\nofkeeplinestogether#1% - \global\setpenalties\interlinepenalties\nofkeeplinestogether\plustenthousand - \global\let\restoreinterlinepenalty\dorestoreinterlinepenalty + {\ifnum#1>\c_spac_keep_lines_together + \global\c_spac_keep_lines_together#1% + \global\setpenalties\interlinepenalties\c_spac_keep_lines_together\plustenthousand + \global\let\restoreinterlinepenalty\spac_penalties_restore \fi} \newif\ifgridsnapping % to be sure @@ -1116,9 +1131,9 @@ \directsetup{\systemsetupsprefix\s!reset} - \setpenalties\widowpenalties2\maxdimen - \setpenalties\clubpenalties 2\maxdimen - \brokenpenalty \maxdimen + \setpenalties\widowpenalties\plustwo\maxdimen + \setpenalties\clubpenalties \plustwo\maxdimen + \brokenpenalty \maxdimen \stopsetups @@ -1157,14 +1172,14 @@ \def\snappedvboxattribute{\ifgridsnapping attr \snapvboxattribute \attribute\snapmethodattribute\fi} \def\setlocalgridsnapping{\ifgridsnapping \attribute \snapvboxattribute \attribute\snapmethodattribute\fi} -\def\dosetlocalgridsnapping#1% +\def\spac_grids_set_local_snapping#1% {\ifgridsnapping \doifsomething{#1}% - {\autosetsnapvalue{#1}% + {\spac_grids_snap_value_set{#1}% \attribute \snapvboxattribute \attribute\snapmethodattribute}% \fi} -\def\installsnapvalues#1#2% todo: a proper define +\unexpanded\def\installsnapvalues#1#2% todo: a proper define {\edef\currentsnapper{#1:#2}% \ifcsname\currentsnapper\endcsname \else \setevalue\currentsnapper{\ctxlua{builders.vspacing.definesnapmethod("#1","#2")}}% @@ -1172,20 +1187,20 @@ \setevalue{\??gridsnappers#1}{\attribute\snapmethodattribute\csname\currentsnapper\endcsname\space}} \unexpanded\def\definegridsnapping - {\dodoubleargument\dodefinegridsnapping} + {\dodoubleargument\spac_grids_define} -\def\dodefinegridsnapping[#1][#2]% +\def\spac_grids_define[#1][#2]% {\installsnapvalues{#1}{#2}} -\edef\resetsnapvalue +\edef\spac_grids_snap_value_reset {%\gridsnappingfalse \attribute\snapmethodattribute\attributeunsetvalue} -\def\setsnapvalue#1% +\def\spac_grids_snap_value_set#1% {%\gridsnappingtrue \ifcsname\??gridsnappers#1\endcsname\csname\??gridsnappers#1\endcsname\fi} -\def\autosetsnapvalue#1% +\def\spac_grids_snap_value_auto#1% {\ifcsname\??gridsnappers#1\endcsname \csname\??gridsnappers#1\endcsname \else @@ -1241,16 +1256,12 @@ \definegridsnapping[\v!middle] [\v!maxheight,\v!maxdepth] % used in placement -\newtoks\everysetupgridsnapping % this only happens at the setuplayout level - -\def\dosetupgridsnapping{\the\everysetupgridsnapping} % not used ! - -\def\synchronizelocallinespecs +\unexpanded\def\synchronizelocallinespecs {\bodyfontlineheight \normallineheight \bodyfontstrutheight\strutheight \bodyfontstrutdepth \strutdepth} -\def\synchronizegloballinespecs +\unexpanded\def\synchronizegloballinespecs {\global\globalbodyfontlineheight \normallineheight \global\globalbodyfontstrutheight\strutheight \global\globalbodyfontstrutdepth \strutdepth} @@ -1270,59 +1281,59 @@ \let\showgridsnapping\relax -\def\snaptogrid {\dosingleempty\dosnaptogrid} -\def\moveongrid {\dosingleempty\domoveongrid} -\unexpanded\def\placeongrid{\dosingleempty\doplaceongrid} +%unexpanded\def\moveongrid {\dosingleempty\spac_grids_move_on} +\unexpanded\def\snaptogrid {\dosingleempty\spac_grids_snap_to} +\unexpanded\def\placeongrid{\dosingleempty\spac_grids_place_on} -\def\domoveongrid[#1]% - {[obsolete]} % gone, unless we set an attribute +% \def\spac_grids_move_on[#1]% +% {[obsolete]} % gone, unless we set an attribute -\def\doplaceongrid[#1]% +\def\spac_grids_place_on[#1]% {\snaptogrid[#1]\vbox} % mark as done -\def\dosnaptogrid[#1]% list or predefined +\def\spac_grids_snap_to[#1]% list or predefined {\ifgridsnapping - \expandafter\dodosnaptogrid + \expandafter\spac_grids_snap_to_indeed \else \expandafter\gobbleoneargument \fi{#1}} -\def\dodosnaptogrid#1% +\def\spac_grids_snap_to_indeed#1% {\bgroup - \resetsnapvalue - \dowithnextbox{\dododosnaptogrid{#1}}} + \spac_grids_snap_value_reset + \dowithnextbox{\spac_grids_snap_to_finish{#1}}} % eventually there will always be a line snap -\def\dododosnaptogrid#1% +\def\spac_grids_snap_to_finish#1% {\ifvbox\nextbox % this will go away - \ctxlua{builders.vspacing.collapsevbox(\number\nextbox)}% isn't that already done? + \ctxcommand{vspacingcollapse(\number\nextbox)}% isn't that already done? \fi - \doifelsenothing{#1}{\setsnapvalue\v!normal}{\autosetsnapvalue{#1}}% - \ctxlua{builders.vspacing.snapbox(\number\nextbox,\number\attribute\snapmethodattribute)}% + \doifelsenothing{#1}{\spac_grids_snap_value_set\v!normal}{\spac_grids_snap_value_set{#1}}% + \ctxcommand{vspacingsnap(\number\nextbox,\number\attribute\snapmethodattribute)}% \ifvbox\nextbox\vbox\else\hbox\fi attr \snapmethodattribute \zerocount {\box\nextbox}% \egroup} -\def\docheckgridsnappingnop +\def\spac_grids_check_nop {\gridsnappingfalse \resetsystemmode\v!grid - \resetsnapvalue} + \spac_grids_snap_value_reset} -\def\docheckgridsnappingyes +\def\spac_grids_check_yes {\gridsnappingtrue \setsystemmode\v!grid - \autosetsnapvalue\askedgridmode} + \spac_grids_snap_value_set\askedgridmode} -\def\docheckgridsnapping +\unexpanded\def\synchronizegridsnapping {\edef\askedgridmode{\layoutparameter\c!grid}% \ifx\askedgridmode\v!no % official - \docheckgridsnappingnop + \spac_grids_check_nop \else\ifx\askedgridmode\v!off % for taco and luigi - \docheckgridsnappingnop + \spac_grids_check_nop \else\ifx\askedgridmode\empty % to be sure - \docheckgridsnappingnop + \spac_grids_check_nop \else - \docheckgridsnappingyes + \spac_grids_check_yes \fi\fi\fi} %D Visualization: @@ -1334,7 +1345,7 @@ three=blue, four=gray] -\def\setgridtracebox#1[#2]% % maybe reverse the order +\unexpanded\def\setgridtracebox#1[#2]% % maybe reverse the order {\setbox\nextbox#1% {\hbox {\hbox to \zeropoint @@ -1346,10 +1357,22 @@ \setnewconstant\gridboxlinenomode\plusone % 0:nothing 1:all 2:lines 3:frame 4:l/r \setnewconstant\gridboxlinemode \plusone -\def\gridboxvbox {\ifcase\gridboxlinemode\vbox\or\ruledvbox\or\vbox\or\ruledvbox\else\ruledvbox\fi} +\unexpanded\def\gridboxvbox + {\ifcase\gridboxlinemode + \vbox + \or + \ruledvbox + \or + \vbox + \or + \ruledvbox + \else + \ruledvbox + \fi} + \def\gridboxwidth{\ifcase\gridboxlinemode0\or.5\or.5\or0\else.5\fi\testrulewidth} -\def\setgridbox#1#2#3% maybe ifgridsnapping at outer level +\unexpanded\def\setgridbox#1#2#3% maybe ifgridsnapping at outer level {\setbox#1\gridboxvbox to #3 % given size {\forgetall \resetteststrut @@ -1386,22 +1409,22 @@ \def\fuzzysnappedbox#1#2% \box<n> \unvbox<n> {#1#2} -\def\moveboxontogrid#1#2#3% will become obsolete +\def\moveboxontogrid#1#2#3% will become obsolete, but it needs checking {} %D Helper: -\def\doassignsomeskip#1\to#2% ook nog \v!halfline+fuzzysnap - {\doifelse{#1}\v!line - {#2\ifgridsnapping +\unexpanded\def\spac_helpers_assign_skip#1#2% ook nog \v!halfline+fuzzysnap + {\doifelse{#2}\v!line + {#1\ifgridsnapping \bodyfontlineheight \else \openlineheight \fi} {\ifgridsnapping - \assigndimension{#1}{#2}{.25\bodyfontlineheight}{.5\bodyfontlineheight}\bodyfontlineheight + \assigndimension{#2}{#1}{.25\bodyfontlineheight}{.5\bodyfontlineheight}\bodyfontlineheight \else - \assigndimension{#1}{#2}\smallskipamount\medskipamount\bigskipamount + \assigndimension{#2}{#1}\smallskipamount\medskipamount\bigskipamount \fi}% \relax} @@ -1427,9 +1450,25 @@ % \defineblankmethod [\v!joinedup] {\ifvmode\nointerlineskip\fi} % todo, in grid mode: builders.vspacing.fixed = false +% +% \ifgridsnapping will go + +\installcorenamespace{vspacingamount} + +\unexpanded\def\definevspacingamount + {\dotripleempty\spac_vspacing_define_amount} + +\def\spac_vspacing_define_amount[#1][#2][#3]% can be combined + {\setvalue{\??vspacingamount#1}{\ifgridsnapping#3\else#2\fi}% + \ctxcommand{vspacingsetamount("#1")}} + +\unexpanded\def\definevspacing + {\dodoubleempty\spac_vspacing_define} + +\def\spac_vspacing_define[#1][#2]% + {\ctxcommand{vspacingdefine("#1","#2")}} -\let\saveouterspacing \relax % for old times sake -\let\restoreouterspacing\relax % for old times sake +%D The injector code (generated at the \LUA\ end): \newtoks\everybeforeblankhandling \newtoks\everyafterblankhandling @@ -1441,10 +1480,15 @@ \attribute\skipcategoryattribute\plusone \attribute\skippenaltyattribute \attributeunsetvalue \attribute\skiporderattribute \attributeunsetvalue - \ifgridsnapping % \ifblankflexible - \setfalse\blankisfixed - \else +% \ifgridsnapping % \ifblankflexible +% \setfalse\blankisfixed +% \else +% \settrue\blankisfixed +% \fi + \ifgridsnapping \settrue\blankisfixed + \else + \setfalse\blankisfixed \fi \to \everybeforeblankhandling @@ -1456,16 +1500,6 @@ \fi \to \everyafterblankhandling -% \ifgridsnapping will go - -\appendtoks - \ifgridsnapping - \settrue\blankisfixed - \else - \setfalse\blankisfixed - \fi -\to \everybeforeblankhandling - \def\setblankcategory#1% {\settrue\someblankdone \attribute\skipcategoryattribute#1\relax} @@ -1521,17 +1555,6 @@ \setfalse\someblankdone \the\everybeforeblankhandling} -% % % % we can move much to lua once we can expand there % % % % - -\installcorenamespace{vspacingamount} - -\unexpanded\def\definevspacingamount - {\dotripleempty\dodefinevspacingamount} - -\def\dodefinevspacingamount[#1][#2][#3]% can be combined - {\setvalue{\??vspacingamount#1}{\ifgridsnapping#3\else#2\fi}% - \ctxlua{builders.vspacing.setskip("#1")}} - \def\addpredefinedblankskip#1#2% {\settrue\someblankdone \advance\s_spac_vspacing_temp#1\dimexpr\csname\??vspacingamount#2\endcsname\relax} @@ -1540,59 +1563,70 @@ {\settrue\someblankdone \advance\s_spac_vspacing_temp#1\dimexpr#2\relax} -\unexpanded\def\definevspacing - {\dodoubleempty\dodefinevspacing} - -\def\dodefinevspacing[#1][#2]% - {\ctxlua{builders.vspacing.setmap("#1","#2")}} +% The main spacer: \unexpanded\def\vspacing - {\dosingleempty\dovspacing} + {\doifnextoptionalelse\spac_vspacing_yes\spac_vspacing_nop} -% todo: when packed blocks blank, we need to enable forced +\def\spac_vspacing_yes + {\ifinpagebody % somewhat weird + \singleexpandafter\spac_vspacing_yes_indeed + \else\ifconditional\c_spac_packed_blank + \doubleexpandafter\spac_vspacing_yes_indeed + \else + \doubleexpandafter\spac_vspacing_yes_ignore + \fi\fi} -\def\dovspacing % blank also has a \flushnotes - {\ifinpagebody - \expandafter\dovspacingyes - \else\ifconditional\noblankinpacked % todo: better reset this conditional in pagebody - \expandafter\expandafter\expandafter\dovspacingnop +\def\spac_vspacing_nop + {\ifinpagebody % somewhat weird + \singleexpandafter\spac_vspacing_nop_indeed + \else\ifconditional\c_spac_packed_blank + \doubleexpandafter\spac_vspacing_nop_indeed \else - \expandafter\expandafter\expandafter\dovspacingyes + \doubleexpandafter\spac_vspacing_nop_ignore \fi\fi} -\def\dovspacingyes[#1]% - %{\ifmmode\else\ctxlua{builders.vspacing.analyze("\iffirstargument#1\else\s!default\fi")}\fi} - {\ifmmode\else\ctxlua{builders.vspacing.analyze("\iffirstargument#1\else\currentvspacing\fi")}\fi} +\def\spac_vspacing_yes_indeed[#1]% + {\ifmmode\else\ctxcommand{vspacing("#1")}\fi} -\def\dovspacingnop[#1]% +\def\spac_vspacing_yes_ignore[#1]% {\ifmmode\else\par\fi} -% todo: check them and make them faster: +\def\spac_vspacing_nop_indeed + {\ifmmode\else\ctxcommand{vspacing("\currentvspacing")}\fi} + +\def\spac_vspacing_nop_ignore + {\ifmmode\else\par\fi} -\definecomplexorsimple\setupvspacing +\unexpanded\def\setupvspacing + {\doifnextoptionalelse\setupvspacing_yes\setupvspacing_nop} -\let\currentvspacing\s!default +\let\currentvspacing\s!default % hm, default, standard ... -\def\complexsetupvspacing[#1]% +\def\setupvspacing_yes[#1]% {\edef\currentvspacing{#1}} -\def\simplesetupvspacing +\def\setupvspacing_nop {\ifx\empty\currentvspacing\else \let\currentvspacing\s!default \fi - \simplesetupwhitespace} + \spac_whitespace_setup_nop} -\def\restorestandardblank +\unexpanded\def\restorestandardblank {\let\currentvspacing\v!standard} +\let\synchronizevspacing\setupvspacing_nop + % used both -\def\doinhibitblank{\vspacing[\v!disable]} % can be made faster (keep this command, used in styles) -\def\inhibitblank {\vspacing[\v!disable]} % can be made faster +\unexpanded\def\inhibitblank + {\vspacing[\v!disable]} % can be made faster + +\let\doinhibitblank\inhibitblank % keep this command, used in styles \let\setupblank \setupvspacing -\let\simplesetupblank\simplesetupvspacing \let\blank \vspacing +\let\synchronizeblank\synchronizevspacing % category:4 is default @@ -1635,7 +1669,11 @@ \definevspacing[\s!default] [\v!white] % was big for a while \dorecurse{10} % todo: other values < 4000 - {\expanded{\definevspacing[\v!samepage-\recurselevel][penalty:\the\numexpr4000+250*\recurselevel\relax]}} + {\normalexpanded{\definevspacing[\v!samepage-\recurselevel][penalty:\the\numexpr4000+250*\recurselevel\relax]}} + +%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). \let\blank \vspacing \let\defineblank \definevspacing @@ -1648,48 +1686,48 @@ \installcorenamespace{vspace} \unexpanded\def\definevspace - {\dotripleempty\dodefinevspace} + {\dotripleempty\spac_vspace_define} -\def\dodefinevspace[#1][#2][#3]% +\def\spac_vspace_define[#1][#2][#3]% {\ifthirdargument \setvalue{\??vspace#1:#2}{#3}% \else \setvalue{\??vspace:#1}{#2}% \fi} -\letvalue{\??vspace#1:\s!unknown}\zeropoint +\letvalue{\??vspace:\s!unknown}\zeropoint \unexpanded\def\vspace - {\dodoubleempty\dovspace} + {\dodoubleempty\spac_vspace_inject} -\def\dovspace[#1][#2]% +\def\spac_vspace_inject[#1][#2]% {\par \ifvmode \removelastskip \vskip \csname\??vspace - \ifsecondargument - \ifcsname\??vspace#1:#2\endcsname - #1:#2% - \else\ifcsname\??vspace:#2\endcsname - :#2% + \ifsecondargument + \ifcsname\??vspace#1:#2\endcsname + #1:#2% + \else\ifcsname\??vspace:#2\endcsname + :#2% + \else + :\s!unknown + \fi\fi + \else\iffirstargument + \ifcsname\??vspace:#1\endcsname + :#1% + \else + :\s!unknown + \fi \else - :\s!unknown + \ifcsname\??vspace:\s!default\endcsname + :\s!default + \else + :\s!unknown + \fi \fi\fi - \else\iffirstargument - \ifcsname\??vspace:#1\endcsname - :#1% - \else - :\s!unknown - \fi - \else - \ifcsname\??vspace:\s!default\endcsname - :\s!default - \else - :\s!unknown - \fi - \fi\fi - \endcsname + \endcsname \relax \fi} diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex f248eb5ac..7a563bdfe 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf Binary files differindex 1a5956dcc..ad9ae6bab 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/status-mkiv.lua b/tex/context/base/status-mkiv.lua index d742d8736..8968cd993 100644 --- a/tex/context/base/status-mkiv.lua +++ b/tex/context/base/status-mkiv.lua @@ -571,13 +571,14 @@ return { { filename = "spac-hor", marktype = "mkiv", - status = "unknown", + status = "okay", + comment = "probably needs some more work", }, { filename = "spac-ver", marktype = "mkiv", - status = "unknown", - comment = "update lua code (communicate via register)" + status = "okay", + comment = "maybe some changes will happen" }, { filename = "spac-lin", @@ -1004,17 +1005,18 @@ return { { filename = "typo-cln", marktype = "mkiv", - status = "unknown", + status = "okay", }, { filename = "typo-spa", marktype = "mkiv", - status = "unknown", + status = "okay", }, { filename = "typo-krn", marktype = "mkiv", - status = "unknown", + status = "okay", + comment = "do we keep the style and color or not" }, { filename = "typo-itc", diff --git a/tex/context/base/strc-doc.mkiv b/tex/context/base/strc-doc.mkiv index 44a79b16c..a6024113f 100644 --- a/tex/context/base/strc-doc.mkiv +++ b/tex/context/base/strc-doc.mkiv @@ -26,16 +26,19 @@ \def\currentstructurecounter{0} -\definesystemvariable {ns} +\installcorenamespace{structure} -\def\structureparameter#1{\csname\??ns#1\endcsname} +\installdirectcommandhandler \??structure {structure} % unchecked, so we need to initialize used parameters -\def\detokenizedstructureparameter#1{\detokenize\expandafter\expandafter\expandafter{\csname\??ns#1\endcsname}} +% \definesystemvariable{ns} +% \def\structureparameter#1{\csname\??ns#1\endcsname} +% \def\detokenizedstructureparameter#1{\detokenize\expandafter\expandafter\expandafter{\csname\??ns#1\endcsname}} \def\structurecomponent{\dodoubleempty\dostructurecomponent} -\getparameters % initialization, used not grouped anyway - [\??ns] +% \getparameters % initialization, used not grouped anyway +% [\??ns] +\setupstructure % not a user command so we might need to change the name [\c!number=, \c!level=, \c!name=, @@ -53,6 +56,7 @@ \c!sectionsegments=, \c!sectionresetset=, \c!reference=, + \c!backreference=, \c!expansion=\v!no, \c!xmlsetup=, \s!catcodes=, @@ -80,7 +84,8 @@ \def\dostructurecomponent[#1][#2]% #1=interfaced-settings, #2=optional user data (not yet supported) {\begingroup - \getparameters[\??ns][#1]% +% \getparameters[\??ns][#1]% + \setupstructure[#1]% \xdef\currentstructurename {\structureparameter\c!name}% \xdef\currentstructurecoupling {\structureparameter\c!coupling}% \xdef\currentstructureownnumber {\structureparameter\c!ownnumber}% optional own number diff --git a/tex/context/base/strc-flt.mkvi b/tex/context/base/strc-flt.mkvi index b54287a20..8e043446e 100644 --- a/tex/context/base/strc-flt.mkvi +++ b/tex/context/base/strc-flt.mkvi @@ -1016,7 +1016,7 @@ \global\floatwidth\wd\floatbox \global\floatheight\ht\floatbox % forget about the depth \global\advance\floattextwidth -\floatwidth - \global\advance\floattextwidth -\rootfloatparameter\c!margin\relax % was \tfskipsize + \global\advance\floattextwidth -\rootfloatparameter\c!margin\relax \edef\floatlocation{#1}% to be sure \doifinsetelse\v!tall{#1} {\floattextheight\pagegoal @@ -1243,7 +1243,7 @@ {\normalexpanded{\noexpand\setupalign[\v!reset,\floatcaptionparameter\c!align]}} \def\dopreparesideautocaption - {\scratchdimen\dimexpr\hsize-\wd\b_strc_floats_content-\floatparameter\c!margin\relax % was \tfskipsize\relax + {\scratchdimen\dimexpr\hsize-\wd\b_strc_floats_content-\floatparameter\c!margin\relax \ifdim\wd\b_strc_floats_caption>\scratchdimen \ifdim\wd\b_strc_floats_caption<1.3\scratchdimen \scratchdimen0.8\scratchdimen @@ -1811,6 +1811,8 @@ % float strategy, replaces some of the above macros +\installcorenamespace{floatmethods} + \let\floatmethod \empty \let\floatlabel \empty \let\floatcolumn \empty @@ -1830,57 +1832,59 @@ \ifdefined\OTRSETsetpreferedcolumnslot \OTRSETsetpreferedcolumnslot\floatcolumn\floatrow \fi - \ifcsname\string\floatmethod\floatmethod\endcsname \else + \ifcsname\??floatmethods\floatmethod\endcsname \else \let\floatmethod\v!here \fi \ifx\forcedfloatmethod\empty \else \let\floatmethod\forcedfloatmethod \fi - \getvalue{\string\floatmethod\floatmethod}[\floatmethod,\floatlocation]% + \getvalue{\??floatmethods\floatmethod}[\floatmethod,\floatlocation]% \fi} -\def\installfloathandler#1#2% #1=keyword #2=handler - {\setvalue{\string\floatmethod#1}{#2}} +\unexpanded\def\installfloatmethod#1#2% #1=keyword #2=handler + {\setvalue{\??floatmethods#1}{#2}} + +\let\installfloathandler\installfloatmethod % will go \def\somesomewherefloat[#1]% {\dofloatssavesomewherefloat\s!somewhere{#1}} -\installfloathandler \v!here \someherefloat -\installfloathandler \v!force \somefixdfloat -\installfloathandler \v!left \someleftsidefloat -\installfloathandler \v!right \somerightsidefloat -\installfloathandler \v!text \sometextfloat -\installfloathandler \v!top \sometopfloat -\installfloathandler \v!bottom \somebottomfloat -\installfloathandler \v!auto \someautofloat -\installfloathandler \v!margin \somemarginfloat -\installfloathandler \v!opposite \somefacefloat -\installfloathandler \v!page \somepagefloat -\installfloathandler \v!leftpage \someleftpagefloat -\installfloathandler \v!rightpage \somerightpagefloat -\installfloathandler \v!inmargin \someinmarginfloat -\installfloathandler \v!inleft \someinleftmarginfloat -\installfloathandler \v!inright \someinrightmarginfloat -\installfloathandler \v!leftmargin \someinleftmarginfloat -\installfloathandler \v!rightmargin \someinrightmarginfloat -\installfloathandler \v!leftedge \someinleftedgefloat -\installfloathandler \v!rightedge \someinrightedgefloat - -\installfloathandler \v!somewhere \somesomewherefloat - -\installfloathandler \v!backspace \somebackspacefloat -\installfloathandler \v!cutspace \somecutspacefloat - -\installfloathandler {tblr} \someslotfloat -\installfloathandler {lrtb} \someslotfloat -\installfloathandler {tbrl} \someslotfloat -\installfloathandler {rltb} \someslotfloat -\installfloathandler {btlr} \someslotfloat -\installfloathandler {lrbt} \someslotfloat -\installfloathandler {btrl} \someslotfloat -\installfloathandler {rlbt} \someslotfloat -\installfloathandler {fxtb} \someslotfloat -\installfloathandler {fxbt} \someslotfloat +\installfloatmethod \v!here \someherefloat +\installfloatmethod \v!force \somefixdfloat +\installfloatmethod \v!left \someleftsidefloat +\installfloatmethod \v!right \somerightsidefloat +\installfloatmethod \v!text \sometextfloat +\installfloatmethod \v!top \sometopfloat +\installfloatmethod \v!bottom \somebottomfloat +\installfloatmethod \v!auto \someautofloat +\installfloatmethod \v!margin \somemarginfloat +\installfloatmethod \v!opposite \somefacefloat +\installfloatmethod \v!page \somepagefloat +\installfloatmethod \v!leftpage \someleftpagefloat +\installfloatmethod \v!rightpage \somerightpagefloat +\installfloatmethod \v!inmargin \someinmarginfloat +\installfloatmethod \v!inleft \someinleftmarginfloat +\installfloatmethod \v!inright \someinrightmarginfloat +\installfloatmethod \v!leftmargin \someinleftmarginfloat +\installfloatmethod \v!rightmargin \someinrightmarginfloat +\installfloatmethod \v!leftedge \someinleftedgefloat +\installfloatmethod \v!rightedge \someinrightedgefloat + +\installfloatmethod \v!somewhere \somesomewherefloat + +\installfloatmethod \v!backspace \somebackspacefloat +\installfloatmethod \v!cutspace \somecutspacefloat + +\installfloatmethod {tblr} \someslotfloat +\installfloatmethod {lrtb} \someslotfloat +\installfloatmethod {tbrl} \someslotfloat +\installfloatmethod {rltb} \someslotfloat +\installfloatmethod {btlr} \someslotfloat +\installfloatmethod {lrbt} \someslotfloat +\installfloatmethod {btrl} \someslotfloat +\installfloatmethod {rlbt} \someslotfloat +\installfloatmethod {fxtb} \someslotfloat +\installfloatmethod {fxbt} \someslotfloat % no \registerotrcommand\placesome* here!, this has to be cleaned up: @@ -1930,7 +1934,7 @@ %\c!after=\blank, \c!inbetween=\blank] -\installfloathandler \v!local \somelocalfloat +\installfloatmethod \v!local \somelocalfloat \initializeboxstack{localfloats} diff --git a/tex/context/base/strc-itm.mkvi b/tex/context/base/strc-itm.mkvi index 6d04f27ed..2cf31d83e 100644 --- a/tex/context/base/strc-itm.mkvi +++ b/tex/context/base/strc-itm.mkvi @@ -193,7 +193,7 @@ \newsignal \d_strc_itemgroups_signal -\newbox \b_itemgroups +\newbox \b_strc_itemgroups \newdimen \d_strc_itemgroups_list_width \newdimen \d_strc_itemgroups_asked_width @@ -1073,7 +1073,7 @@ \startitemgroupitem} \unexpanded\def\strc_itemgroups_start_dummy - {\strc_itemgroups_start_symbol\strut\strut} + {\strc_itemgroups_start_symbol\strut\strut} % two ? \unexpanded\def\strc_itemgroups_start_subitem {\settrue\c_strc_itemgroups_sub @@ -1151,14 +1151,14 @@ \fi\fi} \def\strc_itemgroups_handle_text_item - {\scratchdimen\wd\b_itemgroups + {\scratchdimen\wd\b_strc_itemgroups \advance \scratchdimen \itemgroupparameter\c!distance\relax \ifdim\scratchdimen>\d_strc_itemgroups_list_width \advance\scratchdimen -\d_strc_itemgroups_list_width \else \scratchdimen\zeropoint \fi - \llap{\hbox to \d_strc_itemgroups_list_width{\ifconditional\c_strc_itemgroups_sub\llap{+\enspace}\fi\box\b_itemgroups\hss}}% was: \hfill + \llap{\hbox to \d_strc_itemgroups_list_width{\ifconditional\c_strc_itemgroups_sub\llap{+\enspace}\fi\box\b_strc_itemgroups\hss}}% was: \hfill \hskip\scratchdimen} \def\strc_itemgroups_handle_lapped_item_positive @@ -1168,7 +1168,7 @@ \llap{+\enspace}% \fi \strc_itemgroups_left_sym_filler - \box\b_itemgroups % can already have a forced widt, only factor handled here + \box\b_strc_itemgroups % can already have a forced widt, only factor handled here \hfil \hskip\itemgroupparameter\c!distance}}} @@ -1177,7 +1177,7 @@ {\ifconditional\c_strc_itemgroups_sub \llap{+\enspace}% \fi - \box\b_itemgroups + \box\b_strc_itemgroups \hskip\leftmargindistance}} \def\strc_itemgroups_handle_groups_text_item @@ -1185,7 +1185,7 @@ {\ifconditional\c_strc_itemgroups_sub +\enspace \fi - \box\b_itemgroups + \box\b_strc_itemgroups \hskip\interwordspace}% \nobreak} @@ -1194,7 +1194,7 @@ {\ifconditional\c_strc_itemgroups_sub \llap{+\enspace}% \fi - \box\b_itemgroups + \box\b_strc_itemgroups \hss}} % was: \hfill \unexpanded\def\strc_itemgroups_start_head_sym#text% @@ -1203,7 +1203,7 @@ \strc_itemgroups_start_head} \def\strc_itemgroups_make_symbol_box - {\setbox\b_itemgroups\hbox + {\setbox\b_strc_itemgroups\hbox {\ifconditional\c_strc_itemgroups_head \ifx\strc_itemgroups_extra_symbol\empty \useitemgroupstyleandcolor\c!headstyle\c!headcolor @@ -1225,26 +1225,26 @@ \fi}} \def\strc_itemgroups_make_fitting_box - {\ifdim\wd\b_itemgroups>\itemgroupparameter\c!maxwidth\scaledpoint\relax % brr, sp - \normalexpanded{\global\setitemgroupparameter{\c!maxwidth}{\number\wd\b_itemgroups}}% + {\ifdim\wd\b_strc_itemgroups>\itemgroupparameter\c!maxwidth\scaledpoint\relax % brr, sp + \normalexpanded{\global\setitemgroupparameter{\c!maxwidth}{\number\wd\b_strc_itemgroups}}% \fi \ifdim\d_strc_itemgroups_max_width>\zeropoint - \setbox\b_itemgroups\simplealignedbox + \setbox\b_strc_itemgroups\simplealignedbox {\dimexpr\d_strc_itemgroups_max_width+\itemgroupparameter\c!distance\relax} {\itemgroupparameter\c!itemalign} - {\box\b_itemgroups\hskip\itemgroupparameter\c!distance}% + {\box\b_strc_itemgroups\hskip\itemgroupparameter\c!distance}% \fi} \def\strc_itemgroups_make_aligned_box {\doifsomething{\itemgroupparameter\c!itemalign} - {\setbox\b_itemgroups\simplealignedbox + {\setbox\b_strc_itemgroups\simplealignedbox {\dimexpr\d_strc_itemgroups_asked_width+\itemgroupparameter\c!distance\relax} {\itemgroupparameter\c!itemalign} - {\box\b_itemgroups\hskip\itemgroupparameter\c!distance}}} + {\box\b_strc_itemgroups\hskip\itemgroupparameter\c!distance}}} \def\strc_itemgroups_make_destination_box {\iftrialtypesetting \else \ifx\m_strc_itemgroups_destination\empty \else - \setbox\b_itemgroups\hbox{\directgotobox{\box\b_itemgroups}[\m_strc_itemgroups_destination]}% + \setbox\b_strc_itemgroups\hbox{\directgotobox{\box\b_strc_itemgroups}[\m_strc_itemgroups_destination]}% \fi\fi} \def\strc_itemgroups_check_indenting @@ -1262,9 +1262,9 @@ \ifx\m_strc_itemgroups_repeat_start\empty \let\m_current_itemgroups_repeat_start\currentitemlevel \fi - \setbox\b_itemgroups\hbox to \wd\b_itemgroups + \setbox\b_strc_itemgroups\hbox to \wd\b_strc_itemgroups {\hskip-\d_strc_itemgroups_asked_width - \box\b_itemgroups}% what a hack ! + \box\b_strc_itemgroups}% what a hack ! \fi} \def\strc_itemgroups_insert_item @@ -1288,8 +1288,8 @@ \strc_itemgroups_make_aligned_box \fi\fi \let\m_strc_itemgroups_destination\empty - \ht\b_itemgroups\strutheight % just in case a symbols is not yet available in - \dp\b_itemgroups\strutdepth % the current run (more a mkii mp side artifact) + \ht\b_strc_itemgroups\strutheight % just in case a symbols is not yet available in + \dp\b_strc_itemgroups\strutdepth % the current run (more a mkii mp side artifact) \strc_itemgroups_check_for_repeated \ifdim\d_strc_itemgroups_asked_width<\zeropoint\relax \strc_itemgroups_handle_lapped_item_negative @@ -1320,7 +1320,7 @@ {\let\currentitemreference\empty \strc_itemgroups_increment_item_counter \advance\c_strc_itemgroups_n_of_items\plusone - \setbox\b_itemgroups\hbox + \setbox\b_strc_itemgroups\hbox {\useitemgroupstyleandcolor\c!style\c!color \strc_itemgroups_used_symbol}% \strc_itemgroups_check_for_repeated diff --git a/tex/context/base/strc-mat.mkiv b/tex/context/base/strc-mat.mkiv index 2f834a790..d5f864c90 100644 --- a/tex/context/base/strc-mat.mkiv +++ b/tex/context/base/strc-mat.mkiv @@ -532,7 +532,7 @@ \appendtoks \edef\currentformulagrid{\formulaparameter\c!grid}% \ifx\currentformulagrid\empty \else - \autosetsnapvalue\currentformulagrid + \spac_grids_snap_value_auto\currentformulagrid \fi \to \everybeforedisplayformula diff --git a/tex/context/base/strc-reg.mkiv b/tex/context/base/strc-reg.mkiv index 35f764a75..e36556949 100644 --- a/tex/context/base/strc-reg.mkiv +++ b/tex/context/base/strc-reg.mkiv @@ -641,6 +641,7 @@ {\endgraf \begingroup \dostarttagged\t!register\currentregister + \forgeteverypar \forgetparindent \forgetparskip} diff --git a/tex/context/base/strc-ren.mkiv b/tex/context/base/strc-ren.mkiv index ebf5d5bfe..de8a2da6b 100644 --- a/tex/context/base/strc-ren.mkiv +++ b/tex/context/base/strc-ren.mkiv @@ -133,7 +133,7 @@ \let\currentstructurereferenceattribute\currentreferenceattribute \else\ifx\currentheadinteraction\v!reference % setuphead[<section>][interaction=reference,...] start<section>[backreference=abc,...] - \edef\currentheadbackreference{\structurevariable{references.backreference}}% + \edef\currentheadbackreference{\structurevariable\c!backreference}% weird, was references.backreference \ifx\currentheadbackreference\empty \else \dogetsimplepagereference\currentheadbackreference \let\currentstructurereferenceattribute\currentreferenceattribute @@ -152,7 +152,7 @@ \else \docheckheadreference \setbox\sectionheadbox\ifvertical\vbox\else\hbox\fi \headreferenceattributes - {\dosetlocalgridsnapping{\headparameter\c!internalgrid}% + {\spac_grids_set_local_snapping{\headparameter\c!internalgrid}% \doresettructureheadnumbercontent \useheadstyleparameter\c!style \setinlineheadreferenceattributes @@ -170,7 +170,7 @@ \else % = needed \docheckheadreference \setbox\sectionheadbox\ifvertical\vbox\else\hbox\fi \headreferenceattributes - {\dosetlocalgridsnapping{\headparameter\c!internalgrid}% + {\spac_grids_set_local_snapping{\headparameter\c!internalgrid}% \useheadstyleparameter\c!style \setinlineheadreferenceattributes \headparameter\c!command{\doplaceheadnumbercomponent\getheadnumber}{\doplaceheadtextcomponent\getheadtitle}}% @@ -359,14 +359,17 @@ % \input tufte \par % \stopnarrower +\installcorenamespace{headplacementalternative} +\installcorenamespace{headplacementnature} + \let\numberheadalternative\v!normal \unexpanded\def\defineheadplacement {\dodoubleargument\dodefineheadplacement} % \def\dodefineheadplacement[#1][#2]% #3#4 -% {\setvalue{\??ns:#1}{#2}% -% \setvalue{\??ns::#1}} +% {\setvalue{\??headplacementnature#1}{#2}% +% \setvalue{\??headplacementalternative#1}} % \dodefineheadplacement[sectiona][vertical]{#1->#2} % \dodefineheadplacement[sectionb][vertical]#1#2{#1->#2} @@ -375,12 +378,12 @@ % \setuphead[subsection][alternative=sectionb] \def\dodefineheadplacementyes[#1][#2]%#3#4% - {\setvalue{\??ns:#1}{#2}% - \setvalue{\??ns::#1}##1##2} + {\setvalue{\??headplacementnature#1}{#2}% + \setvalue{\??headplacementalternative#1}##1##2} \def\dodefineheadplacementnop[#1][#2]% - {\setvalue{\??ns:#1}{#2}% - \setvalue{\??ns::#1}} + {\setvalue{\??headplacementnature#1}{#2}% + \setvalue{\??headplacementalternative#1}} \def\dodefineheadplacement[#1][#2]% {\doifnextbgroupelse @@ -388,10 +391,15 @@ {\dodefineheadplacementnop[#1][#2]}} \def\presetnumberheadalternative - {\doifelsevalue{\??ns:\numberheadalternative}\v!horizontal\setfalse\settrue\headisdisplay} + {\doifelsevalue{\??headplacementnature\numberheadalternative}\v!horizontal\setfalse\settrue\headisdisplay} \def\normalplacehead - {\csname\??ns::\ifcsname\??ns::\numberheadalternative\endcsname\numberheadalternative\else\v!normal\fi\endcsname} + {\csname\??headplacementalternative\ifcsname\??headplacementalternative\numberheadalternative\endcsname\numberheadalternative\else\v!normal\fi\endcsname} + +\def\setheaddisplay % used in strc-sec + {\doifelsevalue{\??headplacementnature\headparameter\c!alternative}\v!horizontal + {\setfalse\headisdisplay} + {\settrue \headisdisplay}} \defineheadplacement[\v!paragraph][\v!vertical]#1#2% {\vbox diff --git a/tex/context/base/strc-sec.mkiv b/tex/context/base/strc-sec.mkiv index 695a90bc2..2602759dc 100644 --- a/tex/context/base/strc-sec.mkiv +++ b/tex/context/base/strc-sec.mkiv @@ -350,10 +350,8 @@ {\??headplace\headparameter\c!placehead} {\getvalue{\??headplace\v!yes}}} -\def\setheaddisplay - {\doifelsevalue{\??ns:\headparameter\c!alternative}\v!horizontal - {\setfalse\headisdisplay} - {\settrue \headisdisplay}} + +\ifdefined\setheaddisplay \else \let\setheaddisplay\relax \fi \newmode\v!sectionnumber diff --git a/tex/context/base/syst-aux.mkiv b/tex/context/base/syst-aux.mkiv index 7f680bfae..f30fdceec 100644 --- a/tex/context/base/syst-aux.mkiv +++ b/tex/context/base/syst-aux.mkiv @@ -3392,6 +3392,11 @@ \unexpanded\def\dorecurse#1% {\dostepwiserecurse1{#1}1} +\def\doexpandedrecurse#1#2% + {\ifnum#1>\zerocount + #2\expandafter\doexpandedrecurse\expandafter{\the\numexpr#1-1\relax}{#2}% + \fi} + %D As we can see here, the simple command \type{\dorecurse} is %D a special case of the more general: %D diff --git a/tex/context/base/tabl-tbl.mkiv b/tex/context/base/tabl-tbl.mkiv index 05dfc4412..c07cf10af 100644 --- a/tex/context/base/tabl-tbl.mkiv +++ b/tex/context/base/tabl-tbl.mkiv @@ -955,7 +955,7 @@ \the\everytabulate \tabulateparameter\c!inner \doifelsevalue{\??tt\currenttabulate\c!indenting}\v!yes - {\edef\tabulateindent{\the\dimexpr\leftskip+\hangindent+\parindent}}% \ctxparindent + {\edef\tabulateindent{\the\dimexpr\leftskip+\hangindent+\parindent}}% {\edef\tabulateindent{\the\dimexpr\leftskip+\hangindent }}% \global\tabulatecolumn\zerocount \processcontent{\e!stop#1}\tabulatecontent{\processtabulate[#3]}} % \currenttabulate diff --git a/tex/context/base/typo-cln.lua b/tex/context/base/typo-cln.lua index 56e2681ed..c6a270791 100644 --- a/tex/context/base/typo-cln.lua +++ b/tex/context/base/typo-cln.lua @@ -95,3 +95,7 @@ cleaners.handler = nodes.installattributehandler { namespace = cleaners, processor = process, } + +-- interface + +commands.setcharactercleaning = cleaners.set diff --git a/tex/context/base/typo-cln.mkiv b/tex/context/base/typo-cln.mkiv index 4cf79d078..5306f614f 100644 --- a/tex/context/base/typo-cln.mkiv +++ b/tex/context/base/typo-cln.mkiv @@ -24,7 +24,7 @@ %D 1: Autocap first character of a line \unexpanded\def\setcharactercleaning[#1]% This name might change! - {\ctxlua{typesetters.cleaners.set("#1")}} % also accepts "reset" + {\ctxcommand{setcharactercleaning("#1")}} % also accepts "reset" % \appendtoks % \attribute\cleanerattribute\attributeunsetvalue diff --git a/tex/context/base/typo-krn.lua b/tex/context/base/typo-krn.lua index 3b1a8b413..54b1fd2d3 100644 --- a/tex/context/base/typo-krn.lua +++ b/tex/context/base/typo-krn.lua @@ -24,6 +24,7 @@ local insert_node_before = node.insert_before local insert_node_after = node.insert_after local texattribute = tex.attribute +local unsetvalue = attributes.unsetvalue local nodepool = nodes.pool local tasks = nodes.tasks @@ -264,17 +265,19 @@ end local enabled = false function kerns.set(factor) - if not enabled then - tasks.enableaction("processors","typesetters.kerns.handler") - enabled = true - end if factor ~= 0 then + if not enabled then + tasks.enableaction("processors","typesetters.kerns.handler") + enabled = true + end local a = factors[factor] if not a then a = #mapping + 1 factors[factors], mapping[a] = a, factor end factor = a + else + factor = unsetvalue end texattribute[a_kerns] = factor return factor @@ -289,3 +292,7 @@ kerns.handler = nodes.installattributehandler { namespace = kerns, processor = process, } + +-- interface + +commands.setcharacterkerning = kerns.set diff --git a/tex/context/base/typo-krn.mkiv b/tex/context/base/typo-krn.mkiv index 5d1ed1f79..e1e404a7b 100644 --- a/tex/context/base/typo-krn.mkiv +++ b/tex/context/base/typo-krn.mkiv @@ -23,34 +23,28 @@ % % {\setcharacterkerning[extrakerning]\input davis\relax} -\unexpanded\def\definecharacterkerning - {\dodoubleargument\dodefinecharacterkerning} +\installcorenamespace{characterkerning} -\def\dodefinecharacterkerning[#1][#2]% - {\getparameters[\??ck#1][\c!factor=0.125,#2]% - \setuvalue{\??ck:#1}{\dosetcharacterkerning{#1}}} +\installcommandhandler \??characterkerning {characterkerning} \??characterkerning -\unexpanded\def\setupcharacterkerning - {\dodoubleargument\dosetupcharacterkerning} - -\def\dosetupcharacterkerning[#1][#2]% - {\ifcsname\??ck:#1\endcsname - \getparameters[\??ck#1][#2]% +\unexpanded\def\setcharacterkerning[#1]% + {\edef\currentcharacterkerning{#1}% + \ifx\currentcharacterkerning\s!reset + \resetcharacterkerning \else - \dodefinecharacterkerning[#1][#2]% bonus + \typo_kerning_set \fi} -\unexpanded\def\dosetcharacterkerning#1% - {\ctxlua{typesetters.kerns.set(\csname\??ck#1\c!factor\endcsname)}} +% \def\typo_kerning_set +% {\ctxcommand{setcharacterkerning(\characterkerningparameter\c!factor)}} -\unexpanded\def\setcharacterkerning[#1]% - {\csname\??ck:#1\endcsname} +\def\typo_kerning_set + {\usecharacterkerningstyleandcolor\c!style\c!color % goodie, maybe also strut + \ctxcommand{setcharacterkerning(\characterkerningparameter\c!factor)}} \unexpanded\def\resetcharacterkerning % fast one {\attribute\kernattribute\attributeunsetvalue} -\letvalue{\??ck\s!reset\c!factor}\attributeunsetvalue % trick - \appendtoks \resetcharacterkerning \to \everyresettypesetting @@ -65,23 +59,32 @@ %D \stoptyping %D %D We could combine this with the previous definition command but -%D then we alwasy would get a command defined which is not beforehand +%D then we always would get a command defined which is not beforehand %D a good idea. \def\v!kerncharacters{kerncharacters} % no time now for translations \definecharacterkerning [\v!kerncharacters] [\c!factor=.125] +% Here we need to keep the groupedcommand solution as it is +% used as modifier. + \unexpanded\def\kerncharacters - {\dosingleempty\dokerncharacters} + {\doifnextoptionalelse\typo_kerning_apply_yes\typo_kerning_apply_nop} + +\def\typo_kerning_apply_yes[#1]% + {\groupedcommand{\typo_kerning_apply_yes_indeed{#1}}\donothing} + +\def\typo_kerning_apply_nop + {\groupedcommand\typo_kerning_apply_nop_indeed\donothing} -\def\dokerncharacters[#1]% - {\groupedcommand{\dodokerncharacters{#1}}\donothing} +\def\typo_kerning_apply_yes_indeed#1% + {\let\currentcharacterkerning\v!kerncharacters + \setupcurrentcharacterkerning[\c!factor=#1]% + \typo_kerning_set} -\def\dodokerncharacters#1% - {\iffirstargument - \setupcharacterkerning[\v!kerncharacters][\c!factor=#1]% - \fi - \setcharacterkerning[\v!kerncharacters]} +\def\typo_kerning_apply_nop_indeed + {\let\currentcharacterkerning\v!kerncharacters + \typo_kerning_set} \protect \endinput diff --git a/tex/context/base/typo-spa.lua b/tex/context/base/typo-spa.lua index e81a59bda..5b80c7178 100644 --- a/tex/context/base/typo-spa.lua +++ b/tex/context/base/typo-spa.lua @@ -6,8 +6,6 @@ if not modules then modules = { } end modules ['typo-spa'] = { license = "see context related readme files" } --- get rid of tex.scale here - local utf = unicode.utf8 local next, type = next, type @@ -30,10 +28,14 @@ local fontdata = fonthashes.identifiers local quaddata = fonthashes.quads local texattribute = tex.attribute +local unsetvalue = attributes.unsetvalue local nodecodes = nodes.nodecodes local glyph_code = nodecodes.glyph +local somespace = nodes.somespace +local somepenalty = nodes.somepenalty + local nodepool = nodes.pool local tasks = nodes.tasks @@ -47,13 +49,25 @@ typesetters.spacings = typesetters.spacings or { } local spacings = typesetters.spacings spacings.mapping = spacings.mapping or { } +spacings.numbers = spacings.numbers or { } + local a_spacings = attributes.private("spacing") spacings.attribute = a_spacings storage.register("typesetters/spacings/mapping", spacings.mapping, "typesetters.spacings.mapping") +local mapping = spacings.mapping +local numbers = spacings.numbers + +for i=1,#mapping do + local m = mapping[i] + numbers[m.name] = m +end + +-- todo cache lastattr + local function process(namespace,attribute,head) - local done, mapping = false, spacings.mapping + local done = false local start = head -- head is always begin of par (whatsit), so we have at least two prev nodes -- penalty followed by glue @@ -61,9 +75,9 @@ local function process(namespace,attribute,head) if start.id == glyph_code then local attr = has_attribute(start,attribute) if attr and attr > 0 then - local map = mapping[attr] - if map then - map = map[start.char] + local data = mapping[attr] + if data then + local map = data.characters[start.char] unset_attribute(start,attribute) -- needed? if map then local left = map.left @@ -74,33 +88,33 @@ local function process(namespace,attribute,head) if left and left ~= 0 and prev then local ok = false if alternative == 1 then - local somespace = nodes.somespace(prev,true) + local somespace = somespace(prev,true) if somespace then local prevprev = prev.prev - local somepenalty = nodes.somepenalty(prevprev,10000) + local somepenalty = somepenalty(prevprev,10000) if somepenalty then if trace_spacing then report_spacing("removing penalty and space before %s (left)", utfchar(start.char)) end - head, _ = remove_node(head,prev,true) - head, _ = remove_node(head,prevprev,true) + head = remove_node(head,prev,true) + head = remove_node(head,prevprev,true) else if trace_spacing then report_spacing("removing space before %s (left)", utfchar(start.char)) end - head, _ = remove_node(head,prev,true) + head = remove_node(head,prev,true) end end ok = true else - ok = not (nodes.somespace(prev,true) and nodes.somepenalty(prev.prev,true)) or nodes.somespace(prev,true) + ok = not (somespace(prev,true) and somepenalty(prev.prev,true)) or somespace(prev,true) end if ok then if trace_spacing then report_spacing("inserting penalty and space before %s (left)", utfchar(start.char)) end insert_node_before(head,start,new_penalty(10000)) - insert_node_before(head,start,new_glue(tex.scale(quad,left))) + insert_node_before(head,start,new_glue(left*quad)) done = true end end @@ -108,35 +122,35 @@ local function process(namespace,attribute,head) if right and right ~= 0 and next then local ok = false if alternative == 1 then - local somepenalty = nodes.somepenalty(next,10000) + local somepenalty = somepenalty(next,10000) if somepenalty then local nextnext = next.next - local somespace = nodes.somespace(nextnext,true) + local somespace = somespace(nextnext,true) if somespace then if trace_spacing then report_spacing("removing penalty and space after %s (right)", utfchar(start.char)) end - head, _ = remove_node(head,next,true) - head, _ = remove_node(head,nextnext,true) + head = remove_node(head,next,true) + head = remove_node(head,nextnext,true) end else - local somespace = nodes.somespace(next,true) + local somespace = somespace(next,true) if somespace then if trace_spacing then report_spacing("removing space after %s (right)", utfchar(start.char)) end - head, _ = remove_node(head,next,true) + head = remove_node(head,next,true) end end ok = true else - ok = not (nodes.somepenalty(next,10000) and nodes.somespace(next.next,true)) or nodes.somespace(next,true) + ok = not (somepenalty(next,10000) and somespace(next.next,true)) or somespace(next,true) end if ok then if trace_spacing then report_spacing("inserting penalty and space after %s (right)", utfchar(start.char)) end - insert_node_after(head,start,new_glue(tex.scale(quad,right))) + insert_node_after(head,start,new_glue(right*quad)) insert_node_after(head,start,new_penalty(10000)) done = true end @@ -152,26 +166,42 @@ end local enabled = false -function spacings.setup(id,char,left,right,alternative) - local mapping = spacings.mapping[id] - if not mapping then - mapping = { } - spacings.mapping[id] = mapping +function spacings.define(name) + local data = numbers[name] + if data then + -- error + else + local number = #mapping + 1 + local data = { + name = name, + number = number, + characters = { }, + } + mapping[number] = data + numbers[name] = data end - local map = mapping[char] - if not map then - map = { } - mapping[char] = map +end + +function spacings.setup(name,char,settings) + local data = numbers[name] + if not data then + -- error + else + data.characters[char] = settings end - map.left, map.right, map.alternative = left, right, alternative end -function spacings.set(id) +function spacings.set(name) if not enabled then tasks.enableaction("processors","typesetters.spacings.handler") enabled = true end - texattribute[a_spacings] = id + local data = numbers[name] + texattribute[a_spacings] = data and data.number or unsetvalue +end + +function spacings.reset() + texattribute[a_spacings] = unsetvalue end spacings.handler = nodes.installattributehandler { @@ -179,3 +209,9 @@ spacings.handler = nodes.installattributehandler { namespace = spacings, processor = process, } + +-- interface + +commands.definecharacterspacing = spacings.define +commands.setupcharacterspacing = spacings.setup +commands.setcharacterspacing = spacings.set diff --git a/tex/context/base/typo-spa.mkiv b/tex/context/base/typo-spa.mkiv index b660d54a9..0cfe44610 100644 --- a/tex/context/base/typo-spa.mkiv +++ b/tex/context/base/typo-spa.mkiv @@ -23,33 +23,32 @@ % % test: oeps {\setcharacterspacing[frenchpunctuation]x: xx \bfd x: xx} oeps: test -\newcount \maxcharacterspacingid +\installcorenamespace{characterspacing} + +\definesystemvariable{cs} % maybe a dummy namespace \unexpanded\def\definecharacterspacing[#1]% - {\ifcsname\??ch#1\endcsname \else - \global\advance\maxcharacterspacingid\plusone - \setxvalue{\??ch:#1}{\the\maxcharacterspacingid}% - \fi} + {\ctxcommand{definecharacterspacing("#1")}} \unexpanded\def\setupcharacterspacing - {\dotripleargument\dosetupcharacterspacing} + {\dotripleargument\typo_characterspacing_setup} -\def\dosetupcharacterspacing[#1][#2][#3]% - {\ifcsname\??ch:#1\endcsname - \begingroup % for the moment we use modes, in ordere to avoid interface translation - \getparameters[\??ch][\c!left=0,\c!right=0,\c!alternative=0,#3]% - \ctxlua{typesetters.spacings.setup(\getvalue{\??ch:#1},\number#2,\@@chleft,\@@chright,\@@chalternative)}% - \endgroup - \fi} +\def\typo_characterspacing_setup[#1][#2][#3]% todo: #2 list + {\begingroup + \getparameters[\??cs][\c!left=0,\c!right=0,\c!alternative=0,#3]% + \ctxcommand{setupcharacterspacing("#1",\number#2, { + left = \@@csleft, + right = \@@csright, + alternative = \@@csalternative + })}% + \endgroup} -\unexpanded\def\setcharacterspacing[#1]% - {\ctxlua{typesetters.spacings.set(\number\csname\??ch:#1\endcsname)}} +\unexpanded\def\setcharacterspacing[#1]% we can store the attribute if we want speed + {\ctxcommand{setcharacterspacing("#1")}} \unexpanded\def\resetcharacterspacing % fast one {\attribute\spacingattribute\attributeunsetvalue} -\letvalue{\??ch:\s!reset}\attributeunsetvalue - \appendtoks \resetcharacterspacing \to \everyresettypesetting diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index e8e2e258a..491bb9873 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 : 01/09/12 10:08:43 +-- merge date : 01/11/12 10:58:01 do -- begin closure to overcome local limits and interference |