diff options
author | Marius <mariausol@gmail.com> | 2011-12-20 23:40:14 +0200 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2011-12-20 23:40:14 +0200 |
commit | 7fae0cf32304ce28517c4d1b71839434efbf490e (patch) | |
tree | 1ce5c5cae44089f6bbf707d1b57aff9c68421cf2 /tex | |
parent | e2625b97c862af5ac816883310fdf8c775a3e8f9 (diff) | |
download | context-7fae0cf32304ce28517c4d1b71839434efbf490e.tar.gz |
beta 2011.12.20 22:24
Diffstat (limited to 'tex')
54 files changed, 1041 insertions, 1283 deletions
diff --git a/tex/context/base/anch-pos.mkiv b/tex/context/base/anch-pos.mkiv index cd664ed40..898607cb4 100644 --- a/tex/context/base/anch-pos.mkiv +++ b/tex/context/base/anch-pos.mkiv @@ -208,9 +208,9 @@ %D position as well as execute an action associated with that %D position. -\let\dopositionaction\gobbleoneargument +\let\dopositionaction\gobbleoneargument % implemented later -\def\initializenextposition +\def\positions_initialize {\ifpositioning \else \global\positioningtrue \dosetpositionpapersize\printpaperwidth\printpaperheight @@ -224,7 +224,7 @@ \fi} \def\positions_set_only_indeed#1% - {\initializenextposition + {\positions_initialize \edef\currentposition{#1}% \dosetposition\currentposition} @@ -236,7 +236,7 @@ \fi} \def\positions_set_indeed#1% - {\initializenextposition + {\positions_initialize \edef\currentposition{#1}% \dosetposition\currentposition \traceposstring\llap\green{\currentposition>}% @@ -250,7 +250,7 @@ \fi} \def\positions_set_data_indeed#1#2#3#4% - {\initializenextposition + {\positions_initialize \hbox {\edef\currentposition{#1}% \dosetpositionwhd\currentposition{#2}{#3}{#4}% already \the\dimexpr @@ -272,7 +272,7 @@ {\dowithnextbox{\positions_set_box_finish{#1}}} \def\positions_set_box_finish#1% - {\initializenextposition + {\positions_initialize \hbox to \wd\nextbox {\edef\currentposition{#1}% \dosetpositionwhd\currentposition{\wd\nextbox}{\ht\nextbox}{\dp\nextbox}% already \the\dimexpr @@ -290,7 +290,7 @@ \fi} \def\positions_set_plus_indeed#1#2#3#4#5% - {\initializenextposition + {\positions_initialize \hbox % just package {\edef\currentposition{#1}% \dosetpositionplus\currentposition{#2}{#3}{#4}{#5}% already \the\dimexpr @@ -312,7 +312,7 @@ {\dowithnextbox{\positions_set_plus_yes_finish{#1}{#2}}} \def\positions_set_plus_yes_finish#1#2% - {\initializenextposition + {\positions_initialize \hbox to \nextboxwd {\edef\currentposition{#1}% \dosetpositionplus\currentposition{\wd\nextbox}{\ht\nextbox}{\dp\nextbox}{#2}% @@ -366,7 +366,7 @@ %D Each macro takes an identifier as argument, and the \type %D {\hpos} and \type {\vpos} also expect box content. -% \def\xypos{\initializenextposition\dosetposition} +% \def\xypos{\positions_initialize\dosetposition} \let\xypos\setpositiononly diff --git a/tex/context/base/bibl-bib.mkiv b/tex/context/base/bibl-bib.mkiv index 6144015ad..5aaf45825 100644 --- a/tex/context/base/bibl-bib.mkiv +++ b/tex/context/base/bibl-bib.mkiv @@ -730,7 +730,7 @@ {\dontleavehmode \begingroup \bibtexcitationparameter\v!left - \penalty\!!tenthousand + \penalty\plustenthousand \ctxlua{bibtex.hacks.resolve("","\number\bibtexblock","#1")}% \bibtexcitationparameter\v!right \endgroup} diff --git a/tex/context/base/bibl-tra.mkiv b/tex/context/base/bibl-tra.mkiv index d3336ecf2..0e26d8ed0 100644 --- a/tex/context/base/bibl-tra.mkiv +++ b/tex/context/base/bibl-tra.mkiv @@ -1430,7 +1430,7 @@ \def\bibnumref[#1]% {\begingroup \bibalternative\v!left - \penalty\!!tenthousand + \penalty\plustenthousand \ctxlua{bibtex.hacks.resolve("","\number\bibtexblock","#1")}% \bibalternative\v!right \endgroup} diff --git a/tex/context/base/buff-ver.lua b/tex/context/base/buff-ver.lua index e35545605..9961a73f6 100644 --- a/tex/context/base/buff-ver.lua +++ b/tex/context/base/buff-ver.lua @@ -411,34 +411,6 @@ function visualizers.registerescapepattern(name,befores,afters,normalmethod,esca return escapepattern end ---~ function visualizers.registerescapeline(name,before,normalmethod,escapemethod,processor) ---~ local escapepattern = escapepatterns[name] ---~ if not escapepattern then ---~ before = type(before) == "table" and before [1] or before ---~ processor = type(processor) == "table" and processor[1] or processor ---~ if trace_visualize then ---~ report_visualizers("registering escape line pattern, name: '%s', before: '%s', after: <<newline>>",name,before) ---~ end ---~ before = P(before) * space_pattern ---~ after = space_pattern * P("\n") ---~ local action ---~ if processor then ---~ action = function(s) apply_processor(processor,s) end ---~ else ---~ action = escapemethod or texmethod ---~ end ---~ escapepattern = ( ---~ (before / "") ---~ * ((1 - after)^0 / action) ---~ * (space_pattern / "") ---~ -- * (after / (normalmethod or defaultmethod)) ---~ + hack((1 - before)^1) / (normalmethod or defaultmethod) ---~ )^0 ---~ escapepatterns[name] = escapepattern ---~ end ---~ return escapepattern ---~ end - function visualizers.registerescapeline(name,befores,normalmethod,escapemethod,processors) local escapepattern = escapepatterns[name] if not escapepattern then diff --git a/tex/context/base/buff-ver.mkiv b/tex/context/base/buff-ver.mkiv index 8b9c98a28..2e8311fc2 100644 --- a/tex/context/base/buff-ver.mkiv +++ b/tex/context/base/buff-ver.mkiv @@ -141,14 +141,11 @@ \installcommandhandler \??tp {typing} \??tp \appendtoks - \normalexpanded{\dodefinetyping{\currenttyping}}% + \setuevalue{\e!start#1}{\dostarttyping{\currenttyping}}% + \setuevalue{\e!stop #1}{\dostoptyping {\currenttyping}}% \normalexpanded{\definelinenumbering[\currenttyping]}% \to \everydefinetyping -\unexpanded\def\dodefinetyping#1% - {\setvalue{\e!start#1}{\dostarttyping{#1}}% - \setvalue{\e!stop #1}{\dostoptyping {#1}}} - \appendtoks \doinitializevisualizer{\typingparameter\c!option}% we can check at the tex end \to \everysetuptyping @@ -266,9 +263,9 @@ \def\dodotypeone {\ifx\next\bgroup - \@EA\dodotypeA + \expandafter\dodotypeA \else - \@EA\dodotypetwo + \expandafter\dodotypetwo \fi} \def\dodotypetwo @@ -278,9 +275,9 @@ \def\dodotypethree {\if\next<% - \@EA\dodotypeB + \expandafter\dodotypeB \else - \@EA\dodotypeC + \expandafter\dodotypeC \fi} \def\dodotypeA @@ -392,7 +389,7 @@ \let\beginofverbatimlines\relax \let\endofverbatimlines \relax -\def\dostarttyping#1% tricky non standard lookahead +\unexpanded\def\dostarttyping#1% tricky non standard lookahead {\bgroup \edef\currenttyping{#1}% \obeylines @@ -406,7 +403,11 @@ \fi} \def\nododostarttyping - {\dododostarttyping[]} + {\typingparameter\c!before + \startpacked[\v!blank] + \dosetuptypelinenumbering + \firststageinitializetyping + \normalexpanded{\dotypeblockverbatim{\e!start\currenttyping}{\e!stop\currenttyping}}} \def\dododostarttyping[#1]% {\typingparameter\c!before @@ -440,7 +441,7 @@ \dostoptagged \csname#2\endcsname} -\def\dostoptyping#1% hm, currenttyping +\unexpanded\def\dostoptyping#1% hm, currenttyping {\stoppacked \typingparameter\c!after \normalexpanded{\egroup\checknextindentation[\typingparameter\c!indentnext]}% @@ -617,31 +618,34 @@ %D but they also default to the values below. Watch the %D alternative escape character. +% \tttf gives problems with {\tx \type...} +% \tt\tf does not adapt to e.g. \bf + \setuptyping - [ \c!before=\blank, - \c!after=\blank, - %\c!bodyfont=, - %\c!color=, - \c!space=\v!off, - \c!page=\v!no, - \c!tab=\v!yes, % what is this: \s!ascii ? - \c!option=\v!none, - \c!text=\v!no, - \c!style=\tttf, - \c!indentnext=\v!yes, - \c!margin=\!!zeropoint, - \c!evenmargin=\!!zeropoint, - \c!oddmargin=\!!zeropoint, - \c!blank=\v!line, - %\c!escape=, % yes | no | {START,STOP} | default when yes: {BTEX,ETEX} - \c!numbering=\v!no, - %\c!lines=, - %\c!range=, - \c!start=1, - %\c!stop=, - \c!step=1, - %\c!continue=, - \c!strip=\v!no] %auto or number + [\c!before=\blank, + \c!after=\blank, + %\c!bodyfont=, + %\c!color=, + \c!space=\v!off, + \c!page=\v!no, + \c!tab=\v!yes, % what is this: \s!ascii ? + \c!option=\v!none, + \c!text=\v!no, + \c!style=\tt, + \c!indentnext=\v!yes, + \c!margin=\!!zeropoint, + \c!evenmargin=\!!zeropoint, + \c!oddmargin=\!!zeropoint, + \c!blank=\v!line, + %\c!escape=, % yes | no | {START,STOP} | default when yes: {BTEX,ETEX} + \c!numbering=\v!no, + %\c!lines=, + %\c!range=, + \c!start=1, + %\c!stop=, + \c!step=1, + %\c!continue=, + \c!strip=\v!no] % auto or number \definetyping[\v!typing] @@ -651,12 +655,12 @@ %D The setups for inline verbatim default to: \setuptype - [ \c!space=\v!off, - %\c!color=, - \c!style=\tt\tf, % \tttf gives problems with {\tx \type...} + [\c!space=\v!off, + %\c!color=, + \c!style=\tt, %\c!option=\v!normal, - \c!page=\v!no, - \c!tab=\v!yes] + \c!page=\v!no, + \c!tab=\v!yes] %D Buffers @@ -669,10 +673,7 @@ {\dotripleempty\dodotypedefinedbuffer} \appendtoks - \setuevalue{\e!type\currentbuffer}% - {\noexpand\dotypedefinedbuffer - [\v!buffer]% - [def-\number\nofdefinedbuffers]}% + \setuevalue{\e!type\currentbuffer}{\noexpand\dotypedefinedbuffer[\v!buffer][def-\number\nofdefinedbuffers]}% \to \everydefinebuffer \def\dotypebuffer[#1][#2]% diff --git a/tex/context/base/catc-ini.mkiv b/tex/context/base/catc-ini.mkiv index 01814597b..fc4af92d1 100644 --- a/tex/context/base/catc-ini.mkiv +++ b/tex/context/base/catc-ini.mkiv @@ -58,12 +58,12 @@ \setnewconstant\tildeasciicode 126 % `\~ \setnewconstant\delasciicode 127 -\bgroup +\begingroup \catcode \tabasciicode \activecatcode \gdef\activetabtoken {^^I} \gdef\outputnewlinechar {^^J} \catcode \formfeedasciicode \activecatcode \gdef\activeformfeedtoken {^^L} \catcode \endoflineasciicode \activecatcode \gdef\activeendoflinetoken{^^M} -\egroup +\endgroup % \endlinechar = \endoflineasciicode % appended to input lines % \newlinechar = \newlineasciicode % can be used in write @@ -71,10 +71,10 @@ % rather special and used in writing to file: \let\par\outputnewlinechar \def\initializenewlinechar % operating system dependent - {\bgroup + {\begingroup \newlinechar\newlineasciicode \xdef\outputnewlinechar{^^J}% - \egroup} + \endgroup} \ifx\gobbleoneargument\undefined \long\def\gobbleoneargument#1{} \fi @@ -105,12 +105,12 @@ \catcode\delasciicode \othercatcode} \long\normalprotected\def\startcatcodetable#1#2\stopcatcodetable - {\bgroup + {\begingroup \catcodetable\scratchcatcodes \the\setdefaultcatcodes #2% \savecatcodetable#1\relax - \egroup} + \endgroup} \def\permitcircumflexescape % to be used grouped {\catcode\circumflexasciicode\superscriptcatcode} @@ -120,12 +120,12 @@ \newcatcodetable\dummycatcodes \long\normalprotected\def\startextendcatcodetable#1#2\stopextendcatcodetable - {\bgroup + {\begingroup \catcodetable#1\relax \globaldefs\plusone #2% \globaldefs\zerocount - \egroup} + \endgroup} % == % @@ -213,18 +213,18 @@ \def\reinstatecatcodecommand{\afterassignment\reinstatecatcodecommanda\cctcounterb} \def\reinstatecatcodecommanda % can be used when a direct definition has been done - {\bgroup % and the selector has been lost + {\begingroup % and the selector has been lost \uccode\activehackcode\cctcounterb \catcode\uccode\activehackcode\activecatcode \uppercase{\xdef~{\noexpand\catcodecommand{\number\cctcounterb}}}% - \egroup} + \endgroup} \def\reinstatecatcodecommandua % can be used when a direct definition has been done - {\bgroup % and the selector has been lost + {\begingroup % and the selector has been lost \uccode\activehackcode\cctcounterb \catcode\uccode\activehackcode\activecatcode \uppercase{\normalprotected\xdef~{\noexpand\catcodecommand{\number\cctcounterb}}}% - \egroup} + \endgroup} \newconstant\defaultcatcodetable @@ -337,7 +337,7 @@ % \newcount\catcodetablelevel % % \def\pushcatcodes -% {\bgroup +% {\begingroup % \global\advance\catcodetablelevel\plusone % \ifcsname @@ccf:\number\catcodetablelevel\endcsname \else % \global\advance\cctdefcounter\plusone @@ -345,11 +345,10 @@ % \fi % \catcodetable\ctxcatcodes % \expandafter\savecatcodetable\csname @@ccf:\number\catcodetablelevel\endcsname -% \egroup +% \endgroup % \expandafter\catcodetable\csname @@ccf:\number\catcodetablelevel\endcsname} % % \def\popcatcodes % {\global\advance\catcodetablelevel\minusone} \endinput - diff --git a/tex/context/base/colo-ini.mkiv b/tex/context/base/colo-ini.mkiv index f569c4b40..a6ed41f84 100644 --- a/tex/context/base/colo-ini.mkiv +++ b/tex/context/base/colo-ini.mkiv @@ -68,10 +68,6 @@ \newif\ifconverttoGRAY \newif\ifweightGRAY \weightGRAYtrue -\newif\ifconvertMPcolors -\newif\ifreduceMPcolors -\newif\ifforcegrayMPcolors - %D The last boolean controls reduction of \cap{CMYK} to %D \cap{CMY} colors. When set to true, the black component %D is added to the other ones. @@ -260,17 +256,11 @@ \weightGRAYfalse \weightGRAYtrue \doifelse\@@clrgb\v!no - {\ifRGBsupported \showcolormessage\m!colors {9}\v!rgb \RGBsupportedfalse \fi} - {\ifRGBsupported \else\showcolormessage\m!colors{10}\v!rgb \RGBsupportedtrue \fi}% + {\ifRGBsupported \showcolormessage\m!colors {9}\v!rgb \RGBsupportedfalse \fi} + {\ifRGBsupported \else\showcolormessage\m!colors{10}\v!rgb \RGBsupportedtrue \fi}% \doifelse\@@clcmyk\v!no - {\ifCMYKsupported \showcolormessage\m!colors {9}\v!cmyk \CMYKsupportedfalse\fi} - {\ifCMYKsupported\else\showcolormessage\m!colors{10}\v!cmyk \CMYKsupportedtrue \fi}% - \doifelse\@@clmpcmyk\v!no - {\ifMPcmykcolors \showcolormessage\m!colors {9}{\v!mp\v!cmyk}\MPcmykcolorsfalse \fi} - {\ifMPcmykcolors \else\showcolormessage\m!colors{10}{\v!mp\v!cmyk}\MPcmykcolorstrue \fi}% - \doifelse\@@clmpspot\v!no - {\ifMPspotcolors \showcolormessage\m!colors {9}{\v!mp\v!spot}\MPspotcolorsfalse \fi} - {\ifMPspotcolors \else\showcolormessage\m!colors{10}{\v!mp\v!spot}\MPspotcolorstrue \fi}% + {\ifCMYKsupported \showcolormessage\m!colors {9}\v!cmyk\CMYKsupportedfalse\fi} + {\ifCMYKsupported\else\showcolormessage\m!colors{10}\v!cmyk\CMYKsupportedtrue \fi}% \preferGRAYfalse \convertGRAYtrue \processaction @@ -281,23 +271,14 @@ \v!always=>\preferGRAYtrue\RGBsupportedfalse\CMYKsupportedfalse]% \ifRGBsupported \converttoGRAYfalse - \forcegrayMPcolorsfalse \else\ifCMYKsupported \converttoGRAYfalse - \forcegrayMPcolorsfalse - \convertMPcolorstrue - \ifreduceCMYK - \reduceMPcolorstrue - \fi \else \ifconverttoGRAY\else\showcolormessage\m!colors{11}\empty\fi \converttoGRAYtrue - \forcegrayMPcolorstrue - \convertMPcolorsfalse - \reduceMPcolorsfalse \fi\fi \doifelse\@@clstate\v!stop - {\incolorfalse\forcegrayMPcolorstrue}% + {\incolorfalse}% {\incolortrue\let\@@clstate\v!start}% \dosetupcolormodel \the\everysetupcolors} @@ -649,7 +630,7 @@ {\edef#1{\negatedcolorcomponent{#1}}} %D \macros -%D {ifMPgraphics, ifMPcmykcolors, MPcolor} +%D {MPcolor} %D %D A very special macro is \type{\MPcolor}. This one can be %D used to pass a \CONTEXT\ color to \METAPOST. @@ -663,9 +644,6 @@ %D {MPcmyk}, only \cap{RGB} colors and gray scales are %D supported. -\newif\ifMPcmykcolors % \MPcmykcolorsfalse -\newif\ifMPspotcolors % \MPspotcolorsfalse - %D For the moment we keep the next downward compatibility %D switch, i.e.\ expanded colors. However, predefined colors %D and palets are no longer expanded (which is what I wanted diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index f7de3a22c..fb902b969 100644 --- a/tex/context/base/cont-new.mkii +++ b/tex/context/base/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2011.12.19 22:53} +\newcontextversion{2011.12.20 22:24} %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 bc4d6bb5e..c1d171e1c 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2011.12.19 22:53} +\newcontextversion{2011.12.20 22:24} %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 3442aa045..1ac486ff4 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 250cdb7be..ef1101611 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 6fa735c88..6a88bb415 100644 --- a/tex/context/base/context.mkii +++ b/tex/context/base/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2011.12.19 22:53} +\edef\contextversion{2011.12.20 22:24} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 082abf664..a3bd91b91 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2011.12.19 22:53} +\edef\contextversion{2011.12.20 22:24} %D For those who want to use this: diff --git a/tex/context/base/core-con.mkiv b/tex/context/base/core-con.mkiv index a0e76a2fa..6bffc3f41 100644 --- a/tex/context/base/core-con.mkiv +++ b/tex/context/base/core-con.mkiv @@ -178,7 +178,7 @@ %D passed to \type{\write} en \type{\message}. That's why we %D introduce: -\def\protectconversion +\unexpanded\def\protectconversion {\let\doconvertcharacters\firstofoneargument} %D \macros @@ -502,7 +502,7 @@ %D The counters \type {\normalyear}, \type {\normalmonth} and %D \type{\normalday} can be used for for date manipulations. -\long\def\processmonth#1#2#3% year month command +\def\processmonth#1#2#3% year month command {\begingroup \getdayspermonth{#1}{#2}% \dostepwiserecurse1\numberofdays1% @@ -514,7 +514,7 @@ \def\lastmonth{12} % can be set to e.g. 1 when testing -\long\def\processyear#1#2#3#4% year command before after +\def\processyear#1#2#3#4% year command before after {\begingroup \dorecurse\lastmonth {\normalyear #1\relax diff --git a/tex/context/base/core-mis.mkiv b/tex/context/base/core-mis.mkiv index 0a7bd93fa..e08693fca 100644 --- a/tex/context/base/core-mis.mkiv +++ b/tex/context/base/core-mis.mkiv @@ -837,7 +837,6 @@ \let\dodostopdelimitedtextpar\endgraf} {\startnarrower[#1]\let\dodostopdelimitedtextpar\stopnarrower}% % so far - % \dochecknextindentation{\??ci\currentdelimitedtext}% AM: not here \pushmacro\checkindentation \doifsomething{\delimitedtextparameter\c!indenting} % WS {\setupindenting[\delimitedtextparameter\c!indenting]}% @@ -857,7 +856,7 @@ \delimitedtextparameter\c!after \doifsomething{\delimitedtextparameter\c!spaceafter} {\blank[\delimitedtextparameter\c!spaceafter]}% - \dochecknextindentation{\??ci\currentdelimitedtext}% AM: here + \checknextindentation[\delimitedtextparameter\c!indentnext]% AM: here \dorechecknextindentation}% AM: This was missing! \def\dostartdelimitedtexttxt diff --git a/tex/context/base/file-ini.mkvi b/tex/context/base/file-ini.mkvi index b8ee9e2d4..d9b2b506e 100644 --- a/tex/context/base/file-ini.mkvi +++ b/tex/context/base/file-ini.mkvi @@ -211,19 +211,19 @@ %D %D This command obeys the standard method for locating files. -\long\def\doonlyonce#whatever% +\unexpanded\def\doonlyonce#whatever% {\doifundefinedelse{@@@#whatever@@@} {\letgvalue{@@@#whatever@@@}\empty \firstofoneargument} {\gobbleoneargument}} -\def\doinputonce#name% +\unexpanded\def\doinputonce#name% {\doonlyonce{#name}{\doiffileelse{#name}{\inputgivenfile{#name}}\donothing}} -\def\doendinputonce#name% +\unexpanded\def\doendinputonce#name% {\doifdefined{@@@#name@@@}\endinput} -\def\forgetdoingonce#whatever% +\unexpanded\def\forgetdoingonce#whatever% {\global\letbeundefined{@@@#whatever@@@}} \protect \endinput diff --git a/tex/context/base/grph-epd.mkiv b/tex/context/base/grph-epd.mkiv index fa6b9e2ab..eba93fcea 100644 --- a/tex/context/base/grph-epd.mkiv +++ b/tex/context/base/grph-epd.mkiv @@ -28,7 +28,7 @@ \def\doaddpdffiguregoodies {\global\setbox\foundexternalfigure\vbox\bgroup - \framed[\c!offset=\v!overlay,\c!background={\v!foreground,epdf-overlay}]{\box\foundexternalfigure}% + \framed[\c!offset=\v!overlay,\c!background={\v!foreground,epdf-overlay}]{\box\foundexternalfigure}% \egroup} \appendtoks diff --git a/tex/context/base/lang-ini.mkiv b/tex/context/base/lang-ini.mkiv index b8f0605bf..6f77eee8d 100644 --- a/tex/context/base/lang-ini.mkiv +++ b/tex/context/base/lang-ini.mkiv @@ -104,9 +104,10 @@ \csname\??la\s!default#2\endcsname \fi\fi\fi} -\unexpanded\def\setupcurrentlanguage[#1]{\setcurrentlanguage\currentmainlanguage{#1}} +\unexpanded\def\setupcurrentlanguage[#1]% + {\setcurrentlanguage\currentmainlanguage{#1}} -\def\setcurrentlanguage#1#2% sets modes: **id (currentmain) *id (current) +\unexpanded\def\setcurrentlanguage#1#2% sets modes: **id (currentmain) *id (current) {\edef\xaskedlanguage{#1}% otherwise clash with \askedlanguage \ifx\xaskedlanguage\empty \else \ifx\currentmainlanguage\empty\else\resetsystemmode{\systemmodeprefix\currentmainlanguage}\fi @@ -172,7 +173,12 @@ \def\installedlanguages{\ctxlua{languages.installed()}} -\def\doiflanguageelse#1{\doifdefinedelse{\??la#1\c!state}} +\def\doiflanguageelse#1% + {\ifcsname\??la#1\c!state\endcsname + \expandafter\firstoftwoarguments + \else + \expandafter\secondoftwoarguments + \fi} \def\doinstalllanguage[#1][#2]% {\doifassignmentelse{#2} @@ -548,7 +554,7 @@ %D \stoptable %D \protect -\def\nopatterns{\normallanguage\minusone} +\unexpanded\def\nopatterns{\normallanguage\minusone} %D We default to the language belonging to the interface. This %D is one of the few places outside the interface modules where @@ -569,7 +575,7 @@ \unexpanded\def\startexceptions {\dosingleempty\dostartexceptions} -\long\def\dostartexceptions[#1]#2\stopexceptions % multilingual or not? +\def\dostartexceptions[#1]#2\stopexceptions % multilingual or not? {\begingroup \edef\askedlanguage{\reallanguagetag{#1}}% \ifx\askedlanguage\empty diff --git a/tex/context/base/luat-cod.mkiv b/tex/context/base/luat-cod.mkiv index 6b1bc9267..a58a81599 100644 --- a/tex/context/base/luat-cod.mkiv +++ b/tex/context/base/luat-cod.mkiv @@ -43,7 +43,7 @@ %D new functionality. We no longer support the hooks for initializing %D code as this can be done at the \LUA\ end. -% instead of \ctxwrite and \ctxprint, use \cldcontext +% we can drop the \zerocount as it's default \def\ctxdirectlua {\directlua\zerocount} \def\ctxlatelua {\latelua \zerocount} diff --git a/tex/context/base/meta-imp-dum.mkiv b/tex/context/base/meta-imp-dum.mkiv index 852ed1ef1..a622d94f4 100644 --- a/tex/context/base/meta-imp-dum.mkiv +++ b/tex/context/base/meta-imp-dum.mkiv @@ -96,10 +96,6 @@ \let\normalexternalfigurereplacement\externalfigurereplacement -% \weightGRAYfalse % monochrome anyway -% \MPcmykcolorsfalse -% \MPspotcolorsfalse - \unexpanded\def\externalfigurereplacement#1#2#3% {\getpaletsize[placeholder]% \ifx\figurereplacementcycle\relax diff --git a/tex/context/base/meta-ini.mkiv b/tex/context/base/meta-ini.mkiv index 9ce75364a..ff3284c6f 100644 --- a/tex/context/base/meta-ini.mkiv +++ b/tex/context/base/meta-ini.mkiv @@ -408,9 +408,12 @@ \newbox \MPgraphicbox \newconstant\MPboxmode +% hm, isn't this already done elsewhere? + \def\doobeyMPboxdepth % mode = 1 {\setbox\MPgraphicbox\hbox\bgroup - \raise\MPlly\onebasepoint\box\MPgraphicbox +% \raise\MPlly\onebasepoint\box\MPgraphicbox + \raise\MPlly\box\MPgraphicbox \egroup} \def\doignoreMPboxdepth % mode = 2 @@ -422,8 +425,7 @@ \def\doobeyMPboxorigin % mode = 3 {\setbox\MPgraphicbox\hbox\bgroup - \hskip\MPllx\onebasepoint - \raise\MPlly\onebasepoint\box\MPgraphicbox + \hskip\MPllx\raise\MPlly\box\MPgraphicbox \egroup} \def\obeyMPboxdepth {\MPboxmode\plusone} @@ -436,7 +438,7 @@ \let\MPshiftdrawingtrue \ignoreMPboxdepth \let\MPshiftdrawingfalse\normalMPboxdepth -\unexpanded\def\placeMPgraphic +\unexpanded\def\placeMPgraphic % the converter also displaces so in fact we revert {\ifcase\MPboxmode \or % 1 \doobeyMPboxdepth @@ -448,21 +450,18 @@ \box\MPgraphicbox} \unexpanded\def\reuseMPbox#1#2#3#4#5% space delimiting would save some tokens - {\xdef\MPllx{#2}% but it's not worth the effort and looks - \xdef\MPlly{#3}% ugly as well - \xdef\MPurx{#4}% - \xdef\MPury{#5}% + {\MPllx#2\MPlly#3\MPurx#4\MPury#5% \hbox{\forcecolorhack\getobject{MP}{#1}}} % else no proper color intent -\def\handleuniqueMPgraphic#1#2#3% - {\begingroup +\def\handleuniqueMPgraphic#1#2#3% when there are too many, we can store data at the lua end, although, + {\begingroup % when there are that many they're probably not that unique anyway \def\@@meta{#1:}% \extendMPoverlaystamp{#2}% incl prepare \ifcsname\@@MPG\overlaystamp:#1\endcsname\else \enableincludeMPgraphics % redundant \global\advance\MPobjectcounter\plusone \setobject{MP}{\number\MPobjectcounter}\hbox{\processMPgraphic{#3}}% was vbox, graphic must end up as hbox - \setxvalue{\@@MPG\overlaystamp:#1}{\reuseMPbox{\number\MPobjectcounter}{\MPllx}{\MPlly}{\MPurx}{\MPury}}% + \setxvalue{\@@MPG\overlaystamp:#1}{\reuseMPbox{\number\MPobjectcounter}{\the\MPllx}{\the\MPlly}{\the\MPurx}{\the\MPury}}% \fi \getvalue{\@@MPG\overlaystamp:#1}% \endgroup} @@ -514,7 +513,7 @@ \enableincludeMPgraphics % redundant \global\advance\MPobjectcounter\plusone \setobject{MP}{\number\MPobjectcounter}\hbox{\processMPgraphic{#3}}% was vbox, graphic must end up as hbox - \setxvalue{\@@MPG#1}{\noexpand\reuseMPbox{\number\MPobjectcounter}{\MPllx}{\MPlly}{\MPurx}{\MPury}}% + \setxvalue{\@@MPG#1}{\noexpand\reuseMPbox{\number\MPobjectcounter}{\the\MPllx}{\the\MPlly}{\the\MPurx}{\the\MPury}}% \getvalue{\@@MPG#1}% \endgroup} @@ -856,18 +855,6 @@ \def\MPstring #1{"\executeifdefined{\@@MPT#1}\empty"} \def\MPbetex #1{btex \executeifdefined{\@@MPT#1}\empty\space etex} -%D Unfortunately \METAPOST\ does not have \CMYK\ support -%D built in, but by means of specials we can supply the -%D information needed to handle them naturaly. - -% \newif\ifMPcmykcolors \MPcmykcolorstrue -% \newif\ifMPspotcolors \MPspotcolorstrue - -\startMPinitializations - cmykcolors:=\ifMPcmykcolors true\else false\fi; - spotcolors:=\ifMPspotcolors true\else false\fi; -\stopMPinitializations - %D In order to communicate conveniently with the \TEX\ %D engine, we introduce some typesetting variables. @@ -1009,8 +996,8 @@ \definelayerpreset % no dx,dy - else nasty non-mp placement [mp] - [\c!y=-\MPury bp, - \c!x=\MPllx bp, + [\c!y=-\MPury, + \c!x=\MPllx, \c!method=\v!fit] \definelayer @@ -1096,16 +1083,6 @@ \def\dostartstaticMPgraphic#1#2#3\stopstaticMPgraphic {\setgvalue{\@@MPG#1@S@}{\handlereusableMPgraphic{#1}{#2}{#3}}} -%D New: - -\newconditional\manyMPspecials % when set to true, > 1000 specials can be used - -\settrue \manyMPspecials % per 1/4/2006 - -\prependtoks - _special_div_ := 1000\ifconditional\manyMPspecials0\fi ; -\to \MPextensions - %D Needed too. \let\initializeMPgraphics\relax diff --git a/tex/context/base/meta-pag.mkiv b/tex/context/base/meta-pag.mkiv index 2b72ab3d7..8118b476e 100644 --- a/tex/context/base/meta-pag.mkiv +++ b/tex/context/base/meta-pag.mkiv @@ -86,28 +86,38 @@ \def\MPonrightpage{true} \def\MPonoddpage {true} -\def\freezeMPpagelayout - {\edef\MPonrightpage{\doifbothsides {tru}{tru}{fals}e}% - \edef\MPonoddpage {\doifoddpageelse {tru}{fals}e}} - -\let\freezeMPlayout\relax % obsolete +% obsolete (but keep the code) +% +% \def\freezeMPpagelayout +% {\edef\MPonrightpage{\doifbothsides {tru}{tru}{fals}e}% +% \edef\MPonoddpage {\doifoddpageelse {tru}{fals}e}} +% +% \let\freezeMPlayout\relax % obsolete %D We need to freeze the pagelayout before the backgrounds %D are build, because the overlay will temporarily become %D zero (overlay). -\appendtoks - \freezeMPpagelayout -\to \everybeforepagebody +% obsolete (but keep the code) +% +% \appendtoks +% \freezeMPpagelayout +% \to \everybeforepagebody %D By freezing these value every graphic, we can use layout %D variables that change halfways a page, whatever use that %D has. +% obsolete (but keep the code) +% +% \prependtoks +% \calculatereducedvsizes % this is really needed +% \freezeMPpagelayout +% \freezeMPlayout % to be used grouped +% \to \everyMPgraphic + \prependtoks \calculatereducedvsizes % this is really needed - \freezeMPpagelayout - \freezeMPlayout % to be used grouped \to \everyMPgraphic %D The next feature provides information about for instance @@ -172,6 +182,7 @@ % \else % \hbox{#1}% % \fi} + \def\globalregisterMPtextarea{\normalexpanded{\global\MPtextareadata{\the\MPtextareadata RegisterTextArea(% \MPx\currentMPtextarea,% @@ -202,10 +213,10 @@ \hbox{#2}% \fi} -\def\registerMPtextarea {\registerMPtextareaindeed\globalregisterMPtextarea} -\def\registerMPlocaltextarea{\registerMPtextareaindeed\localregisterMPtextarea } +\unexpanded\def\registerMPtextarea {\registerMPtextareaindeed\globalregisterMPtextarea} +\unexpanded\def\registerMPlocaltextarea{\registerMPtextareaindeed\localregisterMPtextarea } -\def\resetMPlocaltextarea +\expanded\def\resetMPlocaltextarea {\global\MPlocaltextareadata\emptytoks} \startMPextensions diff --git a/tex/context/base/meta-pdf.lua b/tex/context/base/meta-pdf.lua index b554810ee..13d39e445 100644 --- a/tex/context/base/meta-pdf.lua +++ b/tex/context/base/meta-pdf.lua @@ -131,7 +131,7 @@ function mps.newpath() end function mps.boundingbox(llx, lly, urx, ury) - context.MPSboundingbox(llx,lly,urx,ury) + context.setMPboundingbox(llx,lly,urx,ury) end function mps.moveto(x,y) @@ -228,7 +228,7 @@ function mps.textext(font, scale, str) -- old parser dx, dy = m_stack_path[1][1], m_stack_path[1][2] end flushconcat() - context.MPStextext(font,scale,str,dx,dy) + context.MPtextext(font,scale,str,dx,dy) resetpath() end diff --git a/tex/context/base/meta-pdf.mkiv b/tex/context/base/meta-pdf.mkiv index 9a63b5034..a8fdaff42 100644 --- a/tex/context/base/meta-pdf.mkiv +++ b/tex/context/base/meta-pdf.mkiv @@ -13,8 +13,6 @@ \registerctxluafile{meta-pdf}{1.003} -%D We will clean up the color mess later. - \writestatus{loading}{MetaPost Graphics / MPS to PDF} \unprotect @@ -22,417 +20,41 @@ %D \macros %D {convertMPtoPDF} %D -%D The next set of macros implements \METAPOST\ to \PDF\ -%D conversion. The traditional method is in the MkII file. -%D -%D The main conversion command is: +%D The next set of macros implements \METAPOST\ to \PDF\ conversion. The +%D traditional method is in the MkII files and the older \MKIV\ method is +%D kept in meta-pdh files. The main conversion command is still the same +%D but the scale parameters are ignored in \MKIV: %D %D \starttyping %D \convertMPtoPDF {filename} {x scale} {y scale} %D \stoptyping %D -%D The dimensions are derived from the bounding box. So we -%D only have to say: -%D -%D \starttyping -%D \convertMPtoPDF{mp-pra-1.eps}{1}{1} -%D \convertMPtoPDF{mp-pra-1.eps}{.5}{.5} -%D \stoptyping - -\def\PDFMPformoffset - {\ifdefined\objectoffset\objectoffset\else\zeropoint\fi} +%D Much code has gone due to the fact that we now use pre and post scripts +%D and no specials. This also means that you should use a modern \METAPOST\ +%D or reprocess graphics. The color control flags are also gone as we now +%D integrate into the regular colorspace handling (i.e.\ no longer independent +%D configurations.) -%D The main macro: +\def\PDFMPformoffset{\ifdefined\objectoffset\objectoffset\else\zeropoint\fi} % obsolete, will go -\def\convertMPtoPDF#1#2#3% scaling no longer supported at this level (so #2 & #3 ignored) - {\vbox\bgroup +\def\convertMPtoPDF#1#2#3% scaling no longer supported at this level (so #2 & #3 are ignored) + {\dostarttagged\t!mpgraphic\empty + \naturalvbox attr \imageattribute 1 \bgroup \message{[MP to PDF]}% \xdef\MPfilename{#1}% - \glet\MPwidth \!!zeropoint - \glet\MPheight\!!zeropoint - \glet\MPllx \!!zerocount - \glet\MPlly \!!zerocount - \glet\MPurx \!!zerocount - \glet\MPury \!!zerocount + \resetMPboundingbox \forgetall \offinterlineskip - \setbox\scratchbox\vbox\bgroup - \ctxlua{metapost.mptopdf.convertmpstopdf("\MPfilename")}\removeunwantedspaces - \egroup - \setbox\scratchbox\hbox\bgroup - \hskip-\MPllx\onebasepoint - \raise-\MPlly\onebasepoint - \box\scratchbox + \setbox\MPbox\vbox\bgroup + \ctxlua{metapost.mptopdf.convertmpstopdf("\MPfilename")}% + \removeunwantedspaces % not that needed \egroup - \setbox\scratchbox\vbox to \MPheight\bgroup - \vfill - \hsize\MPwidth - \smashbox\scratchbox - \box\scratchbox - \egroup - \wd\scratchbox\MPwidth - \ht\scratchbox\MPheight - \dopackageMPgraphic\scratchbox - \egroup} - -%D Objects (move all to backend) - -% \def\dopackageMPgraphic#1% #1 = boxregister -% {\scratchdimen\PDFMPformoffset\relax -% \ifdim\scratchdimen>\zeropoint % compensate for error -% \setbox#1\vbox spread 2\scratchdimen -% {\forgetall\vss\hbox spread 2\scratchdimen{\hss\box#1\hss}\vss}% -% \fi -% \setMPPDFobject{#1}% -% \ifdim\scratchdimen>\zeropoint % compensate for error -% \vbox to \MPheight -% {\forgetall\vss\hbox to \MPwidth{\hss\getMPPDFobject\hss}\vss}% -% \else -% \getMPPDFobject -% \fi} -% -% \def\setMPPDFobject#1% boxnumber -% {\the\pdfbackendeveryxform -% \finalizeobjectbox{#1}% -% \immediate\pdfxform resources{\pdfcurrentresources}#1% -% \edef\getMPPDFobject{\noexpand\pdfrefxform\the\pdflastxform}} -% -% \let\getMPPDFobject\relax - -% we don't need to package as each page has all resources anyway - -\let\dopackageMPgraphic\box - -%D \macros -%D {deleteMPgraphic, -%D startMPresources, -%D stopMPresources} - -\ifx\deleteMPgraphic\undefined - \def\deleteMPgraphic#1{} -\fi - -\ifx\startMPresources\undefined - \let\startMPresources\relax - \let\stopMPresources\relax -\fi - -%D We implement extensions by using the \METAPOST\ special -%D mechanism. Opposite to \TEX's specials, the \METAPOST\ ones -%D are flushed before or after the graphic data, but thereby -%D are no longer connected to a position. -%D -%D We implement specials by overloading the \type {fill} -%D operator. By counting the fills, we can let the converter -%D treat the appropriate fill in a special way. The -%D specification of the speciality can have two forms, -%D determined by the setting of a boolean variable: -%D -%D \starttyping -%D _inline_specials_ := false ; % comment like code (default) -%D _inline_specials_ := true ; % command like code -%D \stoptyping -%D -%D When the specification is embedded as comment, it looks -%D like: -%D -%D \starttyping -%D %%MetaPostSpecial <size> <data> <number> <identifier> -%D \stoptyping -%D -%D The in||line alternative is more tuned for \POSTSCRIPT, -%D since it permits us to define a macro \type {special}. -%D -%D \starttyping -%D inline : <data> <number> <identifier> <size> special -%D \stoptyping -%D -%D The \type {identifier} determines what to do, and the data -%D can be used to accomplish this. A type~2 shading function -%D has identifier~2. Alltogether, the number of parameters is -%D specified in \type {size}. The \type {number} is the number -%D of the fill that needs the special treatment. For a type~2 -%D and~3 shaded fill, the datablock contains the following + \finalizeMPbox + \box\MPbox + \egroup + \dostoptagged} -%D data: -%D -%D \starttyping -%D from to n inner_r g b x y outer_r g b x y -%D from to n inner_r g b x y radius outer_r g b x y radius -%D \stoptyping - -\newconditional\manyMPspecials \settrue\manyMPspecials - -%D Since colors are not subjected to transformations, we can -%D only use colors as signal. In our case, we use a dummy colored -%D path with a red color component of \type {0.n}, so \type -%D {0.001} is the first path and \type {0.010} the tenth. Since -%D \METAPOST strips trailing zeros, we have to padd the string. - -\newif\ifMPcmykcolors -\newif\ifMPspotcolors - -%D We support specials but assume that the files are somewhat simple -%D ones wo we have dropped a few. The reason is that runtime \METAPOST\ -%D processing now uses \MPLIB\ so we only need to deal with the -%D conversion here. See meta-pdh.mkiv (and older files) for more -%D details. Here we just give a few examples. -%D -%D \startbuffer[mp] -%D fill fullcircle xyscaled (3cm,1cm) withcolor \MPcolor{test} ; -%D \stopbuffer -%D -%D \startbuffer[cmyk] -%D \startcombination[4*1] -%D {\definecolor[test][c=1,y=.3,k=.3] \processMPbuffer[mp]} {c=1 y=.3 k=.3} -%D {\definecolor[test][c=.9,y=.15] \processMPbuffer[mp]} {c=.9 y=.15} -%D {\definecolor[test][c=.25,y=.8] \processMPbuffer[mp]} {c=.25 y=.8} -%D {\definecolor[test][c=.45,y=.1] \processMPbuffer[mp]} {c=.45 y=.1} -%D \stopcombination -%D \stopbuffer -%D -%D \placefigure -%D {\CMYK\ support disabled, -%D conversion to \RGB.} -%D {\setupcolors[cmyk=nee,state=start]\getbuffer[cmyk]} -%D -%D \placefigure -%D {\CMYK\ support enabled, -%D no support in \METAPOST.} -%D {\setupcolors[cmyk=ja,mpcmyk=nee,state=start]\getbuffer[cmyk]} -%D -%D \placefigure -%D {\CMYK\ support enabled, -%D no conversion to \RGB, -%D support in \METAPOST} -%D {\setupcolors[cmyk=ja,state=start]\getbuffer[cmyk]} -%D -%D Transparency support used specials 60 (rgb) and 61 -%D (cmyk). -%D -%D \startbuffer -%D u := 2cm ; path p ; p := fullcircle scaled u shifted (u/4,0); -%D -%D fill p rotated 90 withcolor transparent(1,.5,yellow) ; -%D fill p rotated 210 withcolor transparent(1,.5,green) ; -%D fill p rotated 330 withcolor transparent(1,.5,blue) ; -%D \stopbuffer -%D -%D \typebuffer -%D -%D \startlinecorrection \processMPbuffer \stoplinecorrection -%D -%D One can also communicate colors between \CONTEXT\ and -%D \METAPOST: -%D -%D \startbuffer -%D \definecolor[tcyan] [c=1,k=.2,t=.5] -%D \definecolor[tmagenta][m=1,k=.2,t=.5] -%D \definecolor[tyellow] [y=1,k=.2,t=.5] -%D \stopbuffer -%D -%D \typebuffer \getbuffer -%D -%D \startbuffer -%D u := 2cm ; path p ; p := fullcircle scaled u shifted (u/4,0); -%D -%D fill p rotated 90 withcolor \MPcolor{tcyan} ; -%D fill p rotated 210 withcolor \MPcolor{tmagenta} ; -%D fill p rotated 330 withcolor \MPcolor{tyellow} ; -%D \stopbuffer -%D -%D \startlinecorrection \processMPbuffer \stoplinecorrection -%D -%D Shading is an example of a more advanced graphic feature, -%D but users will seldom encounter those complications. Here -%D we only show a few simple examples, but many other -%D alternatives are possible by setting up the functions built -%D in \PDF\ in the appropriate way. -%D -%D Shading has to do with interpolation between two or more -%D points or user supplied ranges. In \PDF, the specifications -%D of a shade has to be encapsulated in objects and passed on -%D as resources. This is a \PDF\ level 1.3. feature. One can -%D simulate three dimensional shades as well and define simple -%D functions using a limited set of \POSTSCRIPT\ primitives. -%D Given the power of \METAPOST\ and these \PDF\ features, we -%D can achieve superb graphic effects. -%D -%D Since everything is hidden in \TEX\ and \METAPOST\ graphics, -%D we can stick to high level \CONTEXT\ command, as shown in -%D the following exmples. -%D -%D \startbuffer -%D \startuniqueMPgraphic{CircularShade} -%D path p ; p := unitsquare xscaled \overlaywidth yscaled \overlayheight ; -%D circular_shade(p,0,.2red,.9red) ; -%D \stopuniqueMPgraphic -%D -%D \startuniqueMPgraphic{LinearShade} -%D path p ; p := unitsquare xscaled \overlaywidth yscaled \overlayheight ; -%D linear_shade(p,0,.2blue,.9blue) ; -%D \stopuniqueMPgraphic -%D -%D \startuniqueMPgraphic{DuotoneShade} -%D path p ; p := unitsquare xscaled \overlaywidth yscaled \overlayheight ; -%D linear_shade(p,2,.5green,.5red) ; -%D \stopuniqueMPgraphic -%D \stopbuffer -%D -%D \typebuffer \getbuffer -%D -%D These graphics can be hooked into the overlay mechanism, -%D which is available in many commands. -%D -%D \startbuffer -%D \defineoverlay[demo 1][\uniqueMPgraphic{CircularShade}] -%D \defineoverlay[demo 2][\uniqueMPgraphic {LinearShade}] -%D \defineoverlay[demo 3][\uniqueMPgraphic {DuotoneShade}] -%D \stopbuffer -%D -%D \typebuffer \getbuffer -%D -%D These backgrounds can for instance be applied to \type -%D {\framed}: -%D -%D \startbuffer -%D \setupframed[width=3cm,height=2cm,frame=off] -%D \startcombination[3*1] -%D {\framed[backgroundachtergrond=demo 1]{\bfd \white Demo 1}} {} -%D {\framed[backgroundachtergrond=demo 2]{\bfd \white Demo 2}} {} -%D {\framed[backgroundachtergrond=demo 3]{\bfd \white Demo 3}} {} -%D \stopcombination -%D \stopbuffer -%D -%D \typebuffer -%D -%D \startlinecorrection -%D \getbuffer -%D \stoplinecorrection -%D -%D There are a few more alternatives, determined by the second -%D parameter passed to \type {circular_shade} and alike. -%D -%D \def\SomeShade#1#2#3#4#5% -%D {\startuniqueMPgraphic{Shade-#1} -%D width := \overlaywidth ; -%D height := \overlayheight ; -%D path p ; p := unitsquare xscaled width yscaled height ; -%D #2_shade(p,#3,#4,#5) ; -%D \stopuniqueMPgraphic -%D \defineoverlay[Shade-#1][\uniqueMPgraphic{Shade-#1}]% -%D \framed[backgroundachtergrond=Shade-#1,width=2cm,height=2cm,frame=off]{}} -%D -%D \startlinecorrection -%D \startcombination[5*1] -%D {\SomeShade{10}{circular}{0}{.3blue}{.9blue}} {circular 0} -%D {\SomeShade{11}{circular}{1}{.3blue}{.9blue}} {circular 1} -%D {\SomeShade{12}{circular}{2}{.3blue}{.9blue}} {circular 2} -%D {\SomeShade{13}{circular}{3}{.3blue}{.9blue}} {circular 3} -%D {\SomeShade{14}{circular}{4}{.3blue}{.9blue}} {circular 4} -%D \stopcombination -%D \stoplinecorrection -%D -%D \startlinecorrection -%D \startcombination[5*1] -%D {\SomeShade{20}{circular}{0}{.9green}{.3green}} {circular 0} -%D {\SomeShade{21}{circular}{1}{.9green}{.3green}} {circular 1} -%D {\SomeShade{22}{circular}{2}{.9green}{.3green}} {circular 2} -%D {\SomeShade{23}{circular}{3}{.9green}{.3green}} {circular 3} -%D {\SomeShade{24}{circular}{4}{.9green}{.3green}} {circular 4} -%D \stopcombination -%D \stoplinecorrection -%D -%D \startlinecorrection -%D \startcombination[4*1] -%D {\SomeShade{30}{linear}{0}{.3red}{.9red}} {linear 0} -%D {\SomeShade{31}{linear}{1}{.3red}{.9red}} {linear 1} -%D {\SomeShade{32}{linear}{2}{.3red}{.9red}} {linear 2} -%D {\SomeShade{33}{linear}{3}{.3red}{.9red}} {linear 3} -%D \stopcombination -%D \stoplinecorrection -%D -%D These macros closely cooperate with the \METAPOST\ module -%D \type {mp-spec.mp}, which is part of the \CONTEXT\ -%D distribution. -%D -%D The low level (\PDF) implementation is based on the \TEX\ -%D based \METAPOST\ to \PDF\ converter. Shading is supported -%D by overloading the \type {fill} operator as implemented -%D earlier. In \PDF\ type~2 and~3 shading functions are -%D specified in terms of: -%D -%D \starttabulate[|Tl|l|] -%D \NC /Domain \NC sort of meeting range \NC \NR -%D \NC /C0 \NC inner shade \NC \NR -%D \NC /C1 \NC outer shade \NC \NR -%D \NC /N \NC smaller values, bigger inner circles \NC \NR -%D \stoptabulate -%D -%D An example of using both special features is the -%D following. -%D -%D \starttyping -%D \startMPpage -%D externalfigure "hakker1b.png" scaled 22cm rotated 10 shifted (-2cm,0cm); -%D externalfigure "hakker1b.png" scaled 10cm rotated -10 ; -%D externalfigure "hakker1b.png" scaled 7cm rotated 45 shifted (8cm,12cm) ; -%D path p ; p := unitcircle xscaled 15cm yscaled 20cm; -%D path q ; q := p rotatedaround(center p,90) ; -%D path r ; r := buildcycle(p,q) ; clip currentpicture to r ; -%D path s ; s := boundingbox currentpicture enlarged 5mm ; -%D picture c ; c := currentpicture ; currentpicture := nullpicture ; -%D circular_shade(s,0,.2red,.9red) ; -%D addto currentpicture also c ; -%D \stopMPpage -%D \stoptyping - -\startMPinitializations - mp_shade_version := 2 ; -\stopMPinitializations - -%D This is done much cleaner in \MPLIB. - -% %D A common hook. -% -% \let\MPfshowcommand\empty -% -% \def\MPStextext#1#2#3#4#5% if we clean up this plugin model, we can -% {\def\MPtextdata{#3}% % delegate the splitter to lua + redesign -% \def\MPtextsize{#2}% -% \def\lastMPmoveX{#4}% -% \def\lastMPmoveY{#5}% -% \defconvertedcommand\MPtextdata\MPtextdata % no edef -% \splitstring\MPtextdata\at::::\to\MPtexttag\and\MPtextnumber -% \executeifdefined{handleMPtext\MPtexttag} -% {\setbox\scratchbox\hbox -% {\font\temp=#1\space at #2\onebasepoint -% \let\c\char -% \temp -% \MPfshowcommand{#3}}% -% \setbox\scratchbox\hbox -% {\hskip#4\onebasepoint -% \raise#5\onebasepoint -% \box\scratchbox}% -% \smashbox\scratchbox -% \box\scratchbox}} - -\unexpanded\def\MPStextext#1#2#3#4#5% if we clean up this plugin model, we can - {\setbox\scratchbox\hbox - {\font\temp=#1\space at #2\onebasepoint \let\c\char \temp #3}% - \setbox\scratchbox\hbox - {\hskip#4\onebasepoint \raise#5\onebasepoint \box\scratchbox}% - \smashbox\scratchbox - \box\scratchbox} - -%D The boundingbox. - -\def\MPSboundingbox#1#2#3#4% - {\xdef\MPllx{#1}\xdef\MPlly{#2}\xdef\MPurx{#3}\xdef\MPury{#4}% - \xdef\MPwidth {\the\dimexpr#3\onebasepoint-#1\onebasepoint\relax}% - \xdef\MPheight{\the\dimexpr#4\onebasepoint-#2\onebasepoint\relax}} - -\MPSboundingbox0000 +\protect \endinput %D Test code: %D @@ -470,5 +92,3 @@ %D \stopbuffer %D %D \typebuffer \startlinecorrection \getbuffer \stoplinecorrection - -\protect \endinput diff --git a/tex/context/base/meta-pdh.lua b/tex/context/base/meta-pdh.lua index d8eb32793..5040715c4 100644 --- a/tex/context/base/meta-pdh.lua +++ b/tex/context/base/meta-pdh.lua @@ -6,7 +6,9 @@ if not modules then modules = { } end modules ['meta-pdf'] = { license = "see context related readme files" } -os.exit() +if true then + return -- or os.exit() +end -- This file contains the history of the converter. We keep it around as it -- relates to the development of luatex. diff --git a/tex/context/base/meta-pdh.mkiv b/tex/context/base/meta-pdh.mkiv index 30402c6ea..6d85a8dc1 100644 --- a/tex/context/base/meta-pdh.mkiv +++ b/tex/context/base/meta-pdh.mkiv @@ -11,9 +11,12 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +\endinput + %D Formerly known as supp-pdf.tex and supp-mpe.tex and meta-pdf.mkiv. %D -%D Beware: this file is not used but kept for historic purposed! +%D Beware: this file is not used but kept for historic purposed! Never +%D mix this one into mkiv again as it uses other variables. % \useMPgraphic{1} % \testfeatureonce{250}{\setbox0\hbox{\convertMPtoPDF{test-mps-mpgraph.1}{1}{1}}} diff --git a/tex/context/base/mlib-pdf.lua b/tex/context/base/mlib-pdf.lua index 38e59a94f..0827b43c0 100644 --- a/tex/context/base/mlib-pdf.lua +++ b/tex/context/base/mlib-pdf.lua @@ -146,7 +146,7 @@ end function metapost.flushers.pdf.textfigure(font,size,text,width,height,depth) -- we could save the factor text = gsub(text,".","\\hbox{%1}") -- kerning happens in metapost (i have to check if this is true for mplib) - context.MPLIBtextext(font,size,text,0,-number.dimenfactors.bp*depth) + context.MPtextext(font,size,text,0,-number.dimenfactors.bp*depth) end local bend_tolerance = 131/65536 diff --git a/tex/context/base/mlib-pdf.mkiv b/tex/context/base/mlib-pdf.mkiv index 0f2f4c728..05c772720 100644 --- a/tex/context/base/mlib-pdf.mkiv +++ b/tex/context/base/mlib-pdf.mkiv @@ -13,87 +13,102 @@ \unprotect +% We use bit more code that needed because we want to limit the +% amount of boxing. + \registerctxluafile{mlib-pdf}{1.001} -\def\MPLIBtoPDF#1{\ctxlua{metapost.flushliteral(#1)}} +%D Some code is shared between MPLIB and MPS. The following variables +%D are also available for introspection and other purposes. + +\newdimen\MPwidth +\newdimen\MPheight + +\newdimen\MPllx +\newdimen\MPlly +\newdimen\MPurx +\newdimen\MPury + +\newbox \MPbox + +\def\setMPboundingbox#1#2#3#4% at some point we might pass them as base or scaled points + {\global\MPllx #1\onebasepoint + \global\MPlly #2\onebasepoint + \global\MPurx #3\onebasepoint + \global\MPury #4\onebasepoint + \global\MPwidth \dimexpr\MPurx-\MPllx\relax + \global\MPheight\dimexpr\MPury-\MPlly\relax} + +\def\resetMPboundingbox + {\global\MPwidth \zeropoint + \global\MPheight\zeropoint + \global\MPllx \zeropoint + \global\MPlly \zeropoint + \global\MPurx \zeropoint + \global\MPury \zeropoint} + +\def\repositionMPboxindeed + {\setbox\MPbox\hbox\bgroup + \hskip-\MPllx + \raise-\MPlly + \box\MPbox + \egroup} + +\def\repositionMPbox + {\ifzeropt\MPllx + \ifzeropt\MPlly + % okay + \else + \repositionMPboxindeed + \fi + \else + \repositionMPboxindeed + \fi} + +\def\finalizeMPbox + {\repositionMPbox + \setbox\MPbox\vbox to \MPheight\bgroup + \vfill + \hsize\MPwidth + \smashbox\MPbox + \box\MPbox + \egroup + \wd\MPbox\MPwidth + \ht\MPbox\MPheight} -\def\MPLIBboundingbox#1#2#3#4% - {\xdef\MPllx{#1}% - \xdef\MPlly{#2}% - \xdef\MPurx{#3}% - \xdef\MPury{#4}% - \xdef\MPwidth {\the\dimexpr#3\onebasepoint-#1\onebasepoint\relax}% - \xdef\MPheight{\the\dimexpr#4\onebasepoint-#2\onebasepoint\relax}} +\def\MPtextext#1#2#3#4#5% beware: we use a different method now (see mlib-pps) + {\begingroup + \setbox\MPbox\hbox{\font\temp=#1\space at #2\onebasepoint \let\c\char \temp #3}% + \MPllx-#4\onebasepoint + \MPlly-#5\onebasepoint + \repositionMPbox + \smashbox\MPbox + \box\MPbox + \endgroup} + +% MPLIB specific: + +\def\MPLIBtoPDF#1{\ctxlua{metapost.flushliteral(#1)}} -\def\startMPLIBtoPDF#1#2#3#4% watch the transparency reset +\def\startMPLIBtoPDF#1#2#3#4% {\dostarttagged\t!mpgraphic\empty \naturalhbox attr \imageattribute 1 \bgroup \doactivatecolor\s!black\forcecolorhack - \MPLIBboundingbox{#1}{#2}{#3}{#4}% - %\forgetall % done already elsewhere - \setbox\scratchbox\vbox\bgroup - \noindent % this is really needed in order to force tex into proper cm's - \startMPresources} - -\def\stopMPLIBtoPDF % watch the transparency reset - {%\dohandleMPresettransparency % not needed - \stopMPresources - \egroup - \setbox\scratchbox\hbox\bgroup - \hskip-\MPllx\onebasepoint - \raise-\MPlly\onebasepoint - \box\scratchbox - \egroup - \setbox\scratchbox\vbox to \MPheight\bgroup - \vfill - \hsize\MPwidth - \smashbox\scratchbox - \box\scratchbox - \egroup - \wd\scratchbox\MPwidth - \ht\scratchbox\MPheight - \dopackageMPgraphic\scratchbox + \setMPboundingbox{#1}{#2}{#3}{#4}% + \setbox\MPbox\vbox\bgroup + % \forgetall % already done elsewhere + \noindent} % forces the proper cm in the backend + +\def\stopMPLIBtoPDF + {\egroup + \finalizeMPbox + \box\MPbox \egroup \dostoptagged} -% \def\MPLIBtextext#1#2#3#4#5% -% {\begingroup -% \def\MPtextdata{#3}% delegate the splitter to lua -% \defconvertedcommand\MPtextdata\MPtextdata % no edef -% \splitstring\MPtextdata\at::::\to\MPtexttag\and\MPtextnumber -% \executeifdefined{handleMPtext\MPtexttag} -% {\setbox\scratchbox\hbox -% {\font\temp=#1\space at #2\onebasepoint -% \let\c\char -% \temp -% \MPfshowcommand{#3}}% -% \setbox\scratchbox\hbox -% {\hskip#4\onebasepoint -% \raise#5\onebasepoint -% \box\scratchbox}% -% \smashbox\scratchbox -% \box\scratchbox}% -% \endgroup} - -\def\MPLIBtextext#1#2#3#4#5% - {\begingroup - \setbox\scratchbox\hbox - {\font\temp=#1\space at #2\onebasepoint - \let\c\char - \temp - #3}% - \setbox\scratchbox\hbox - {\hskip#4\onebasepoint - \raise#5\onebasepoint - \box\scratchbox}% - \smashbox\scratchbox - \box\scratchbox - \endgroup} - -\def\MPLIBflushreset +\def\MPLIBflushreset % This can (will) move to the Lua end. {\ctxlua{metapost.flushreset()}} - %D Kind of special: % % test.mp: diff --git a/tex/context/base/mlib-pps.mkiv b/tex/context/base/mlib-pps.mkiv index 0dbdd3f6e..f4d5483d3 100644 --- a/tex/context/base/mlib-pps.mkiv +++ b/tex/context/base/mlib-pps.mkiv @@ -30,6 +30,19 @@ % have no limitation. Typically an example of a next version solution % due to \LUATEX\ evolving. +% TODO: foigure out why this is shifted +% +% \setupbodyfont[palatino] +% +% \starttext +% \startMPpage +% draw textext("123") ; +% \stopMPpage +% \stoptext +% +% A slightly larger picturew works ok. Some kind of interference +% with the OTR. + \newbox \MPtextbox \newtoks\everyMPLIBsettext @@ -49,18 +62,23 @@ \def\MPLIBgettextscaledcm#1#2#3#4#5#6#7#8#9% 2-7: sx,rx,ry,sy,tx,ty {\ctxlua{metapost.gettext(\number\MPtextbox,#1)}% - \setbox\scratchbox\hbox - {\dotransformnextbox{#2}{#3}{#4}{#5}{#6}{#7}% does push pop - \vbox to \zeropoint - {\vss - \hbox to \zeropoint - {\scale[\c!sx=#8,\c!sy=#9]{\raise\dp\MPtextbox\box\MPtextbox}% - \forcecolorhack - \hss}}}% - \smashbox\scratchbox - \box\scratchbox} - -\def\MPLIBgraphictext#1% + \setbox\MPbox\hbox\bgroup + \dotransformnextbox{#2}{#3}{#4}{#5}{#6}{#7}% does push pop + \vbox to \zeropoint\bgroup + \vss + \hbox to \zeropoint \bgroup + % \scale[\c!sx=#8,\c!sy=#9]{\raise\dp\MPtextbox\box\MPtextbox}\forcecolorhack + \dostartscaling{#8}{#9}% + \raise\dp\MPtextbox\box\MPtextbox + \dostopscaling + \hss + \egroup + \egroup + \egroup + \smashbox\MPbox + \box\MPbox} + +\def\MPLIBgraphictext#1% use at mp end {\startTEXpage[\c!scale=10000]#1\stopTEXpage} %D \startbuffer diff --git a/tex/context/base/mult-ini.mkiv b/tex/context/base/mult-ini.mkiv index 658716e31..0d325e1e0 100644 --- a/tex/context/base/mult-ini.mkiv +++ b/tex/context/base/mult-ini.mkiv @@ -123,7 +123,7 @@ \edef\!!TLT{\detokenize{TLT}} \edef\!!TRT{\detokenize{TRT}} - + %D \macros %D {defineinterfaceconstant, %D defineinterfacevariable, @@ -162,9 +162,9 @@ %D \def\e!name{meaning} %D \stoptyping -\unexpanded\def\defineinterfaceconstant #1#2{\setvalue{\c!prefix!#1}{#2}} -\unexpanded\def\defineinterfacevariable #1#2{\setvalue{\v!prefix!#1}{#2}} -\unexpanded\def\defineinterfaceelement #1#2{\setvalue{\e!prefix!#1}{#2}} +\unexpanded\def\defineinterfaceconstant #1#2{\expandafter\def\csname\c!prefix!#1\endcsname{#2}} +\unexpanded\def\defineinterfacevariable #1#2{\expandafter\def\csname\v!prefix!#1\endcsname{#2}} +\unexpanded\def\defineinterfaceelement #1#2{\expandafter\def\csname\e!prefix!#1\endcsname{#2}} %D Next come some interface independant constants: %D @@ -173,12 +173,12 @@ %D \definefileconstant {name} {meaning} %D \stoptyping -\unexpanded\def\definereferenceconstant #1#2{\setvalue{\r!prefix!#1}{#2}} -\unexpanded\def\definefileconstant #1#2{\setvalue{\f!prefix!#1}{#2}} +\unexpanded\def\definereferenceconstant #1#2{\expandafter\def\csname\r!prefix!#1\endcsname{#2}} +\unexpanded\def\definefileconstant #1#2{\expandafter\def\csname\f!prefix!#1\endcsname{#2}} %D A new one: -\unexpanded\def\definetypescriptconstant#1#2{\setvalue{\t!prefix!#1}{#2}} +\unexpanded\def\definetypescriptconstant#1#2{\expandafter\def\csname\t!prefix!#1\endcsname{#2}} %D And finaly we have the one argument, space saving constants %D @@ -187,8 +187,8 @@ %D \definemessageconstant {name} %D \stoptyping -\unexpanded\def\definesystemconstant #1{\setvalue{\s!prefix!#1}{#1}} -\unexpanded\def\definemessageconstant #1{\setvalue{\m!prefix!#1}{#1}} +\unexpanded\def\definesystemconstant #1{\expandafter\def\csname\s!prefix!#1\endcsname{#1}} +\unexpanded\def\definemessageconstant #1{\expandafter\def\csname\m!prefix!#1\endcsname{#1}} %D In a parameter driven system, some parameters are shared %D by more system components. In \CONTEXT\ we can distinguish @@ -199,7 +199,7 @@ %D \definesystemvariable {name} %D \stoptyping -\unexpanded\def\definesystemvariable#1{\setevalue{\??prefix#1}{\@@prefix#1}} +\unexpanded\def\definesystemvariable#1{\expandafter\edef\csname\??prefix#1\endcsname{\@@prefix#1}} \definesystemvariable{ms} @@ -437,15 +437,15 @@ %D interface. (We no longer need the link back to the main %D internal interface.) -\unexpanded\def\doresetvalue #1#2{\dosetvalue{#1}{#2}{}} -\unexpanded\def\doignorevalue#1#2#3{\dosetvalue{#1}{#2}{}} +\unexpanded\def\doletvalue #1#2{\expandafter \let\csname#1#2\endcsname} +\unexpanded\def\dosetvalue #1#2{\expandafter \def\csname#1#2\endcsname} +\unexpanded\def\dosetevalue #1#2{\expandafter\edef\csname#1#2\endcsname} +\unexpanded\def\dosetgvalue #1#2{\expandafter\gdef\csname#1#2\endcsname} +\unexpanded\def\dosetxvalue #1#2{\expandafter\xdef\csname#1#2\endcsname} +\unexpanded\def\docopyvalue #1#2#3{\expandafter \def\csname#1#3\expandafter\endcsname\expandafter{\csname#2#3\endcsname}} -\unexpanded\def\doletvalue #1#2{\@EA \let\csname#1#2\endcsname} -\unexpanded\def\dosetvalue #1#2{\@EA \def\csname#1#2\endcsname} -\unexpanded\def\dosetevalue #1#2{\@EA\edef\csname#1#2\endcsname} -\unexpanded\def\dosetgvalue #1#2{\@EA\gdef\csname#1#2\endcsname} -\unexpanded\def\dosetxvalue #1#2{\@EA\xdef\csname#1#2\endcsname} -\unexpanded\def\docopyvalue#1#2#3{\@EA \def\csname#1#3\@EA\endcsname\@EA{\csname#2#3\endcsname}} +\unexpanded\def\doresetvalue #1#2{\expandafter \let\csname#1#2\endcsname\empty} +\unexpanded\def\doignorevalue#1#2#3{\expandafter \let\csname#1#2\endcsname\empty} %D We can now redefine some messages that will be %D introduced in the multi||lingual system module. @@ -712,11 +712,11 @@ \unexpanded\def\setinterfaceconstant#1#2% {\ctxlua{interfaces.setconstant("#1","#2")}% - \setvalue{\c!prefix!#1}{#1}} + \expandafter\def\csname\c!prefix!#1\endcsname{#1}} \unexpanded\def\setinterfacevariable#1#2% {\ctxlua{interfaces.setvariable("#1","#2")}% - \setvalue{\v!prefix!#1}{#2}} + \expandafter\def\csname\v!prefix!#1\endcsname{#2}} %D \macros %D {defineinterfaceconstant} @@ -727,7 +727,7 @@ %D documentation purposes the x||alternative comes in handy. \unexpanded\def\defineinterfaceconstant#1#2% - {\setvalue{\c!prefix!#1}{#2}} + {\expandafter\def\csname\c!prefix!#1\endcsname{#2}} %D \macros %D {startelements} @@ -752,21 +752,22 @@ \fi} \unexpanded\def\setinterfacecommand#1#2% - {\doifnot{#1}{#2}{\@EA\def\csname#2\@EA\endcsname\@EA{\csname#1\endcsname}}}% or just \let ? + {\doifnot{#1}{#2}% todo: let when already defined + {\expandafter\def\csname#2\expandafter\endcsname\expandafter{\csname#1\endcsname}}} %D We just ignore these: \unexpanded\def\startvariables{\gobbleuntil\stopvariables} \unexpanded\def\startconstants{\gobbleuntil\stopconstants} -\unexpanded\def\startelements {\gobbleuntil\stopelements} -\unexpanded\def\startcommands {\gobbleuntil\stopcommands} +\unexpanded\def\startelements {\gobbleuntil\stopelements } +\unexpanded\def\startcommands {\gobbleuntil\stopcommands } %D For at the \LUA\ end (experiment): -\def\do@sicon#1#2{\@EA\gdef\csname\c!prefix!#1\endcsname{#1}} -\def\do@sivar#1#2{\@EA\gdef\csname\v!prefix!#1\endcsname{#2}} -\def\do@siele#1#2{\@EA\gdef\csname\e!prefix!#1\endcsname{#2}} -\def\do@sicom#1#2{\@EA\gdef\csname#2\@EA\endcsname\@EA{\csname#1\endcsname}} +\def\do@sicon#1#2{\expandafter\gdef\csname\c!prefix!#1\endcsname{#1}} +\def\do@sivar#1#2{\expandafter\gdef\csname\v!prefix!#1\endcsname{#2}} +\def\do@siele#1#2{\expandafter\gdef\csname\e!prefix!#1\endcsname{#2}} +\def\do@sicom#1#2{\expandafter\gdef\csname#2\expandafter\endcsname\expandafter{\csname#1\endcsname}} %D \macros %D {interfaced} @@ -794,7 +795,6 @@ %D macro's can be enhanced with more testing facilities, but %D for the moment they suffice. - \ifdefined\zwnj \else \edef\zwnj{\directlua{utf.char(\number"200C)}} \fi % needed for cont-pe \ifdefined\zwj \else \edef\zwj {\directlua{utf.char(\number"200D)}} \fi % needed for cont-pe diff --git a/tex/context/base/mult-low.lua b/tex/context/base/mult-low.lua index 7ea99322a..9e9eb2031 100644 --- a/tex/context/base/mult-low.lua +++ b/tex/context/base/mult-low.lua @@ -18,7 +18,7 @@ return { "points", "halfpoint", "zeroskip", "pluscxxvii", "pluscxxviii", "pluscclv", "pluscclvi", - -- + -- -- "endoflinetoken", "outputnewlinechar", -- "emptytoks", "empty", "undefined", @@ -38,7 +38,7 @@ return { -- "attributeunsetvalue", -- - "uprotationangle", "rightrotatioangle", "downrotatioangle", "leftrotatioangle", + "uprotationangle", "rightrotationangle", "downrotationangle", "leftrotationangle", -- "ctxcatcodes", "texcatcodes", "notcatcodes", "txtcatcodes", "vrbcatcodes", "prtcatcodes", "nilcatcodes", "luacatcodes", "tpacatcodes", "tpbcatcodes", @@ -68,6 +68,15 @@ return { "unvoidbox", "vfilll", -- + "hglue", "vglue", "hfillneg", "vfillneg", "hfilllneg", "vfilllneg", + -- + "ruledhss", "ruledhfil", "ruledhfill", "ruledhfilneg", "ruledhfillneg", "normalhfillneg", + "ruledvss", "ruledvfil", "ruledvfill", "ruledvfilneg", "ruledvfillneg", "normalvfillneg", + "ruledhbox", "ruledvbox", "ruledvtop", "ruledvcenter", + "ruledhskip", "ruledvskip", "ruledkern", "ruledmskip", "ruledmkern", + "ruledhglue", "ruledvglue", "normalhglue", "normalvglue", + "ruledpenalty", + -- "scratchcounter", "globalscratchcounter", "scratchdimen", "globalscratchdimen", "scratchskip", "globalscratchskip", @@ -75,7 +84,7 @@ return { "scratchtoks", "globalscratchtoks", "scratchbox", "globalscratchbox", -- - "nextbox", + "nextbox", "dowithnextbox", "dowithnextboxcs", "dowithnextboxcontent", "dowithnextboxcontentcs", -- "scratchwidth", "scratchheight", "scratchdepth", "scratchoffset", -- diff --git a/tex/context/base/mult-sys.mkiv b/tex/context/base/mult-sys.mkiv index 09918ba6c..b36a43ead 100644 --- a/tex/context/base/mult-sys.mkiv +++ b/tex/context/base/mult-sys.mkiv @@ -718,6 +718,7 @@ \definesystemvariable {ui} % UItvoer \definesystemvariable {un} % UNits \definesystemvariable {ur} % URl +\definesystemvariable {ut} % strUT \definesystemvariable {up} % Utility Program \definesystemvariable {va} % VspAce \definesystemvariable {ve} % VErsie diff --git a/tex/context/base/page-app.mkiv b/tex/context/base/page-app.mkiv index e2a249531..c1f3859e1 100644 --- a/tex/context/base/page-app.mkiv +++ b/tex/context/base/page-app.mkiv @@ -80,7 +80,7 @@ \bgroup \gobblespacetokens} -\unexpanded\def\stop_fitting_page_normal +\unexpanded\def\stop_fitting_page_normal % todo: figure out why a small mp image gets shifted {\removeunwantedspaces \egroup \egroup diff --git a/tex/context/base/page-brk.mkiv b/tex/context/base/page-brk.mkiv index 0ee720662..244036bc9 100644 --- a/tex/context/base/page-brk.mkiv +++ b/tex/context/base/page-brk.mkiv @@ -330,20 +330,20 @@ \relax \ifcase\testpagemethod \ifdim\d_page_tests_test>.99\pagegoal - \penalty-\!!tenthousand\relax + \penalty-\plustenthousand \fi \or \ifdim\dimexpr\d_page_tests_test-\pagegoal\relax>-\lineheight - \penalty-\!!tenthousand\relax + \penalty-\plustenthousand \fi \or \getnoflines\pagegoal \ifdim\dimexpr\d_page_tests_test-\noflines\lineheight\relax>-\lineheight - \penalty-\!!tenthousand\relax + \penalty-\plustenthousand \fi \or % same as 0 but more accurate \ifdim\dimexpr\d_page_tests_test-10\scaledpoint\relax>\pagegoal - \penalty-\!!tenthousand\relax + \penalty-\plustenthousand \fi \fi \else\ifnum\c_page_tests_mode=\plusthree diff --git a/tex/context/base/page-lay.mkiv b/tex/context/base/page-lay.mkiv index e397e2c78..c6ff5bc66 100644 --- a/tex/context/base/page-lay.mkiv +++ b/tex/context/base/page-lay.mkiv @@ -427,39 +427,39 @@ [\page_paper_the_paper_size{#1}]% [\page_paper_the_print_size{#2}]}} -\setvalue{\??pp:1:\v!reset }{\global\setfalse\c_page_target_paper_landscape - \global\setfalse\c_page_target_paper_mirror - \global\setfalse\c_page_target_paper_negate - \global\c_page_target_paper_orientation\uprotationangle - \global\c_page_target_paper_reverse \uprotationangle} -\setvalue{\??pp:1:\v!landscape }{\global\settrue\c_page_target_paper_landscape} -\setvalue{\??pp:1:\v!mirrored }{\global\settrue\c_page_target_paper_mirror} -\setvalue{\??pp:1:\v!negative }{\global\settrue\c_page_target_paper_negate} -\setvalue{\??pp:1:\v!rotated }{\global\c_page_target_paper_orientation\rightrotatioangle - \global\c_page_target_paper_reverse \leftrotatioangle} -\setvalue{\??pp:1:\number\rightrotatioangle}{\global\c_page_target_paper_orientation\rightrotatioangle - \global\c_page_target_paper_reverse \leftrotatioangle} -\setvalue{\??pp:1:\number\downrotatioangle }{\global\c_page_target_paper_orientation\downrotatioangle - \global\c_page_target_paper_reverse \zerocount} -\setvalue{\??pp:1:\number\leftrotatioangle }{\global\c_page_target_paper_orientation\leftrotatioangle - \global\c_page_target_paper_reverse \rightrotatioangle} - -\setvalue{\??pp:1:\v!reset }{\global\setfalse\c_page_target_print_landscape - \global\setfalse\c_page_target_print_mirror - \global\setfalse\c_page_target_print_negate - \global\c_page_target_print_orientation\uprotationangle - \global\c_page_target_print_reverse \uprotationangle} -\setvalue{\??pp:2:\v!landscape }{\global\settrue\c_page_target_print_landscape} -\setvalue{\??pp:2:\v!mirrored }{\global\settrue\c_page_target_print_mirror} -\setvalue{\??pp:2:\v!negative }{\global\settrue\c_page_target_print_negate} -\setvalue{\??pp:2:\v!rotated }{\global\c_page_target_print_orientation\rightrotatioangle - \global\c_page_target_print_reverse \leftrotatioangle} -\setvalue{\??pp:2:\number\rightrotatioangle}{\global\c_page_target_print_orientation\rightrotatioangle - \global\c_page_target_print_reverse \leftrotatioangle} -\setvalue{\??pp:2:\number\downrotatioangle }{\global\c_page_target_print_orientation\downrotatioangle - \global\c_page_target_print_reverse \zerocount} -\setvalue{\??pp:2:\number\leftrotatioangle }{\global\c_page_target_print_orientation\leftrotatioangle - \global\c_page_target_print_reverse \rightrotatioangle} +\setvalue{\??pp:1:\v!reset }{\global\setfalse\c_page_target_paper_landscape + \global\setfalse\c_page_target_paper_mirror + \global\setfalse\c_page_target_paper_negate + \global\c_page_target_paper_orientation\uprotationangle + \global\c_page_target_paper_reverse \uprotationangle} +\setvalue{\??pp:1:\v!landscape }{\global\settrue\c_page_target_paper_landscape} +\setvalue{\??pp:1:\v!mirrored }{\global\settrue\c_page_target_paper_mirror} +\setvalue{\??pp:1:\v!negative }{\global\settrue\c_page_target_paper_negate} +\setvalue{\??pp:1:\v!rotated }{\global\c_page_target_paper_orientation\rightrotationangle + \global\c_page_target_paper_reverse \leftrotationangle} +\setvalue{\??pp:1:\number\rightrotationangle}{\global\c_page_target_paper_orientation\rightrotationangle + \global\c_page_target_paper_reverse \leftrotationangle} +\setvalue{\??pp:1:\number\downrotationangle }{\global\c_page_target_paper_orientation\downrotationangle + \global\c_page_target_paper_reverse \zerocount} +\setvalue{\??pp:1:\number\leftrotationangle }{\global\c_page_target_paper_orientation\leftrotationangle + \global\c_page_target_paper_reverse \rightrotationangle} + +\setvalue{\??pp:1:\v!reset }{\global\setfalse\c_page_target_print_landscape + \global\setfalse\c_page_target_print_mirror + \global\setfalse\c_page_target_print_negate + \global\c_page_target_print_orientation\uprotationangle + \global\c_page_target_print_reverse \uprotationangle} +\setvalue{\??pp:2:\v!landscape }{\global\settrue\c_page_target_print_landscape} +\setvalue{\??pp:2:\v!mirrored }{\global\settrue\c_page_target_print_mirror} +\setvalue{\??pp:2:\v!negative }{\global\settrue\c_page_target_print_negate} +\setvalue{\??pp:2:\v!rotated }{\global\c_page_target_print_orientation\rightrotationangle + \global\c_page_target_print_reverse \leftrotationangle} +\setvalue{\??pp:2:\number\rightrotationangle}{\global\c_page_target_print_orientation\rightrotationangle + \global\c_page_target_print_reverse \leftrotationangle} +\setvalue{\??pp:2:\number\downrotationangle }{\global\c_page_target_print_orientation\downrotationangle + \global\c_page_target_print_reverse \zerocount} +\setvalue{\??pp:2:\number\leftrotationangle }{\global\c_page_target_print_orientation\leftrotationangle + \global\c_page_target_print_reverse \rightrotationangle} \def\pages_paper_handle_page_option #1{\ifcsname\??pp:1:#1\endcsname\csname\??pp:1:#1\endcsname\fi} \def\pages_paper_handle_print_option#1{\ifcsname\??pp:2:#1\endcsname\csname\??pp:2:#1\endcsname\fi} @@ -521,14 +521,14 @@ \ifx\tmp_pages_asked_option\v!max % \v!fit is \begingroup % we need to pre-swap else we get the wrong paper size - \ifnum\c_page_target_paper_orientation=\rightrotatioangle + \ifnum\c_page_target_paper_orientation=\rightrotationangle \swapdimens\paperwidth\paperheight - \else\ifnum\c_page_target_paper_orientation=\leftrotatioangle + \else\ifnum\c_page_target_paper_orientation=\leftrotationangle \swapdimens\paperwidth\paperheight \fi\fi - \ifnum\c_page_target_print_orientation=\rightrotatioangle + \ifnum\c_page_target_print_orientation=\rightrotationangle \swapdimens\printpaperwidth\printpaperheight - \else\ifnum\c_page_target_print_orientation=\leftrotatioangle + \else\ifnum\c_page_target_print_orientation=\leftrotationangle \swapdimens\printpaperwidth\printpaperheight \fi\fi \ifdim\paperheight>\printpaperheight diff --git a/tex/context/base/page-mul.mkiv b/tex/context/base/page-mul.mkiv index 91342f6c4..0f33fc37c 100644 --- a/tex/context/base/page-mul.mkiv +++ b/tex/context/base/page-mul.mkiv @@ -1051,7 +1051,7 @@ \dohandleallcolumns {\advance\dimen0 \ht\currenttopcolumnbox}% \divide\dimen0 \nofcolumns - \vbadness\!!tenthousand\relax + \vbadness\plustenthousand \count255=\zerocount \bgroup \ifgridsnapping diff --git a/tex/context/base/page-set.mkiv b/tex/context/base/page-set.mkiv index 9777e433b..e46c94006 100644 --- a/tex/context/base/page-set.mkiv +++ b/tex/context/base/page-set.mkiv @@ -2536,7 +2536,6 @@ \@EA\uppercasestring\floatmethod\to\floatmethod % todo : \v!here -> here enzovoorts \OTRSETstoreincolumnslot\floatmethod\scratchbox - % watch out: no \dochecknextindentation{tag} \checknextindentation[\namedframedtextparameter{cs:#1}\c!indentnext]% \else % of course we needed a one-column fall back for tm; brrr, the box has now too diff --git a/tex/context/base/page-txt.mkvi b/tex/context/base/page-txt.mkvi index bf4c3c40b..ff78ff89d 100644 --- a/tex/context/base/page-txt.mkvi +++ b/tex/context/base/page-txt.mkvi @@ -115,6 +115,16 @@ \unexpanded\def\setupfooter{\dotripleempty\setup_layout_text[\v!footer]} \unexpanded\def\setupbottom{\dotripleempty\setup_layout_text[\v!bottom]} +%D We inherit some settings: + +\setuplayoutelement + [ \c!leftstyle=\layoutelementparameter\c!style, + \c!rightstyle=\layoutelementparameter\c!style, + \c!leftcolor=\layoutelementparameter\c!color, + \c!rightcolor=\layoutelementparameter\c!color, + \c!leftwidth=\layoutelementparameter\c!width, + \c!rightwidth=\layoutelementparameter\c!width] + %D \macros %D {noheaderandfooterlines,notopandbottomlines} %D diff --git a/tex/context/base/spac-ali.mkiv b/tex/context/base/spac-ali.mkiv index b50ee59f6..371701a01 100644 --- a/tex/context/base/spac-ali.mkiv +++ b/tex/context/base/spac-ali.mkiv @@ -31,14 +31,14 @@ % We will not use bodydir and pagedir so we disable them. That way we get % normal hyperlink support. -\let\@@bodydir\normalbodydir -\let\@@pagedir\normalpagedir +\let\saved_normal_body_dir\normalbodydir +\let\saved_normal_page_dir\normalpagedir -\unexpanded\def\bodydir{\afterassignment\do@@bodydir\@@bodydir} \let\normalbodydir\bodydir -\unexpanded\def\pagedir{\afterassignment\do@@pagedir\@@pagedir} \let\normalpagedir\pagedir +\unexpanded\def\bodydir{\afterassignment\bodydir_indeed\saved_normal_body_dir} \let\normalbodydir\bodydir +\unexpanded\def\pagedir{\afterassignment\pagedir_indeed\saved_normal_page_dir} \let\normalpagedir\pagedir -\def\do@@bodydir{\@@bodydir TLT\relax} -\def\do@@pagedir{\@@pagedir TLT\relax} +\def\bodydir_indeed{\saved_normal_body_dir TLT\relax} +\def\pagedir_indeed{\saved_normal_page_dir TLT\relax} % This will become a more advanced layout controller soon: @@ -48,26 +48,38 @@ \unexpanded\def\lefttoright {\ifvmode - \settrue\displaylefttoright - \settrue\inlinelefttoright - \textdir TLT\relax - \pardir TLT\relax + \lefttoright_vmode \else - \settrue\inlinelefttoright - \textdir TLT\relax + \lefttoright_hmode \fi} +\unexpanded\def\lefttoright_vmode + {\settrue\displaylefttoright + \settrue\inlinelefttoright + \textdir TLT\relax + \pardir TLT\relax} + +\unexpanded\def\lefttoright_hmode + {\settrue\inlinelefttoright + \textdir TLT\relax} + \unexpanded\def\righttoleft {\ifvmode - \setfalse\displaylefttoright - \setfalse\inlinelefttoright - \textdir TRT\relax - \pardir TRT\relax + \righttoleft_vmode \else - \textdir TRT\relax - \setfalse\inlinelefttoright + \righttoleft_hmode \fi} +\unexpanded\def\righttoleft_vmode + {\setfalse\displaylefttoright + \setfalse\inlinelefttoright + \textdir TRT\relax + \pardir TRT\relax} + +\unexpanded\def\righttoleft_hmode + {\textdir TRT\relax + \setfalse\inlinelefttoright} + \def\currentdirectionparameters {\ifconditional\inlinelefttoright \else idir="r2l", @@ -78,32 +90,30 @@ \unexpanded\def\synchronizelayoutdirection {\ifconditional\layoutlefttoright - \settrue\inlinelefttoright - \textdir TLT\relax - \pardir TLT\relax + \synchronizedirection_lr \else - \setfalse\inlinelefttoright - \textdir TRT\relax - \pardir TRT\relax + \synchronizedirection_rl \fi} \unexpanded\def\synchronizedisplaydirection {\ifconditional\displaylefttoright - \settrue\inlinelefttoright - \textdir TLT\relax - \pardir TLT\relax + \synchronizedirection_lr \else - \setfalse\inlinelefttoright - \textdir TRT\relax - \pardir TRT\relax + \synchronizedirection_rl \fi} +\def\synchronizedirection_lr + {\settrue\inlinelefttoright + \textdir TLT\relax + \pardir TLT\relax} + +\def\synchronizedirection_rl + {\setfalse\inlinelefttoright + \textdir TRT\relax + \pardir TRT\relax} + \unexpanded\def\synchronizeinlinedirection - {\ifconditional\inlinelefttoright - \textdir TLT\relax - \else - \textdir TRT\relax - \fi} + {\textdir T\ifconditional\inlinelefttoright L\else R\fi T\relax} \unexpanded\def\showdirections {\dontleavehmode @@ -253,6 +263,7 @@ \else \rawprocesscommacommand[\askedraggedalign]\dododosetraggedcommand \fi + % probably also ok: \normalexpanded{\everyraggedcommand{\resetrealignsignal\the\everyraggedcommand\ragged_command_flush_align}}} \normalexpanded{\everyraggedcommand\expandafter{\expandafter\resetrealignsignal\the\everyraggedcommand\ragged_command_flush_align}}} \def\nonosetraggedcommand @@ -718,7 +729,7 @@ \dontleavehmode % added in marrakesch at TUG 2006\begingroup \begingroup \setlocalhsize % new - \def\\{\egroup\par\doalignline{#1}{#2}\bgroup}% + \def\\{\endgroup\par\doalignline{#1}{#2}\begingroup}% \dowithnextbox {\hbox to \localhsize {\ifcase\alignstrutmode\or\strut\fi @@ -744,8 +755,6 @@ \let\centeraligned\midaligned -% \def\regelbegrensd#1{\limitatetext{#1}{\hsize}{\unknown}} % to be translated - % indirecte commando's \letvalue{\s!do\v!line\v!left }\leftaligned @@ -766,7 +775,7 @@ \dontleavehmode % added in marrakesch at TUG 2006\begingroup \begingroup \setlocalhsize - \def\\{\egroup\par\doxalignline#1#2#3#4#5#6\bgroup}% inefficient + \def\\{\endgroup\par\doxalignline#1#2#3#4#5#6\begingroup}% inefficient \dowithnextbox {%\noindent moved up \hbox to \localhsize diff --git a/tex/context/base/spac-def.mkiv b/tex/context/base/spac-def.mkiv index 32978076f..c1703fadb 100644 --- a/tex/context/base/spac-def.mkiv +++ b/tex/context/base/spac-def.mkiv @@ -15,7 +15,7 @@ \unprotect -\newconstant\c_spac_default_tolerance \c_spac_default_tolerance 1500 +\newconstant\c_spacing_default_tolerance \c_spacing_default_tolerance 1500 \def\forgeteverypar {\everypar{\the\neverypar}} @@ -38,7 +38,7 @@ \let\currentwhitespace\v!none} \def\forgetbothskips - {\tolerance\c_spac_default_tolerance + {\tolerance\c_spacing_default_tolerance \leftskip\zeropoint \rightskip\zeropoint \relax} diff --git a/tex/context/base/spac-grd.mkiv b/tex/context/base/spac-grd.mkiv index 6cd1c37b1..54f1e5ce4 100644 --- a/tex/context/base/spac-grd.mkiv +++ b/tex/context/base/spac-grd.mkiv @@ -291,7 +291,7 @@ \vspacing[\the\dimexpr\strutdp\relax]% \fi \prevdepth\strutdp} - + \let\normalstartbaselinecorrection\startbaselinecorrection \unexpanded\def\startbaselinecorrection diff --git a/tex/context/base/spac-hor.mkiv b/tex/context/base/spac-hor.mkiv index 2e5884325..3d5424229 100644 --- a/tex/context/base/spac-hor.mkiv +++ b/tex/context/base/spac-hor.mkiv @@ -31,7 +31,7 @@ %D need to check if the next paragraph has to be indented. \def\presetindentation - {\doifoutervmode{\ifindentfirstparagraph\else\noindentation\fi}} + {\doifoutervmode{\ifindentfirstparagraph\else\indentation_variant_no\fi}} % we need a better everypar model: for each option a switch, which we % set to false with \forgetall and can enable when needed (context 4); @@ -42,7 +42,7 @@ \doifsometokselse\everypar\donothing\docheckupcomingindentation \fi} -\def\docheckupcomingindentation +\def\docheckupcomingindentation % brr {\appendtoks\checkindentation\to\everypar} \definecomplexorsimple\setupindenting @@ -61,8 +61,8 @@ \processcommacommand[\currentindenting]\docomplexsetupindentingA % catch small, medium, etc \processcommacommand[\currentindenting]\docomplexsetupindentingB % catch rest \checkeverypar % only when non-empty #1 - \ifindentfirstparagraph\else\noindentation\fi % added - \toggleindentation} + \ifindentfirstparagraph\else\indentation_variant_no\fi + \indentation_check_toggle} \def\docomplexsetupindentingA#1% {\ifcsname\??in:#1\endcsname @@ -124,51 +124,70 @@ \unexpanded\def\noindenting{\indenting[\v!no, \v!next ]} \unexpanded\def\doindenting{\indenting[\v!yes,\v!first]} -%D This one sets up the local indentation behaviour (i.e. either or not -%D a next paragraph will be indented). +%D Here come the handlers (still rather messy ... we need states). -\def\dochecknextindentation#1% internal one - {\checknextindentation[\csname#1\c!indentnext\endcsname]} +\newif\ifindentation \indentationtrue % documenteren, naar buiten -\setvalue{\??in->\s!empty}{} -\setvalue{\??in->\v!yes }{\doindentation} -\setvalue{\??in->\v!no }{\noindentation} -\setvalue{\??in->\v!auto }{\autoindentation} +\let\checkindentation\relax -\unexpanded\def\checknextindentation[#1]% - {\csname\??in->\ifcsname\??in->#1\endcsname#1\else\s!empty\fi\endcsname} +\def\indentation_remove + {\ifdim\parindent=\zeropoint \else + \begingroup + \setbox\scratchbox\lastbox + \endgroup + \fi} -%D Here come the handlers. +\def\indentation_kill_indeed + {\global\indentationfalse + \indentation_remove} -\newif\ifindentation \indentationtrue % documenteren, naar buiten +\def\indentation_do_toggle_indeed + {\global\indentationfalse + \global\let\checkindentation\indentation_no_toggle_indeed + \indentation_remove} -\let\checkindentation\relax +\def\indentation_no_toggle_indeed + {\global\indentationtrue + \global\let\checkindentation\indentation_do_toggle_indeed} + +\def\indentation_do_indeed + {\global\indentationtrue} -\ifx\autoindentation\undefined \let\autoindentation\relax \fi % hook +\def\indentation_do_toggle + {\global\let\checkindentation\indentation_do_toggle_indeed} -\def\doindentation - {\gdef\checkindentation{\global\indentationtrue}} +\def\indentation_no_toggle + {\global\let\checkindentation\indentation_no_toggle_indeed} -\def\noindentation % made global +\def\indentation_check_toggle + {\ifcase\indentingtogglestate + % nothing + \or + \indentation_no_toggle + \or + \indentation_do_toggle + \fi} + +\def\indentation_variant_yes + {\global\let\checkindentation\indentation_do_indeed} + +\def\indentation_no_next_check + {\indentation_remove + \global\let\checkindentation\indentation_do_indeed} + +\def\indentation_variant_no % made global {\ifinpagebody \else \global\indentationfalse - \gdef\checkindentation - {\donoindentation - \gdef\checkindentation{\global\indentationtrue}}% + \global\let\checkindentation\indentation_no_next_check \fi} \def\nonoindentation % bv bij floats {\ifinpagebody \else \global\indentationtrue - \gdef\checkindentation{\global\indentationtrue}% - \fi} - -\def\donoindentation - {\ifdim\parindent=\zeropoint \else - \bgroup \setbox\scratchbox\lastbox \egroup + \global\let\checkindentation\indentation_do_indeed \fi} -\def\indentation +\def\indentation_variant_force {\ifvmode \ifdim\parindent=\zeropoint \else % was : \hskip\parindent % can be: \indent @@ -176,52 +195,47 @@ \noindent\hskip\parindent \fi \fi} -\def\toggleindentation % does not play well with noindentation - {\ifcase\indentingtogglestate - % nothing - \or - \notoggleindentation - \or - \dotoggleindentation - \fi} - -\def\dokillindentation - {\gdef\checkindentation{\global\indentationfalse\donoindentation}} - -\def\dotoggleindentation - {\gdef\checkindentation{\global\indentationfalse\notoggleindentation\donoindentation}} - -\def\notoggleindentation - {\gdef\checkindentation{\global\indentationtrue\dotoggleindentation}} - \appendtoks - \pushmacro\checkindentation - \pushmacro\ifindentation + \pushmacro\checkindentation + \pushmacro\ifindentation \to \everypushsomestate \appendtoks - \popmacro\ifindentation - \popmacro\checkindentation + \popmacro\ifindentation + \popmacro\checkindentation \to \everypopsomestate - -% This is a user requested hack (using the auto-hook). -\newconditional\recheckindentationmode +% public: -\def\dontrechecknextindentation - {\global\setfalse\recheckindentationmode} +\let\indentation \indentation_variant_force +\let\noindentation\indentation_variant_no % public +\let\doindentation\indentation_variant_yes % public -\def\dorechecknextindentation - {\ifconditional\recheckindentationmode - \dontrechecknextindentation - \expandafter\doautoindentation - \fi} +\def\dontrechecknextindentation % public (in macros) + {\global\let\dorechecknextindentation\relax} + +\let\dorechecknextindentation\relax % public (in macros) + +\def\indentation_check_next_indentation + {\global\let\dorechecknextindentation\relax + \doifnextcharelse\par\donothing\indentation_variant_no} + +\def\indentation_variant_auto + {\global\let\dorechecknextindentation\indentation_check_next_indentation} + +%D This one sets up the local indentation behaviour (i.e. either or not +%D a next paragraph will be indented). -\def\doautoindentation - {\doifnextcharelse\par\donothing\noindentation} +\def\dochecknextindentation#1% obsolete + {\checknextindentation[\csname#1\c!indentnext\endcsname]} + +\unexpanded\def\checknextindentation[#1]% + {\csname\??in:c:\ifcsname\??in:c:#1\endcsname#1\else\s!empty\fi\endcsname} -\def\autoindentation - {\global\settrue\recheckindentationmode} +\letvalue{\??in:c:\s!empty}\donothing +\letvalue{\??in:c:\v!yes }\indentation_variant_yes +\letvalue{\??in:c:\v!no }\indentation_variant_no +\letvalue{\??in:c:\v!auto }\indentation_variant_auto %D An example of usage: %D @@ -276,22 +290,22 @@ \sfcode`\'=0 \sfcode`\]=0 -\def\setfrenchspacing#1% +\unexpanded\def\setfrenchspacing#1% {\sfcode`\.#1 \sfcode`\,#1\relax \sfcode`\?#1 \sfcode`\!#1\relax \sfcode`\:#1 \sfcode`\;#1\relax} -\def\frenchspacing +\unexpanded\def\frenchspacing {\setfrenchspacing{1000}} -\def\resetfrenchspacing +\unexpanded\def\resetfrenchspacing {\sfcode`\.3000 \sfcode`\,1250 \sfcode`\?3000 \sfcode`\!3000 \sfcode`\:2000 \sfcode`\;1500 } -\def\frenchspacing {\setfrenchspacing{1000}} -\def\newfrenchspacing{\setfrenchspacing{1050}} -\def\nonfrenchspacing{\resetfrenchspacing} +\unexpanded\def\frenchspacing {\setfrenchspacing{1000}} +\unexpanded\def\newfrenchspacing{\setfrenchspacing{1050}} +\unexpanded\def\nonfrenchspacing{\resetfrenchspacing} \unexpanded\def\definespacingmethod[#1]#2{\setvalue{\??sg\??sg#1}{#2}} diff --git a/tex/context/base/spac-ver.mkiv b/tex/context/base/spac-ver.mkiv index fe83414c7..a8c683d4e 100644 --- a/tex/context/base/spac-ver.mkiv +++ b/tex/context/base/spac-ver.mkiv @@ -78,7 +78,7 @@ \fi -\def\presetnormallineheight +\def\presetnormallineheight % each bodyfont {\edef\normallineheight{\interlinespaceparameter\c!line}% %done elsewhere : \spacing\!!plusone % new per 10/08/2004, else problems in otr / !! needed \iflocalinterlinespace \else @@ -87,6 +87,34 @@ {\edef\normallineheight{\bodyfontinterlinespace}}}% \fi} +% to be tested: +% +% \def\presetnormallineheight % each bodyfont +% {\iflocalinterlinespace +% \presetnormallineheight_regular +% \else +% \presetnormallineheight_checked +% \fi} +% +% \def\presetnormallineheight_regular +% {\edef\normallineheight{\interlinespaceparameter\c!line}} +% +% \def\presetnormallineheight_checked +% {\edef\askedbodyfontinterlinespecs{\bodyfontvariable{\normalizedbodyfontsize\c!interlinespace}}% +% \ifcsname\askedbodyfontinterlinespecs\endcsname +% \presetnormallineheight_specific +% \else +% \presetnormallineheight_regular +% \fi} +% +% \def\presetnormallineheight_specific +% {\edef\askedbodyfontinterlinespace{\csname\bodyfontinterlinespecs\endcsname}% +% \ifx\askedbodyfontinterlinespace\empty +% \presetnormallineheight_regular +% \else +% \let\normallineheight\askedbodyfontinterlinespace +% \fi} + \unexpanded\def\setupspecifiedinterlinespace[#1]% {\getparameters[\??it\currentinterlinespace][#1]% \dosetupspecifiedinterlinespaceindeed} @@ -578,14 +606,11 @@ \fi} \unexpanded\def\settopskip % the extra test is needed for the lbr family - {\topskip\systemtopskipfactor\globalbodyfontsize - \ifgridsnapping \else - \ifr@ggedbottom\!!plus5\globalbodyfontsize\fi - \fi - \ifgridsnapping + {\ifgridsnapping \topskip\zeropoint + \else + \topskip\systemtopskipfactor\globalbodyfontsize\ifr@ggedbottom\!!plus5\globalbodyfontsize\fi\relax \fi - \relax % the skip \topskipgap\topskip \advance\topskipgap -\openstrutheight\relax \ifdim\minimumstrutheight>\zeropoint @@ -674,7 +699,7 @@ \newbox\strutbox -\setbox\strutbox\normalhbox{\vrule height8.5pt depth3.5pt width\zeropoint} % just a start +\setbox\strutbox\normalhbox{\vrule\!!height8.5pt\!!depth3.5pt\!!width\zeropoint} % just a start \def\strut{\relax\ifmmode\copy\else\unhcopy\fi\strutbox} @@ -835,36 +860,27 @@ %D \NC \NC a normal strut \NC {\showstruts\setupstrut\strut} \NC \NR %D \stoptabulate -\setvalue{@strut@\v!yes }{\setstrut} -\setvalue{@strut@\v!auto }{\setautostrut} -\setvalue{@strut@\v!no }{\setnostrut} -\setvalue{@strut@\v!cap }{\setcapstrut} -\setvalue{@strut@\v!fit }{\setfontstrut} -\setvalue{@strut@\v!line }{\setstrut} -\setvalue{@strut@\s!default}{\setstrut} -\setvalue{@strut@\empty }{\setstrut} - \unexpanded\def\setupstrut - {\dosingleempty\dosetupstrut} + {\dosingleempty\spacing_setup_strut} -\def\dosetupstrut[#1]% yet undocumented, todo: fontstrut - {\ifcsname @strut@#1\endcsname - \csname @strut@#1\endcsname +\def\spacing_setup_strut[#1]% + {\ifcsname\??ut:#1\endcsname + \csname\??ut:#1\endcsname % these are defined later \else \setcharstrut{#1}% \fi} -\def\showstruts +\unexpanded\def\showstruts {\setteststrut \settestcrlf} -\def\setteststrut +\unexpanded\def\setteststrut {\def\strutwidth{.8pt}% \setstrut} \def\autostrutfactor{1.1} -\def\setautostrut +\unexpanded\def\setautostrut {\begingroup \setbox\scratchbox\copy\strutbox \setstrut @@ -876,55 +892,79 @@ \endgroup \fi\fi} +\newbox\nostrutbox \setbox\nostrutbox\emptyhbox + +\unexpanded\def\setnostrut + {\setbox\strutbox\copy\nostrutbox + \let\strut\empty + \let\endstrut\empty + \let\begstrut\empty + \let\crlfplaceholder\empty} + % when enabled, sigstruts will remove themselves if nothing % goes inbetween \newsignal\strutsignal \setfalse\sigstruts \unexpanded\def\begstrut - {\relax\ifcase\strutht\else - \ifconditional\sigstruts - \noindent\horizontalstrut - \normalpenalty\plustenthousand - \normalhskip-\strutsignal - \normalhskip\strutsignal - \else - \strut - \normalpenalty\plustenthousand - \normalhskip\zeropoint - \fi - \expandafter \ignorespaces + {\relax\ifcase\strutht + % \ignorespaces % maybe + \else + \spacing_begstrut \fi} +\def\spacing_begstrut + {\ifconditional\sigstruts + \spacing_begstrut_signal + \else + \spacing_begstrut_normal + \fi + \ignorespaces} + +\def\spacing_begstrut_signal + {\noindent\horizontalstrut + \normalpenalty\plustenthousand + \normalhskip-\strutsignal + \normalhskip\strutsignal} + +\def\spacing_begstrut_normal + {\strut + \normalpenalty\plustenthousand + \normalhskip\zeropoint} + \unexpanded\def\endstrut - {\relax\ifhmode\ifcase\strutht\else - \ifconditional\sigstruts - \ifdim\lastskip=\strutsignal - \unskip - \unskip - \unpenalty - \setbox\scratchbox\lastbox - \else - \normalpenalty\plustenthousand - \normalhskip\zeropoint - \strut - \fi + {\relax\ifhmode + \ifcase\strutht + % \removeunwantedspaces % maybe \else - \removeunwantedspaces - \normalpenalty\plustenthousand - \normalhskip\zeropoint - \strut + \spacing_endstrut \fi - \fi\fi} + \fi} -\newbox\nostrutbox \setbox\nostrutbox\emptyhbox +\def\spacing_endstrut + {\ifconditional\sigstruts + \spacing_endstrut_signal + \else + \spacing_endstrut_normal + \fi} -\def\setnostrut - {\setbox\strutbox\copy\nostrutbox - \let\strut\empty - \let\endstrut\empty - \let\begstrut\empty - \let\crlfplaceholder\empty} +\def\spacing_endstrut_signal + {\ifdim\lastskip=\strutsignal + \unskip + \unskip + \unpenalty + \setbox\scratchbox\lastbox + \else + \normalpenalty\plustenthousand + \normalhskip\zeropoint + \strut + \fi} + +\def\spacing_endstrut_normal + {\removeunwantedspaces + \normalpenalty\plustenthousand + \normalhskip\zeropoint + \strut} % unsave: % @@ -942,22 +982,31 @@ % % so: -\def\pseudostrut +\unexpanded\def\pseudostrut {\noindent} % better: \dontleavehmode \let\pseudobegstrut\pseudostrut - \let\pseudoendstrut\removeunwantedspaces -\def\resetteststrut +\unexpanded\def\resetteststrut {\def\strutwidth{\zeropoint}% no let \setstrut} -\ifdefined\setfontparameters\else - % problems ! ! ! ! +\ifdefined\setfontparameters \else \def\setfontparameters{\the\everybodyfont} \fi +%D Keyword based strutting: + +\letvalue{\??ut:\v!yes }\setstrut % \setvalue{\??ut:\v!yes }{\setstrut} +\setvalue{\??ut:\v!auto }\setautostrut % \setvalue{\??ut:\v!auto }{\setautostrut} +\letvalue{\??ut:\v!no }\setnostrut % \setvalue{\??ut:\v!no }{\setnostrut} +\letvalue{\??ut:\v!cap }\setcapstrut % \setvalue{\??ut:\v!cap }{\setcapstrut} +\letvalue{\??ut:\v!fit }\setfontstrut % \setvalue{\??ut:\v!fit }{\setfontstrut} +\letvalue{\??ut:\v!line }\setstrut % \setvalue{\??ut:\v!line }{\setstrut} +\letvalue{\??ut:\s!default}\setstrut % \setvalue{\??ut:\s!default}{\setstrut} +\letvalue{\??ut:\empty }\setstrut % \setvalue{\??ut:\empty }{\setstrut} + %D Handy: \def\baselinedistance{\the\lineheight} @@ -967,21 +1016,21 @@ %D why|>| this assignment gives troubles in for instance the %D visual debugger. -\def\offinterlineskip +\unexpanded\def\offinterlineskip {\baselineskip-\thousandpoint \lineskip\zeropoint \lineskiplimit\maxdimen % We also need this here now; thanks to taco for figuring that out! \def\minimumlinedistance{\zeropoint}} -\def\nointerlineskip +\unexpanded\def\nointerlineskip {\prevdepth-\thousandpoint} -\let\normaloffinterlineskip=\offinterlineskip % knuth's original +\let\normaloffinterlineskip\offinterlineskip % knuth's original %D My own one: -\def\dopushinterlineskip +\unexpanded\def\dopushinterlineskip {\edef\oninterlineskip {\baselineskip\the\baselineskip \lineskip\the\lineskip @@ -989,10 +1038,10 @@ \noexpand\edef\noexpand\minimumlinedistance{\the\dimexpr\minimumlinedistance}% \let\noexpand\offinterlineskip\noexpand\normaloffinterlineskip}} -\def\nopushinterlineskip +\unexpanded\def\nopushinterlineskip {\let\oninterlineskip\setnormalbaselines} -\def\offinterlineskip +\unexpanded\def\offinterlineskip {\ifdim\baselineskip>\zeropoint \dopushinterlineskip \else @@ -1000,19 +1049,19 @@ \fi \normaloffinterlineskip} -\let\oninterlineskip=\relax - -\def\leaveoutervmode +\let\oninterlineskip\relax + +\unexpanded\def\leaveoutervmode {\ifvmode\ifinner\else \leavevmode \fi\fi} -\def\resetpenalties#1% +\unexpanded\def\resetpenalties#1% {\ifdefined#1% #1\minusone \fi} -\def\setpenalties#1#2#3% +\unexpanded\def\setpenalties#1#2#3% {\ifdefined#1% space before #3 prevents lookahead problems, needed when #3=text #1\numexpr#2+\plusone\relax\space\doexpandedrecurse{\the\numexpr#2\relax}{ #3}\zerocount\relax \fi} @@ -1031,12 +1080,12 @@ \newcount\nofkeeplinestogether \let\restoreinterlinepenalty\relax -\def\dorestoreinterlinepenalty +\unexpanded\def\dorestoreinterlinepenalty {\global\let\restoreinterlinepenalty\relax \global\resetpenalties\interlinepenalties \global\nofkeeplinestogether\zerocount} -\def\keeplinestogether#1% +\unexpanded\def\keeplinestogether#1% {\ifnum#1>\nofkeeplinestogether \global\nofkeeplinestogether#1% \global\setpenalties\interlinepenalties\nofkeeplinestogether\plustenthousand @@ -1055,7 +1104,7 @@ \def\defaultgriddisplaywidowpenalty {0} \def\defaultgridbrokenpenalty {0} -\def\nopenalties +\unexpanded\def\nopenalties {\widowpenalty \zerocount \clubpenalty \zerocount \brokenpenalty \zerocount @@ -1063,36 +1112,36 @@ \finalhyphendemerits \zerocount \adjdemerits \zerocount} -\def\setdefaultpenalties +\unexpanded\def\setdefaultpenalties {\directsetup{\systemsetupsprefix\s!default}} \startsetups [\systemsetupsprefix\s!reset] - \resetpenalties\widowpenalties - \resetpenalties\clubpenalties - \resetpenalties\interlinepenalties + \resetpenalties\widowpenalties + \resetpenalties\clubpenalties + \resetpenalties\interlinepenalties \stopsetups % we use \directsetup because it's faster and we know there is no csl \startsetups [\systemsetupsprefix\s!default] - \directsetup{\systemsetupsprefix\s!reset} + \directsetup{\systemsetupsprefix\s!reset} - \widowpenalty \defaultwidowpenalty - \clubpenalty \defaultclubpenalty - \displaywidowpenalty\defaultdisplaywidowpenalty - \brokenpenalty \defaultbrokenpenalty + \widowpenalty \defaultwidowpenalty + \clubpenalty \defaultclubpenalty + \displaywidowpenalty\defaultdisplaywidowpenalty + \brokenpenalty \defaultbrokenpenalty \stopsetups \startsetups [\v!grid] [\systemsetupsprefix\s!default] - \directsetup{\systemsetupsprefix\s!reset} + \directsetup{\systemsetupsprefix\s!reset} - \widowpenalty \defaultgridwidowpenalty - \clubpenalty \defaultgridclubpenalty - \displaywidowpenalty\defaultgriddisplaywidowpenalty - \brokenpenalty \defaultgridbrokenpenalty + \widowpenalty \defaultgridwidowpenalty + \clubpenalty \defaultgridclubpenalty + \displaywidowpenalty\defaultgriddisplaywidowpenalty + \brokenpenalty \defaultgridbrokenpenalty \stopsetups @@ -1100,11 +1149,11 @@ \startsetups [\systemsetupsprefix\v!strict] - \directsetup{\systemsetupsprefix\s!reset} + \directsetup{\systemsetupsprefix\s!reset} - \setpenalties\widowpenalties2\maxdimen - \setpenalties\clubpenalties 2\maxdimen - \brokenpenalty \maxdimen + \setpenalties\widowpenalties2\maxdimen + \setpenalties\clubpenalties 2\maxdimen + \brokenpenalty \maxdimen \stopsetups @@ -1123,36 +1172,36 @@ \def\bottomalignlimit{3\lineheight} -\newif\ifn@rmalbottom -\newif\ifr@ggedbottom -\newif\ifb@selinebottom +\newif\ifn@rmalbottom % this will be a proper constant +\newif\ifr@ggedbottom % this will be a proper constant +\newif\ifb@selinebottom % this will be a proper constant -\def\normalbottom +\unexpanded\def\normalbottom {% \topskip 10pt \r@ggedbottomfalse} -\def\raggedbottom +\unexpanded\def\raggedbottom {\bottomraggednessmode\zerocount \n@rmalbottomfalse \r@ggedbottomtrue \b@selinebottomfalse \settopskip} -\def\alignbottom +\unexpanded\def\alignbottom {\bottomraggednessmode\plusone \n@rmalbottomtrue \r@ggedbottomfalse \b@selinebottomfalse \settopskip} -\def\baselinebottom +\unexpanded\def\baselinebottom {\bottomraggednessmode\plustwo \n@rmalbottomfalse \r@ggedbottomfalse \b@selinebottomtrue \settopskip} -\let\normalbottom=\alignbottom % downward compatible +\let\normalbottom\alignbottom % downward compatible % so, the new one will be % @@ -1394,10 +1443,10 @@ \fi \gridboxvbox % calculated size {\getrawnoflines{#3}% \getnoflines{#3}% - \scratchdimen#2\advance\scratchdimen \lineheight + \scratchdimen\dimexpr#2+\lineheight\relax \dorecurse\noflines {\strut - \hskip-.5\lineheight + \hskip-.5\lineheight\relax \ifcase\gridboxlinenomode\or \rlap {\hskip.2\bodyfontsize\hskip\scratchdimen @@ -1686,28 +1735,70 @@ \setvalue{\??va:#1}{#2}% \fi} +\letvalue{\??va#1:\s!unknown}\zeropoint + \unexpanded\def\vspace {\dodoubleempty\dovspace} -\def\dovspace[#1][#2]% - {\ifsecondargument - \dodovspace[#1][#2]% - \else\iffirstargument - \vspace[][#1]% - \else - \vspace[][\s!default]% - \fi\fi} +% \def\dovspace[#1][#2]% +% {\par +% \ifvmode +% \removelastskip +% \vskip +% \ifsecondargument +% \vspaceamount{#1}{#2}% +% \else\iffirstargument +% \vspaceamount\empty{#1}% +% \else +% \vspaceamount\empty\s!default +% \fi\fi +% \relax +% \fi} + +% \def\vspaceamount#1#2% +% {\csname\??va +% \ifcsname\??va#1:#2\endcsname +% #1:#2% +% \else\ifcsname\??va:#2\endcsname +% :#2% +% \else +% :\s!unknown +% \fi\fi +% \endcsname} + +% alternative -\def\dodovspace[#1][#2]% +\def\dovspace[#1][#2]% {\par \ifvmode \removelastskip - \vskip\vspaceamount{#1}{#2}\relax + \vskip + \csname\??va + \ifsecondargument + \ifcsname\??va#1:#2\endcsname + #1:#2% + \else\ifcsname\??va:#2\endcsname + :#2% + \else + :\s!unknown + \fi\fi + \else\iffirstargument + \ifcsname\??va:#1\endcsname + :#1% + \else + :\s!unknown + \fi + \else + \ifcsname\??va:\s!default\endcsname + :\s!default% + \else + :\s!unknown + \fi + \fi\fi + \endcsname + \relax \fi} -\def\vspaceamount#1#2% - {\executeifdefined{\??va#1:#2}{\executeifdefined{\??va:#2}\zeropoint}} - %D When spacing is active we need to handle commands in %D a special way: %D @@ -1820,8 +1911,8 @@ {\endgraf\dorecurse{\iffirstargument#1\else3\fi}\crlf} \ifdefined\startlines \else - \expandafter\let\expandafter\startlines\csname\e!start\v!lines\endcsname - \expandafter\let\expandafter\stoplines \csname\e!stop \v!lines\endcsname + \expandafter\let\expandafter\startlines\csname\e!start\v!lines\endcsname + \expandafter\let\expandafter\stoplines \csname\e!stop \v!lines\endcsname \fi \protect \endinput diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex a8c4bbdea..7e2f7b240 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 69c47e279..9e33d0c09 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/strc-mar.lua b/tex/context/base/strc-mar.lua index 50c3562e0..45a6be4e7 100644 --- a/tex/context/base/strc-mar.lua +++ b/tex/context/base/strc-mar.lua @@ -514,7 +514,13 @@ methods[v_bottom_nocheck] = function(name,range) return doresolve(name,range,t methods[v_next_nocheck] = function(name,range) return doresolve(name,range,true , 0,1,false) end local function do_first(name,range,check) + if trace_marks_get then + report_marks("resolve: name=%s, range=%s, resolve first",name,range) + end local f_value, f_index, f_found = doresolve(name,range,false,0,0,check) + if trace_marks_get then + report_marks("resolve: name=%s, range=%s, resolve last",name,range) + end local l_value, l_index, l_found = doresolve(name,range,true ,0,0,check) if f_found and l_found and l_index > f_index then local name = parentname(name) @@ -522,15 +528,27 @@ local function do_first(name,range,check) local si = stack[i] local sn = si[name] if sn and sn ~= false and sn ~= true and sn ~= "" and sn ~= f_value then + if trace_marks_get then + report_marks("resolve: name=%s, range=%s, index=%s, value=%s",name,range,i,sn) + end return sn, i, si end end end + if trace_marks_get then + report_marks("resolve: name=%s, range=%s, using first",name,range) + end return f_value, f_index, f_found end local function do_last(name,range,check) + if trace_marks_get then + report_marks("resolve: name=%s, range=%s, resolve first",name,range) + end local f_value, f_index, f_found = doresolve(name,range,false,0,0,check) + if trace_marks_get then + report_marks("resolve: name=%s, range=%s, resolve last",name,range) + end local l_value, l_index, l_found = doresolve(name,range,true ,0,0,check) if f_found and l_found and l_index > f_index then local name = parentname(name) @@ -538,10 +556,16 @@ local function do_last(name,range,check) local si = stack[i] local sn = si[name] if sn and sn ~= false and sn ~= true and sn ~= "" and sn ~= l_value then + if trace_marks_get then + report_marks("resolve: name=%s, range=%s, index=%s, value=%s",name,range,i,sn) + end return sn, i, si end end end + if trace_marks_get then + report_marks("resolve: name=%s, range=%s, using last",name,range) + end return l_value, l_index, l_found end diff --git a/tex/context/base/supp-box.mkiv b/tex/context/base/supp-box.mkiv index 55a0a10b0..97c93c7bf 100644 --- a/tex/context/base/supp-box.mkiv +++ b/tex/context/base/supp-box.mkiv @@ -19,6 +19,18 @@ % This file is partially cleaned up. +%D \macros +%D {dontcomplain} +%D +%D The next macro suppresses over- and underfull messages which +%D often makes sense when we deal with boxes. + +\unexpanded\def\dontcomplain + {\hbadness\plustenthousand + \vbadness\plustenthousand + \hfuzz \maxdimen + \vfuzz \maxdimen} + %D This module implements some box manipulation macros. Some %D are quite simple, some are more advanced and when understood %D well, all can be of use. diff --git a/tex/context/base/supp-fun.mkiv b/tex/context/base/supp-fun.mkiv index c3aa8329c..33bee0306 100644 --- a/tex/context/base/supp-fun.mkiv +++ b/tex/context/base/supp-fun.mkiv @@ -549,7 +549,7 @@ \else \dimen0\bodyfontsize \fi - \expanded{\egroup\def\noexpand#2{\definedfont[#5 at \the\dimen0]}}} + \normalexpanded{\egroup\def\noexpand#2{\definedfont[#5 at \the\dimen0]}}} %D Afterwards, we have access to the calculated size by: diff --git a/tex/context/base/supp-vis.mkiv b/tex/context/base/supp-vis.mkiv index 18f6262d2..37a92f24b 100644 --- a/tex/context/base/supp-vis.mkiv +++ b/tex/context/base/supp-vis.mkiv @@ -11,7 +11,8 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -% no longer generic, who cares ... +%D This module is no longer generic \unknown\ but who cares. Maybe +%D the code will be moved out of the core (apart from ruled boxes). %D \gdef\ShowBufferedExample% private typeseting macro %D {\startlinecorrection @@ -55,9 +56,10 @@ %D attention. Most of those macros can be found in \type %D {core-vis} and other core modules. Their integration in %D \CONTEXT\ prohibits generic applications. - -\ifx \undefined \writestatus \input supp-mis.tex \fi - +%D +%D We no longer assume usage outside context so we no longer +%D load support modules. +%D %D One of the strong points of \TEX\ is abstraction of textual %D input. When macros are defined well and do what we %D want them to do, we will seldom need the tools present in @@ -93,7 +95,7 @@ %D unwanted results. We can therefore turn all those things %D off with \type{\dontinterfere}. -\def\dontinterfere +\unexpanded\def\dontinterfere % or maybe just forgetall {\everypar \emptytoks \let\par \endgraf \parindent\zeropoint @@ -109,14 +111,15 @@ %D don't want to be confronted with to many over- and underfull %D messages we introduce \type{\dontcomplain}. -\def\dontcomplain - {\hbadness\!!tenthousand \vbadness\hbadness - \hfuzz \maxdimen \vfuzz \hfuzz} +\ifdefined\dontcomplain \else -% This obsolete dutch name is sometimes uses in manual styles; when -% cleaning up the codebase I decided to move this definition here. + \unexpanded\def\dontcomplain + {\hbadness\plustenthousand + \vbadness\plustenthousand + \hfuzz \maxdimen + \vfuzz \maxdimen} -\let\mindermeldingen\dontcomplain +\fi %D \macros %D {normaloffinterlineskip} @@ -124,8 +127,8 @@ %D The next hack is needed because in \CONTEXT\ we redefine %D \type{\offinterlineskip}. -\ifx\undefined\normaloffinterlineskip - \let\normaloffinterlineskip\offinterlineskip +\ifdefined\normaloffinterlineskip \else + \let\normaloffinterlineskip\offinterlineskip \fi %D \macros @@ -138,8 +141,6 @@ %D baseline behavior. Especially \type{\vtop}'s need our %D special attention. -% already saved - %D \macros %D {normalhskip, %D normalvskip} @@ -147,8 +148,6 @@ %D Next come the flexible skips, which come in two flavors %D too. Like boxes these are handled with \TEX\ primitives. -% already saved - %D \macros %D {normalpenalty, %D normalkern} @@ -157,8 +156,6 @@ %D primitives. This means that when making them visible, we %D have to take the current mode into account. -% already saved - %D \macros %D {normalhglue, %D normalvglue} @@ -167,8 +164,8 @@ %D As we will see, their definitions make the implementation of %D their visible counterparts a bit more \TeX{}nical. -\let\normalhglue = \hglue -\let\normalvglue = \vglue +\let\normalhglue\hglue +\let\normalvglue\vglue %D \macros %D {normalmkern, @@ -180,8 +177,6 @@ %D with other dimensions. As a result, the visual appearance %D of these primitives is kept primitive too. -% already saved - %D \macros %D {hfilneg, %D vfilneg} @@ -191,12 +186,12 @@ %D offers \type{\hfilneg} and \type{\vfilneg}, we define our %D own alternative double \type{ll}'ed ones. -\def\hfilneg {\normalhskip\zeropoint \!!plus-1fil\relax} -\def\vfilneg {\normalvskip\zeropoint \!!plus-1fil\relax} -\def\hfillneg {\normalhskip\zeropoint \!!plus-1fill\relax} -\def\vfillneg {\normalvskip\zeropoint \!!plus-1fill\relax} -\def\hfilllneg{\normalhskip\zeropoint \!!plus-1filll\relax} -\def\vfilllneg{\normalvskip\zeropoint \!!plus-1filll\relax} +\def\hfilneg {\normalhskip\zeropoint\!!plus-1fil\relax} +\def\vfilneg {\normalvskip\zeropoint\!!plus-1fil\relax} +\def\hfillneg {\normalhskip\zeropoint\!!plus-1fill\relax} +\def\vfillneg {\normalvskip\zeropoint\!!plus-1fill\relax} +\def\hfilllneg{\normalhskip\zeropoint\!!plus-1filll\relax} +\def\vfilllneg{\normalvskip\zeropoint\!!plus-1filll\relax} %D \macros %D {normalhss,normalhfil,normalhfill, @@ -216,21 +211,21 @@ %D in standard \TEX\ documentation. They can nevertheless be %D used at will. -\let\normalhfillneg = \hfillneg -\let\normalvfillneg = \vfillneg +\let\normalhfillneg\hfillneg +\let\normalvfillneg\vfillneg %D Visualization is not always wanted. Instead of turning this %D option off in those (unpredictable) situations, we just %D redefine a few \PLAIN\ macros. -\ifx\tlap\undefined - - \def\rlap#1{\normalhbox to \zeropoint{#1\normalhss}} - \def\llap#1{\normalhbox to \zeropoint{\normalhss#1}} - \def\blap#1{\normalvbox to \zeropoint{#1\normalvss}} - \def\tlap#1{\normalvbox to \zeropoint{\normalvss#1}} - -\fi +% \ifx\tlap\undefined +% +% \def\rlap#1{\normalhbox to \zeropoint{#1\normalhss}} +% \def\llap#1{\normalhbox to \zeropoint{\normalhss#1}} +% \def\blap#1{\normalvbox to \zeropoint{#1\normalvss}} +% \def\tlap#1{\normalvbox to \zeropoint{\normalvss#1}} +% +% \fi %D \macros %D {makeruledbox} @@ -259,8 +254,8 @@ %D At the cost of some overhead these alternatives are %D implemented using \type{\if}'s: -\newif\ifbaselinerule \baselineruletrue -\newif\ifbaselinefill \baselinefillfalse +\newif\ifbaselinerule\baselineruletrue +\newif\ifbaselinefill\baselinefillfalse %D \macros %D {iftoprule,ifbottomrule,ifleftrule,ifrightrule} @@ -276,10 +271,10 @@ %D %D As we see below: -\newif\iftoprule \topruletrue -\newif\ifbottomrule \bottomruletrue -\newif\ifleftrule \leftruletrue -\newif\ifrightrule \rightruletrue +\newif\iftoprule \topruletrue +\newif\ifbottomrule\bottomruletrue +\newif\ifleftrule \leftruletrue +\newif\ifrightrule \rightruletrue %D \macros %D {boxrulewidth} @@ -291,12 +286,14 @@ %D \starttyping %D \boxrulewidth=.2pt %D \stoptyping -%D -%D Although we are already low on \DIMENSIONS\ it's best to -%D spend one here, mainly because it enables easy manipulation, -%D like multiplication by a given factor. -\newdimen\boxrulewidth \boxrulewidth=.2pt +\newdimen \boxrulewidth \boxrulewidth=.2pt + +\newdimen \boxruleht +\newdimen \boxruledp +\newdimen \boxrulewd + +\newbox \boxrulescratchbox %D The core macro \type{\makeruledbox} looks a bit hefty. The %D manipulation at the end is needed because we want to @@ -316,32 +313,28 @@ %D primitive too. By storing and restoring the height and depth %D of box \type{#1}, we preserve the mode. -\let\dowithruledbox\relax +\let\dowithruledbox\relax % hook -\let\ruledheight\!!zeropoint -\let\ruleddepth \!!zeropoint -\let\ruledwidth \!!zeropoint - -\def\makeruledbox#1% - {\edef\ruledheight{\the\ht#1}% - \edef\ruleddepth {\the\dp#1}% - \edef\ruledwidth {\the\wd#1}% - \setbox\scratchbox\normalvbox +\unexpanded\def\makeruledbox#1% + {\boxruleht\ht#1% + \boxruledp\dp#1% + \boxrulewd\wd#1% + \setbox\boxrulescratchbox\normalvbox {\dontcomplain \normaloffinterlineskip \visualhrule \!!height\boxrulewidth \iftoprule\else\!!width\zeropoint\fi \normalvskip-\boxrulewidth - \normalhbox to \ruledwidth + \normalhbox to \boxrulewd {\visualvrule - \!!height\ruledheight - \!!depth\ruleddepth - \!!width\ifleftrule\else0\fi\boxrulewidth - \ifdim\ruledheight>\zeropoint \else \baselinerulefalse \fi - \ifdim\ruleddepth>\zeropoint \else \baselinerulefalse \fi + \!!height\boxruleht + \!!depth \boxruledp + \!!width \ifleftrule\boxrulewidth\else\zeropoint\fi + \ifdim\boxruleht>\zeropoint \else \baselinerulefalse \fi + \ifdim\boxruledp>\zeropoint \else \baselinerulefalse \fi \ifbaselinerule - \ifdim\ruledwidth<20\boxrulewidth + \ifdim\boxrulewd<20\boxrulewidth \baselinefilltrue \fi \cleaders @@ -359,7 +352,7 @@ \fi \normalhfill \visualvrule - \!!width\ifrightrule\else0\fi\boxrulewidth}% + \!!width\ifrightrule\boxrulewidth\else\zeropoint\fi}% \normalvskip-\boxrulewidth \visualhrule \!!height\boxrulewidth @@ -368,10 +361,10 @@ \setbox#1=\ifhbox#1\normalhbox\else\normalvbox\fi {\normalhbox {\box#1% - \lower\ruleddepth\normalhbox{\dowithruledbox{\box\scratchbox}}}}% - \ht#1=\ruledheight - \wd#1=\ruledwidth - \dp#1=\ruleddepth} + \lower\boxruledp\normalhbox{\dowithruledbox{\box\boxrulescratchbox}}}}% + \ht#1\boxruleht + \wd#1\boxrulewd + \dp#1\boxruledp} %D Just in case one didn't notice: the rules are in fact layed %D over the box. This way the contents of a box cannot @@ -405,8 +398,12 @@ \unexpanded\def\ruledhbox {\normalhbox\bgroup - \dowithnextbox{\makeruledbox\nextbox\box\nextbox\egroup}% - \normalhbox} + \dowithnextboxcs\ruledhbox_finish\normalhbox} + +\def\ruledhbox_finish + {\makeruledbox\nextbox + \box\nextbox + \egroup} %D \startbuffer %D \vbox @@ -423,8 +420,12 @@ \unexpanded\def\ruledvbox {\normalvbox\bgroup - \dowithnextbox{\makeruledbox\nextbox\box\nextbox\egroup}% - \normalvbox} + \dowithnextboxcs\ruledvbox_finish\normalvbox} + +\def\ruledvbox_finish + {\makeruledbox\nextbox + \box\nextbox + \egroup} %D \startbuffer %D \vtop @@ -441,8 +442,12 @@ \unexpanded\def\ruledvtop {\normalvtop\bgroup - \dowithnextbox{\makeruledbox\nextbox\box\nextbox\egroup}% - \normalvtop} + \dowithnextboxcs\ruledvtop_finish\normalvtop} + +\def\ruledvtop_finish + {\makeruledbox\nextbox + \box\nextbox + \egroup} %D \startbuffer %D \hbox @@ -459,14 +464,16 @@ \unexpanded\def\ruledvcenter {\normalvbox\bgroup \dontinterfere - \dowithnextbox - {\scratchdimen.5\ht\nextbox - \advance\scratchdimen .5\dp\nextbox - \ht\nextbox\scratchdimen - \dp\nextbox\scratchdimen - \ruledhbox{\box\nextbox}% - \egroup}% - \normalvbox} + \dowithnextboxcs\ruledvcenter_finish\normalvbox} + +\def\ruledvcenter_finish + {\scratchdimen.5\dimexpr\ht\nextbox+\dp\nextbox\relax + \ht\nextbox\scratchdimen + \dp\nextbox\scratchdimen + %\ruledhbox{\box\nextbox}% + \makeruledbox\nextbox + \box\nextbox + \egroup} %D \macros %D {ruledbox, @@ -492,10 +499,23 @@ %D variant that does not need the~\type{=}, but we stick to: \unexpanded\def\ruledbox - {\dowithnextbox{\makeruledbox\nextbox\box\nextbox}} + {\dowithnextboxcs\ruledbox_finish} + +\def\ruledbox_finish + {\makeruledbox\nextbox\box\nextbox} + +% \def\setruledbox#1=% +% {\dowithnextbox{\makeruledbox\nextbox\setbox#1\nextbox}} -\def\setruledbox#1=% - {\dowithnextbox{\makeruledbox\nextbox\setbox#1\nextbox}} +\def\setruledbox#1=% not nice, better + {\afterassignment\setruledbox_indeed\scratchcounter} + +\def\setruledbox_indeed + {\dowithnextboxcs\setruledbox_finish} + +\def\setruledbox_finish + {\makeruledbox\nextbox + \setbox\scratchcounter\nextbox} %D \macros %D {investigateskip, @@ -526,7 +546,8 @@ %D Users of these macros are invited to study their exact %D behavior first. The positive and negative states both %D include zero and are in fact non-negative ($\geq0$) and -%D non-positive ($\leq0$) . +%D non-positive ($\leq0$). Well, no dirty trick is needed +%D any longer as we have \ETEX\ functionality. \newif\ifflexible \newif\ifzero @@ -535,10 +556,19 @@ \def\investigateskip#1% {\relax - \scratchdimen#1\relax - \edef\!!stringa{\the\scratchdimen}% - \edef\!!stringb{\the#1}% - \ifx\!!stringa\!!stringb \flexiblefalse \else \flexibletrue \fi + \ifdim#1=\zeropoint + \ifdim\gluestretch#1=\zeropoint + \ifdim\glueshrink#1=\zeropoint + \flexiblefalse + \else + \flexibletrue + \fi + \else + \flexibletrue + \fi + \else + \flexibletrue + \fi \ifdim#1=\zeropoint\relax \zerotrue \else \zerofalse \fi @@ -549,33 +579,6 @@ \negativefalse \else \negativetrue \fi} -% etex -% -% \def\investigateskip#1% -% {\relax -% \ifdim\scratchskip=\zeropoint -% \ifdim\gluestretch\scratchskip=\zeropoint -% \ifdim\glueshrink\scratchskip=\zeropoint -% \flexiblefalse -% \else -% \flexibletrue -% \fi -% \else -% \flexibletrue -% \fi -% \else -% \flexibletrue -% \fi -% \ifdim#1=\zeropoint\relax -% \zerotrue \else -% \zerofalse \fi -% \ifdim#1<\zeropoint\relax -% \positivefalse \else -% \positivetrue \fi -% \ifdim#1>\zeropoint\relax -% \negativefalse \else -% \negativetrue \fi} - \def\investigatecount#1% {\relax \flexiblefalse @@ -589,9 +592,9 @@ \negativefalse \else \negativetrue \fi} -\def\investigatemuskip#1% +\def\investigatemuskip#1% etex ? {\relax - \edef\!!stringa{\the\scratchmuskip}% + \edef\!!stringa{\the#1}% \edef\!!stringb{0mu}% \def\!!stringc##1##2\\{##1}% \expandafter\edef\expandafter\!!stringc\expandafter @@ -612,7 +615,7 @@ \negativefalse \fi \fi} - + %D Now the neccessary utility macros are defined, we can make a %D start with the visualizing ones. The implementation of these %D macros is a compromise between readability, efficiency of @@ -807,20 +810,11 @@ %D All five substitutions use the same auxiliary macro. Watch %D the positive first -- negative next approach. -\unexpanded\def\ruledhss - {\doruledhfiller\normalhss\normalhfilneg{0}{0}} - -\unexpanded\def\ruledhfil - {\doruledhfiller\normalhfil\normalhfilneg{10}{-6}} - -\unexpanded\def\ruledhfill - {\doruledhfiller\normalhfill\normalhfillneg{18}{-14}} - -\unexpanded\def\ruledhfilneg - {\doruledhfiller\normalhfilneg\normalhfil{-6}{10}} - -\unexpanded\def\ruledhfillneg - {\doruledhfiller\normalhfillneg\normalhfill{-14}{18}} +\unexpanded\def\ruledhss {\doruledhfiller\normalhss \normalhfilneg {0}{0}} +\unexpanded\def\ruledhfil {\doruledhfiller\normalhfil \normalhfilneg {10}{-6}} +\unexpanded\def\ruledhfill {\doruledhfiller\normalhfill \normalhfillneg{18}{-14}} +\unexpanded\def\ruledhfilneg {\doruledhfiller\normalhfilneg \normalhfil {-6}{10}} +\unexpanded\def\ruledhfillneg{\doruledhfiller\normalhfillneg\normalhfill {-14}{18}} %D \macros %D {ruledvss, @@ -937,7 +931,7 @@ %D stretch could be drawing the mid line over a length of the %D stretch, in positive or negative direction. -\def\doruledhskip +\def\ruledhskip_indeed {\relax \dontinterfere \dontcomplain @@ -995,7 +989,7 @@ \divide\skip2 2 \advance\scratchskip -\skip2 \normalhskip\scratchskip - \normalpenalty\!!tenthousand + \normalpenalty\plustenthousand \box0 \normalhskip\skip2 \else @@ -1006,7 +1000,7 @@ \unexpanded\def\ruledhskip {\bgroup - \afterassignment\doruledhskip + \afterassignment\ruledhskip_indeed \scratchskip=} %D The visual skip is located at a feasible point. Normally @@ -1135,7 +1129,7 @@ \normalvskip\skip2 \fi \fi - \normalpenalty\!!tenthousand + \normalpenalty\plustenthousand \box0 \prevdepth\nextdepth % not \dp0=\nextdepth \normalvskip\scratchskip} @@ -1158,7 +1152,7 @@ {\bgroup \afterassignment\doruledvskip \scratchskip=} - + %D \macros %D {ruledkern} %D @@ -1189,7 +1183,7 @@ %D visualized a bit different, because we want to see them %D anyhow. -\def\doruledhkern +\def\ruledhkern_indeed {\dontinterfere \dontcomplain \baselinerulefalse @@ -1226,7 +1220,7 @@ \setbox0\ruledhbox{\box0}% \make... \fi \smashbox0% - \normalpenalty\!!tenthousand + \normalpenalty\plustenthousand \normalhbox to \zeropoint {\ifnegative\normalhskip1\scratchskip\fi \box0}% @@ -1236,7 +1230,7 @@ \unexpanded\def\ruledhkern#1% {\bgroup \let\afterwards#1% - \afterassignment\doruledhkern + \afterassignment\ruledhkern_indeed \scratchskip=} %D After having seen the horizontal ones, the vertical kerns @@ -1263,7 +1257,7 @@ %D Like before, we have to postpone \type{\prevdepth}. If we %D leave out this trick, we got ourselves some wrong spacing. -\def\dodoruledvkern +\def\ruledvkern_finish {\nextdepth\prevdepth \dontinterfere \dontcomplain @@ -1307,17 +1301,17 @@ \normalvcue {\ifnegative\normalhskip-16\testrulewidth\fi\box0}}% \smashbox0% - \normalpenalty\!!tenthousand + \normalpenalty\plustenthousand \box0 \prevdepth\nextdepth} % not \dp0=\nextdepth -\def\doruledvkern +\def\ruledvkern_indeed {\ifdim\pagegoal=\maxdimen \ifinner - \dodoruledvkern + \ruledvkern_finish \fi \else - \dodoruledvkern + \ruledvkern_finish \fi \afterwards\scratchskip \egroup} @@ -1325,7 +1319,7 @@ \unexpanded\def\ruledvkern#1% {\bgroup \let\afterwards#1\relax - \afterassignment\doruledvkern + \afterassignment\ruledvkern_indeed \scratchskip=} \unexpanded\def\ruledkern @@ -1342,7 +1336,7 @@ %D \unexpanded\def\ruledkern% %D {\csname ruled\ifvmode v\else h\fi kern\endcsname\normalkern} %D \stoptyping - + %D \macros %D {ruledhglue,ruledvglue} %D @@ -1366,18 +1360,18 @@ %D %D \ShowBufferedExample -\def\doruledhglue +\def\ruledhglue_indeed {\leavevmode \scratchcounter\spacefactor \visualvrule\!!width\zeropoint - \normalpenalty\!!tenthousand + \normalpenalty\plustenthousand \ruledhkern\normalhskip\scratchskip \spacefactor\scratchcounter \egroup} \unexpanded\def\ruledhglue {\bgroup - \afterassignment\doruledhglue\scratchskip=} + \afterassignment\ruledhglue_indeed\scratchskip=} %D \startbuffer %D first line @@ -1396,18 +1390,18 @@ %D %D \ShowBufferedExample -\def\doruledvglue +\def\ruledvglue_indeed {\endgraf % \par \nextdepth\prevdepth \visualhrule\!!height\zeropoint - \normalpenalty\!!tenthousand + \normalpenalty\plustenthousand \ruledvkern\normalvskip\scratchskip \prevdepth\nextdepth \egroup} \unexpanded\def\ruledvglue {\bgroup - \afterassignment\doruledvglue\scratchskip=} + \afterassignment\ruledvglue_indeed\scratchskip=} %D \macros %D {ruledmkern,ruledmskip} @@ -1418,40 +1412,40 @@ %D subtle matter, we've used a very simple, not overloaded way %D to show them. -\def\dodoruledmkern#1% +\def\ruledmkern_finish#1% {\dontinterfere \dontcomplain - \setbox0\normalhbox - {$\normalmkern\ifnegative-\fi\scratchmuskip$}% - \setbox0\normalhbox to \wd0 + \setbox\boxrulescratchbox\normalhbox + {$\normalmkern\ifnegative-\fi\scratchskip$}% + \setbox\boxrulescratchbox\normalhbox to \wd\boxrulescratchbox {\visualvrule \!!height16\testrulewidth - \!!depth16\testrulewidth - \!!width\testrulewidth + \!!depth 16\testrulewidth + \!!width \testrulewidth \leaders \visualhrule - \!!height\ifpositive16\else-14\fi\testrulewidth - \!!depth\ifpositive-14\else16\fi\testrulewidth + \!!height\ifpositive 16\else-14\fi\testrulewidth + \!!depth \ifpositive-14\else 16\fi\testrulewidth \normalhfill \ifflexible - \normalhskip-\wd0 + \normalhskip-\wd\boxrulescratchbox \leaders \visualhrule \!!height\testrulewidth - \!!depth\testrulewidth + \!!depth \testrulewidth \normalhfill \fi \visualvrule \!!height16\testrulewidth - \!!depth16\testrulewidth - \!!width\testrulewidth}% + \!!depth 16\testrulewidth + \!!width \testrulewidth}% \smashbox0% \ifnegative - #1\scratchmuskip - \box0 + #1\scratchskip + \box\boxrulescratchbox \else - \box0 - #1\scratchmuskip + \box\boxrulescratchbox + #1\scratchskip \fi \egroup} @@ -1464,14 +1458,15 @@ %D %D \ShowBufferedExample -\def\doruledmkern - {\investigatemuskip\scratchmuskip - \flexiblefalse - \dodoruledmkern\normalmkern} - \unexpanded\def\ruledmkern {\bgroup - \afterassignment\doruledmkern\scratchmuskip=} + \afterassignment\ruledmkern_indeed + \scratchmuskip=} + +\def\ruledmkern_indeed + {\investigatemuskip\scratchmuskip + \flexiblefalse + \ruledmkern_finish\normalmkern} %D \startbuffer %D $a \mskip3mu = \mskip3mu @@ -1482,15 +1477,16 @@ %D %D \ShowBufferedExample -\def\doruledmskip +\def\ruledmskip_indeed {\investigatemuskip\scratchmuskip \flexibletrue - \dodoruledmkern\normalmskip} + \ruledmkern_finish\normalmskip} \unexpanded\def\ruledmskip {\bgroup - \afterassignment\doruledmskip\scratchmuskip=} - + \afterassignment\ruledmskip_indeed + \scratchmuskip=} + %D \macros %D {penalty} %D @@ -1559,43 +1555,43 @@ %D test \ruledhpenalty1000 \ruledhpenalty-1000 %D test -\def\setruledpenaltybox#1#2#3#4#5#6% +\def\ruled_penalty_box#1#2#3#4#5#6% {\setbox#1\normalhbox - {\ifnum#2=0 \else - \edef\sign - {\ifnum#2>0 +\else-\fi}% - \dimen0=\ifnum\sign#2>9999 - 28\else - \ifnum\sign#2>999 - 22\else - \ifnum\sign#2>99 - 16\else - \ifnum\sign#2>9 - 10\else - 4 - \fi\fi\fi\fi \testrulewidth - \ifnum#2<0 - \normalhskip-\dimen0 + {\ifnum#2=\zerocount \else + \edef\sign{\ifnum#2>\zerocount +\else-\fi}% + \scratchdimen + \ifnum\sign#2>9999 28\else + \ifnum\sign#2>999 22\else + \ifnum\sign#2>99 16\else + \ifnum\sign#2>9 10\else + 4\fi\fi\fi\fi \testrulewidth + \ifnum#2<\zerocount + \normalhskip-\scratchdimen \normalhskip-2\testrulewidth \visualvrule - \!!width2\testrulewidth + \!!width 2\testrulewidth \!!height#3\testrulewidth - \!!depth#4\testrulewidth + \!!depth #4\testrulewidth \fi \visualvrule - \!!width\dimen0 + \!!width \scratchdimen \!!height#5\testrulewidth - \!!depth#6\testrulewidth - \ifnum#2>0 + \!!depth #6\testrulewidth + \ifnum#2>\zerocount \visualvrule - \!!width2\testrulewidth + \!!width 2\testrulewidth \!!height#3\testrulewidth - \!!depth#4\testrulewidth + \!!depth #4\testrulewidth \fi \fi}% \smashbox#1} -\def\doruledhpenalty +\unexpanded\def\ruledhpenalty + {\bgroup + \afterassignment\ruledhpenalty_indeed + \scratchcounter=} + +\def\ruledhpenalty_indeed {\dontinterfere \dontcomplain \investigatecount\scratchcounter @@ -1605,10 +1601,10 @@ {\ifnegative\else\normalhss\fi \visualvrule \!!depth8\testrulewidth - \!!width\ifzero0\else4\fi\testrulewidth + \!!width\ifzero\zeropoint\else4\testrulewidth\fi \ifpositive\else\normalhss\fi}% - \setruledpenaltybox{2}{\scratchcounter}{0}{8}{-3.5}{4.5}% - \normalpenalty\!!tenthousand + \ruled_penalty_box{2}{\scratchcounter}{0}{8}{-3.5}{4.5}% + \normalpenalty\plustenthousand \setbox0\normalhbox {\normalhskip-4\testrulewidth \ifnegative @@ -1621,11 +1617,6 @@ \normalpenalty\scratchcounter \egroup} -\unexpanded\def\ruledhpenalty - {\bgroup - \afterassignment\doruledhpenalty - \scratchcounter=} - %D The size of a vertical penalty is also shown on the %D horizontal axis. This way there is less interference with %D the often preceding or following skips and kerns. @@ -1645,9 +1636,13 @@ %D %D \ShowBufferedExample -\def\doruledvpenalty - {\ifdim\pagegoal=\maxdimen - \else +\unexpanded\def\ruledvpenalty + {\bgroup + \afterassignment\ruledvpenalty_indeed + \scratchcounter=} + +\def\ruledvpenalty_indeed + {\ifdim\pagegoal=\maxdimen \else \nextdepth\prevdepth \dontinterfere \dontcomplain @@ -1657,13 +1652,13 @@ \setbox0\ruledhbox {\visualvrule \!!height4\testrulewidth - \!!depth4\testrulewidth - \!!width\zeropoint + \!!depth 4\testrulewidth + \!!width \zeropoint \visualvrule \!!height\ifnegative.5\else4\fi\testrulewidth - \!!depth\ifpositive.5\else4\fi\testrulewidth - \!!width8\testrulewidth}% - \setruledpenaltybox{2}{\scratchcounter}{4}{4}{.5}{.5}% + \!!dept \ifpositive.5\else4\fi\testrulewidth + \!!width 8\testrulewidth}% + \ruled_penalty_box{2}{\scratchcounter}{4}{4}{.5}{.5}% \setbox0\normalhbox {\normalhskip-4\testrulewidth \ifnegative @@ -1673,7 +1668,7 @@ \fi \normalhss}% \smashbox0% - \normalpenalty\!!tenthousand + \normalpenalty\plustenthousand \nointerlineskip \dp0\nextdepth % not \prevdepth=\nextdepth \normalvbox @@ -1682,10 +1677,7 @@ \normalpenalty\scratchcounter \egroup} -\unexpanded\def\ruledvpenalty - {\bgroup - \afterassignment\doruledvpenalty - \scratchcounter=} +%D This comes together in: \unexpanded\def\ruledpenalty {\ifvmode @@ -1694,14 +1686,6 @@ \expandafter\ruledhpenalty \fi} -%D At the cost of some more tokens, a bit more clever -%D implementation would be: -%D -%D \starttyping -%D \unexpanded\def\ruledpenalty% -%D {\csname ruled\ifvmode v\else h\fi penalty\endcsname} -%D \stoptyping - %D \macros %D {showfils,dontshowfils, %D showboxes,dontshowboxes, @@ -1713,7 +1697,7 @@ \newif\ifshowingcomposition % see later why we need this -\def\showfils +\unexpanded\def\showfils {\showingcompositiontrue \let\hss \ruledhss \let\hfil \ruledhfil @@ -1726,7 +1710,7 @@ \let\vfilneg \ruledvfilneg \let\vfillneg \ruledvfillneg} -\def\dontshowfils +\unexpanded\def\dontshowfils {\let\hss \normalhss \let\hfil \normalhfil \let\hfill \normalhfill @@ -1738,7 +1722,7 @@ \let\vfilneg \normalvfilneg \let\vfillneg \normalvfillneg} -\def\showboxes +\unexpanded\def\showboxes {\showingcompositiontrue \baselineruletrue \let\hbox \ruledhbox @@ -1746,13 +1730,13 @@ \let\vtop \ruledvtop \let\vcenter \ruledvcenter} -\def\dontshowboxes +\unexpanded\def\dontshowboxes {\let\hbox \normalhbox \let\vbox \normalvbox \let\vtop \normalvtop \let\vcenter \normalvcenter} -\def\showskips +\unexpanded\def\showskips {\showingcompositiontrue \let\hskip \ruledhskip \let\vskip \ruledvskip @@ -1762,7 +1746,7 @@ \let\hglue \ruledhglue \let\vglue \ruledvglue} -\def\dontshowskips +\unexpanded\def\dontshowskips {\let\hskip \normalhskip \let\vskip \normalvskip \let\kern \normalkern @@ -1771,11 +1755,11 @@ \let\hglue \normalhglue \let\vglue \normalvglue} -\def\showpenalties +\unexpanded\def\showpenalties {\showingcompositiontrue \let\penalty \ruledpenalty} -\def\dontshowpenalties +\unexpanded\def\dontshowpenalties {\let\penalty \normalpenalty} %D \macros @@ -1802,7 +1786,7 @@ \newif\ifshowingcomposition -\def\showcomposition +\unexpanded\def\showcomposition {\ifshowingcomposition \showfils \showboxes @@ -1810,7 +1794,7 @@ \showpenalties \fi} -\def\dontshowcomposition +\unexpanded\def\dontshowcomposition {\ifshowingcomposition \dontshowfils \dontshowboxes @@ -1839,12 +1823,12 @@ %D Beware, it's a macro not a \DIMENSION. \ifx\bodyfontsize\undefined - \edef\defaulttestrulewidth{\the\testrulewidth} + \edef\defaulttestrulewidth{\the\testrulewidth} \else - \def\defaulttestrulewidth{.02\bodyfontsize} + \def\defaulttestrulewidth{.02\bodyfontsize} \fi -\def\showmakeup +\unexpanded\def\showmakeup {\testrulewidth\defaulttestrulewidth \showingcompositiontrue \showcomposition} diff --git a/tex/context/base/syst-aux.mkiv b/tex/context/base/syst-aux.mkiv index 598813275..8b8c272a3 100644 --- a/tex/context/base/syst-aux.mkiv +++ b/tex/context/base/syst-aux.mkiv @@ -107,10 +107,10 @@ \def\!!plustwo {2} % alongside \plustwo \def\!!plusthree {3} % alongside \plusthree -\setnewconstant\uprotationangle 0 -\setnewconstant\rightrotatioangle 90 -\setnewconstant\downrotatioangle 180 -\setnewconstant\leftrotatioangle 270 +\setnewconstant \uprotationangle 0 +\setnewconstant\rightrotationangle 90 +\setnewconstant \downrotationangle 180 +\setnewconstant \leftrotationangle 270 \ifdefined\data \else \let\data \relax \fi % dep checker diff --git a/tex/context/base/tabl-tbl.mkiv b/tex/context/base/tabl-tbl.mkiv index a9d47903a..f79dfbf69 100644 --- a/tex/context/base/tabl-tbl.mkiv +++ b/tex/context/base/tabl-tbl.mkiv @@ -112,7 +112,8 @@ % \EQ \RQ \HQ equal (raw, hook) % \NC \RC \HC normal (raw, hook) % -% \NR +% \NR checked break +% \NB no break % % \HR : rule with lineheight % @@ -756,7 +757,7 @@ {\ifconditional\tabulatehandlepbreak \ifconditional\tabulatenopbreak \dotabulatenobreak - \else\ifnum\tabulatemaxplines>\plusone + \else\ifnum\tabulatemaxplines>\plusone \ifnum\tabulateminplines=\plusone \dotabulatenobreak \fi @@ -945,7 +946,7 @@ % expansion en test needed ? \settrue\tabulatesplit \csname\??tt:\c!split:\tabulateparameter\c!split\endcsname - \doifvaluesomething{\??tt\currenttabulate\c!bodyfont} + \doifsomething{\tabulateparameter\c!bodyfont} {\expanded{\switchtobodyfont[\tabulateparameter\c!bodyfont]}}% \postponenotes % new, to be tested / will be configurable \tabulatepass\plusone @@ -1349,7 +1350,19 @@ \unexpanded\def\tabulateCMone{\global\tabulatelocalcolorspan\plustwo \tabulatecolorcolumn\zerocount} \unexpanded\def\tabulateCRone{\global\tabulatelocalcolorspan\plusthree\tabulatecolorcolumn\zerocount} -\unexpanded\def\tabulateNRone % next row +% \unexpanded\def\tabulateNRone % next row +% {\global\advance\noftabulatelines\plusone +% \global\setfalse\tabulatefirstflushed +% \global\setfalse\tabulateequal +% \global\tabulatecolumn\zerocount +% \resettabulatepheight +% \unskip\unskip\crcr\flushtabulated +% \starttabulatenoalign +% \the\everyaftertabulaterow +% \checktabulatepenaltiesa +% \stoptabulatenoalign} + +\def\tabulateNRcommon#1% {\global\advance\noftabulatelines\plusone \global\setfalse\tabulatefirstflushed \global\setfalse\tabulateequal @@ -1358,9 +1371,15 @@ \unskip\unskip\crcr\flushtabulated \starttabulatenoalign \the\everyaftertabulaterow - \checktabulatepenaltiesa + #1% \stoptabulatenoalign} +\unexpanded\def\tabulateNRone % next row + {\tabulateNRcommon\checktabulatepenaltiesa} + +\unexpanded\def\tabulateNBone % next row no break + {\tabulateNRcommon\dotabulatenobreak} + \def\checktabulatepenaltiesa {\iftolerantTABLEbreak\else \ifnum\totalnoftabulatelines=\plusone @@ -1450,18 +1469,6 @@ % \starttabulate[||] \dorecurse{100}{\NC Eins \NC \NR \HL} \stoptabulate % \stoptext -% old crap: -% -% \ifnum\noftabulatelines>\plusone -% \ifnum\noftabulatelines<\minusnoftabulatelines -% % *** somehow topskip messes up as it's intercepted -% % \vskip \topskip\allowbreak\vskip- \topskip -% % messy anyhow so this needs to be improved, so for -% % the moment we keep this bugged variant -% \vskip1\topskip -% \allowbreak -% \vskip-1\topskip - \def\tabulateXXnone{\starttabulatenoalign\tabulateignorehrulespec\stoptabulatenoalign} \def\tabulateFLfive{\starttabulatenoalign\tabulatepickuphrulespec\dotabulateFLfive} @@ -1599,9 +1606,9 @@ {\tabulateunit\tabulateparameter\c!unit \checkfulltabulatecontent \defaulttabulatevrulethickness\tabulateparameter\c!rulethickness - \defaulttabulatehrulethickness\tabulateparameter\c!rulethickness + \defaulttabulatehrulethickness\defaulttabulatevrulethickness \edef\defaulttabulatevrulecolor{\tabulateparameter\c!rulecolor}% - \edef\defaulttabulatehrulecolor{\tabulateparameter\c!rulecolor}% + \let\defaulttabulatehrulecolor\defaulttabulatevrulecolor \edef\@@tabulatealign{\executeifdefined{\??tt:\c!align:\tabulateparameter\c!align}0}% \tabulateposskip.5\tabulateunit \tabulatepreskip\zeropoint @@ -1637,6 +1644,7 @@ \let\NN\tabulateNNone \let\ND\tabulateNDone \let\NR\tabulateNRone + \let\NB\tabulateNBone \let\CC\tabulateCCone \let\CL\tabulateCLone \let\CM\tabulateCMone @@ -1680,7 +1688,7 @@ \let\xbskip\tabulatexbskipone \let\xeskip\tabulatexeskipone \glet\tabulatehook\dotabulatehook - \doifvalue{\??tt\currenttabulate\c!indenting}\v!no\forgetparindent + \doif{\tabulateparameter\c!indenting}\v!no\forgetparindent \ifinsidefloat \let\tabulateindent\!!zeropoint \else @@ -1725,7 +1733,7 @@ \let\BL\tabulateBLfive \let\HL\tabulateHLfive \let\HR\tabulateHRfive - \doifvalue{\??tt\currenttabulate\c!rule}\v!line + \doif{\tabulateparameter\c!rule}\v!line {\let\HL\HR \let\tabulateautoline\tabulateautorule \let\tabulateline\tabulaterule}% @@ -1733,7 +1741,7 @@ % \ifcase\tabulaterepeathead \ifinsidesplitfloat - \global\setbox\tabulatebox\vbox \bgroup + \global\setbox\tabulatebox\vbox \bgroup \else \startframedcontent[\tabulateparameter\c!frame]% \fi @@ -1748,7 +1756,7 @@ \dostoptagged \dostoptagged \ifhmode\par\prevdepth\strutdp\fi % nog eens beter, temporary hack - \doifvalue{\??tt\currenttabulate\c!distance}\v!grid{\vskip-\strutdp}% experimental tm-prikkels + \doif{\tabulateparameter\c!distance}\v!grid{\vskip-\strutdp}% experimental tm-prikkels % \ifcase\tabulaterepeathead \ifinsidesplitfloat diff --git a/tex/context/base/trac-vis.mkiv b/tex/context/base/trac-vis.mkiv index f4b9583a2..64a08e22a 100644 --- a/tex/context/base/trac-vis.mkiv +++ b/tex/context/base/trac-vis.mkiv @@ -58,7 +58,7 @@ {\vrule #5 20\testrulewidth \!!width \zeropoint \normalhss}}}% \smashbox\scratchbox - \normalpenalty\!!tenthousand + \normalpenalty\plustenthousand \box\scratchbox \egroup} diff --git a/tex/context/base/typo-mar.mkiv b/tex/context/base/typo-mar.mkiv index 9bbf2a214..7702a9eaf 100644 --- a/tex/context/base/typo-mar.mkiv +++ b/tex/context/base/typo-mar.mkiv @@ -229,7 +229,7 @@ \dostoptagged \fi \ifdone - \initializenextposition % we use positions at the lua end (will become pdf.h/v) + \positions_initialize % we use positions at the lua end (will become pdf.h/v) \ctxlua{typesetters.margins.save{ location = "\margindataparameter\c!location", method = "\margindataparameter\c!method", diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index bc4c88c4b..1c8b0b763 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 : 12/19/11 22:53:48 +-- merge date : 12/20/11 22:24:50 do -- begin closure to overcome local limits and interference |