diff options
27 files changed, 331 insertions, 273 deletions
diff --git a/metapost/context/base/mp-back.mp b/metapost/context/base/mp-back.mp index 99e88554b..f49474cf7 100644 --- a/metapost/context/base/mp-back.mp +++ b/metapost/context/base/mp-back.mp @@ -1,6 +1,6 @@ %D \module %D [ file=mp-back.mp, -%D version=2000.05.31, +%D version=2000.05.31, %D title=\CONTEXT\ \METAPOST\ graphics, %D subtitle=backgrounds, %D author=Hans Hagen, @@ -8,199 +8,199 @@ %D copyright={PRAGMA / Hans Hagen \& Ton Otten}] %C %C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See licen-en.pdf for -%C details. +%C therefore copyrighted by \PRAGMA. See licen-en.pdf for +%C details. -if unknown context_tool : input mp-tool ; fi ; -if known context_back : endinput ; fi ; +if unknown context_tool : input mp-tool ; fi ; +if known context_back : endinput ; fi ; -boolean context_back ; context_back := true ; +boolean context_back ; context_back := true ; -def some_hash ( expr hash_width , - hash_height , - hash_linewidth , - hash_linecolor , - hash_angle , - hash_gap ) = +def some_hash ( expr hash_width , + hash_height , + hash_linewidth , + hash_linecolor , + hash_angle , + hash_gap ) = stripe_gap := hash_gap ; stripe_angle := hash_angle ; - drawoptions (withpen pencircle scaled hash_linewidth + drawoptions (withpen pencircle scaled hash_linewidth withcolor hash_linecolor) ; path p ; p := unitsquare xscaled hash_width yscaled hash_height ; stripe_path_a () (draw) p ; % next we move it all to quadrant 1 - currentpicture := currentpicture shifted urcorner currentpicture ; + currentpicture := currentpicture shifted urcorner currentpicture ; -enddef ; +enddef ; -def some_double_back (expr back_type , +def some_double_back (expr back_type , back_width , back_height , - back_delta , - back_linewidth , - back_linecolor , - back_fillcolor , - back_topcolor , + back_delta , + back_linewidth , + back_linecolor , + back_fillcolor , + back_topcolor , back_bottomcolor , - back_leftcolor , - back_rightcolor ) = + back_leftcolor , + back_rightcolor ) = - numeric ww ; ww := back_width ; - numeric hh ; hh := back_height ; - numeric dd ; dd := back_delta ; + numeric ww ; ww := back_width ; + numeric hh ; hh := back_height ; + numeric dd ; dd := back_delta ; - color back_nillcolor ; back_nillcolor := back_topcolor ; + color back_nillcolor ; back_nillcolor := back_topcolor ; - path p ; p := fullsquare xscaled ww yscaled hh ; - path q ; q := fullsquare xscaled (ww-2dd) yscaled (hh-2dd) ; - path r ; r := llcorner p -- - lrcorner p shifted (-3dd,0) .. controls lrcorner p .. - lrcorner p shifted (0, 3dd) -- - urcorner p shifted (0,-3dd) .. controls urcorner p .. + path p ; p := fullsquare xscaled ww yscaled hh ; + path q ; q := fullsquare xscaled (ww-2dd) yscaled (hh-2dd) ; + path r ; r := llcorner p -- + lrcorner p shifted (-3dd,0) .. controls lrcorner p .. + lrcorner p shifted (0, 3dd) -- + urcorner p shifted (0,-3dd) .. controls urcorner p .. urcorner p shifted (-3dd,0) -- ulcorner p -- cycle ; path s ; s := r xscaled ((ww-2dd)/ww) yscaled ((hh-2dd)/hh) ; - path t ; t := llcorner p -- - lrcorner p -- - urcorner p shifted (0,-3dd) .. controls urcorner p .. - urcorner p shifted (-3dd,0) -- - ulcorner p shifted ( 3dd,0) .. controls ulcorner p .. + path t ; t := llcorner p -- + lrcorner p -- + urcorner p shifted (0,-3dd) .. controls urcorner p .. + urcorner p shifted (-3dd,0) -- + ulcorner p shifted ( 3dd,0) .. controls ulcorner p .. ulcorner p shifted (0,-3dd) -- llcorner p -- cycle ; path u ; u := t xscaled ((ww-2dd)/ww) yscaled ((hh-2dd)/hh) ; - path v ; v := llcorner p shifted ( 3dd,0) -- - lrcorner p shifted (-3dd,0) .. controls lrcorner p .. - lrcorner p shifted (0, 3dd) -- - urcorner p shifted (0,-3dd) .. controls urcorner p .. + path v ; v := llcorner p shifted ( 3dd,0) -- + lrcorner p shifted (-3dd,0) .. controls lrcorner p .. + lrcorner p shifted (0, 3dd) -- + urcorner p shifted (0,-3dd) .. controls urcorner p .. urcorner p shifted (-3dd,0) -- - ulcorner p shifted ( 3dd,0) .. controls ulcorner p .. + ulcorner p shifted ( 3dd,0) .. controls ulcorner p .. ulcorner p shifted (0,-3dd) .. llcorner p shifted (0, 3dd) .. controls llcorner p .. cycle ; % {down} .. cycle ; path w ; w := t xscaled ((ww-2dd)/ww) yscaled ((hh-2dd)/hh) ; - path a ; a := llcorner p -- ulcorner p -- + path a ; a := llcorner p -- ulcorner p -- ulcorner q -- llcorner q -- cycle ; - path b ; b := llcorner p -- lrcorner p -- + path b ; b := llcorner p -- lrcorner p -- lrcorner q -- llcorner q -- cycle ; - path c ; c := lrcorner p -- urcorner p -- + path c ; c := lrcorner p -- urcorner p -- urcorner q -- lrcorner q -- cycle ; - path d ; d := ulcorner p -- urcorner p -- + path d ; d := ulcorner p -- urcorner p -- urcorner q -- ulcorner q -- cycle ; - path e ; e := llcorner p -- lrcorner p -- - urcorner p -- urcorner q -- + path e ; e := llcorner p -- lrcorner p -- + urcorner p -- urcorner q -- lrcorner q -- llcorner q -- cycle ; - path f ; f := llcorner p -- ulcorner p -- - urcorner p -- urcorner q -- + path f ; f := llcorner p -- ulcorner p -- + urcorner p -- urcorner q -- ulcorner q -- llcorner q -- cycle ; - linecap := butt ; pickup pencircle scaled back_linewidth ; + linecap := butt ; pickup pencircle scaled back_linewidth ; - if back_type=1 : + if back_type=1 : - fill p withcolor back_fillcolor ; - fill a withcolor back_leftcolor ; - fill b withcolor back_bottomcolor ; - fill c withcolor back_rightcolor ; - fill d withcolor back_topcolor ; - draw a withcolor back_linecolor ; - draw d withcolor back_linecolor ; - draw b withcolor back_linecolor ; - draw c withcolor back_linecolor ; + fill p withcolor back_fillcolor ; + fill a withcolor back_leftcolor ; + fill b withcolor back_bottomcolor ; + fill c withcolor back_rightcolor ; + fill d withcolor back_topcolor ; + draw a withcolor back_linecolor ; + draw d withcolor back_linecolor ; + draw b withcolor back_linecolor ; + draw c withcolor back_linecolor ; - elseif back_type=2 : + elseif back_type=2 : - fill p withcolor back_fillcolor ; - fill e withcolor back_bottomcolor ; - fill f withcolor back_topcolor ; - draw e withcolor back_linecolor ; - draw f withcolor back_linecolor ; + fill p withcolor back_fillcolor ; + fill e withcolor back_bottomcolor ; + fill f withcolor back_topcolor ; + draw e withcolor back_linecolor ; + draw f withcolor back_linecolor ; - elseif back_type=3 : + elseif back_type=3 : - fill v withcolor back_nillcolor ; - fill w withcolor back_fillcolor ; - draw v withcolor back_linecolor ; - draw w withcolor back_linecolor ; + fill v withcolor back_nillcolor ; + fill w withcolor back_fillcolor ; + draw v withcolor back_linecolor ; + draw w withcolor back_linecolor ; - elseif back_type=4 : + elseif back_type=4 : - fill t withcolor back_nillcolor ; - fill u withcolor back_fillcolor ; - draw t withcolor back_linecolor ; - draw u withcolor back_linecolor ; + fill t withcolor back_nillcolor ; + fill u withcolor back_fillcolor ; + draw t withcolor back_linecolor ; + draw u withcolor back_linecolor ; - elseif back_type=5 : + elseif back_type=5 : - t := t rotatedaround(center t,180) ; - u := u rotatedaround(center u,180) ; + t := t rotatedaround(center t,180) ; + u := u rotatedaround(center u,180) ; - fill t withcolor back_nillcolor ; - fill u withcolor back_fillcolor ; - draw t withcolor back_linecolor ; - draw u withcolor back_linecolor ; + fill t withcolor back_nillcolor ; + fill u withcolor back_fillcolor ; + draw t withcolor back_linecolor ; + draw u withcolor back_linecolor ; - elseif back_type=6 : + elseif back_type=6 : - r := r rotatedaround(center r,180) ; - s := s rotatedaround(center s,180) ; + r := r rotatedaround(center r,180) ; + s := s rotatedaround(center s,180) ; - fill r withcolor back_nillcolor ; - fill s withcolor back_fillcolor ; - draw r withcolor back_linecolor ; - draw s withcolor back_linecolor ; + fill r withcolor back_nillcolor ; + fill s withcolor back_fillcolor ; + draw r withcolor back_linecolor ; + draw s withcolor back_linecolor ; - elseif back_type=7 : + elseif back_type=7 : - fill r withcolor back_nillcolor ; - fill s withcolor back_fillcolor ; - draw r withcolor back_linecolor ; - draw s withcolor back_linecolor ; + fill r withcolor back_nillcolor ; + fill s withcolor back_fillcolor ; + draw r withcolor back_linecolor ; + draw s withcolor back_linecolor ; -fi ; +fi ; -enddef ; +enddef ; endinput ; -beginfig (1) ; +beginfig (1) ; -some_double_back (1, 4.5cm, 1.5cm, .25cm, 1mm, +some_double_back (1, 4.5cm, 1.5cm, .25cm, 1mm, .5white, .8white, .7white, .6white, .7white, .6white) -currentpicture := currentpicture shifted (0,-3cm) ; +currentpicture := currentpicture shifted (0,-3cm) ; -some_double_back (2, 4.5cm, 1.5cm, .25cm, 1mm, +some_double_back (2, 4.5cm, 1.5cm, .25cm, 1mm, .5white, .8white, .7white, .6white, white, white) -currentpicture := currentpicture shifted (0,-3cm) ; +currentpicture := currentpicture shifted (0,-3cm) ; -some_double_back (3, 4.5cm, 1.5cm, .25cm, 1mm, +some_double_back (3, 4.5cm, 1.5cm, .25cm, 1mm, .5white, .8white, .7white, white, white, white) -currentpicture := currentpicture shifted (0,-3cm) ; +currentpicture := currentpicture shifted (0,-3cm) ; -some_double_back (4, 4.5cm, 1.5cm, .25cm, 1mm, +some_double_back (4, 4.5cm, 1.5cm, .25cm, 1mm, .5white, .8white, .7white, white, white, white) -currentpicture := currentpicture shifted (0,-3cm) ; +currentpicture := currentpicture shifted (0,-3cm) ; -some_double_back (5, 4.5cm, 1.5cm, .25cm, 1mm, +some_double_back (5, 4.5cm, 1.5cm, .25cm, 1mm, .5white, .8white, .7white, white, white, white) -currentpicture := currentpicture shifted (0,-3cm) ; +currentpicture := currentpicture shifted (0,-3cm) ; -some_double_back (6, 4.5cm, 1.5cm, .25cm, 1mm, +some_double_back (6, 4.5cm, 1.5cm, .25cm, 1mm, .5white, .8white, .7white, white, white, white) -currentpicture := currentpicture shifted (0,-3cm) ; +currentpicture := currentpicture shifted (0,-3cm) ; -some_double_back (7, 4.5cm, 1.5cm, .25cm, 1mm, +some_double_back (7, 4.5cm, 1.5cm, .25cm, 1mm, .5white, .8white, .7white, white, white, white) -currentpicture := currentpicture shifted (0,-3cm) ; +currentpicture := currentpicture shifted (0,-3cm) ; -some_double_back (8, 4.5cm, 1.5cm, .25cm, 1mm, +some_double_back (8, 4.5cm, 1.5cm, .25cm, 1mm, .5white, .8white, .7white, white, white, white) -endfig ; +endfig ; end . diff --git a/metapost/context/base/mp-page.mp b/metapost/context/base/mp-page.mp index 71ca12aa0..60bfb1417 100644 --- a/metapost/context/base/mp-page.mp +++ b/metapost/context/base/mp-page.mp @@ -444,4 +444,31 @@ def Enlarged (expr p, d) = ulEnlarged (p,d) -- cycle) enddef ; +% New: + +def position_anchor_bar(expr p_b_self, p_e_self, y_b_self, y_e_self, h_b_self, d_e_self, + distance, linewidth, linecolor) = + StartPage ; + path p ; p := + if p_b_self=p_e_self : + (xpart ulcorner Field[Text][Text],y_b_self+h_b_self) -- + (xpart llcorner Field[Text][Text],y_e_self-d_e_self) ; + elseif RealPageNumber=p_b_self : + (xpart ulcorner Field[Text][Text],y_b_self+h_b_self) -- + (llcorner Field[Text][Text]) ; + elseif RealPageNumber=p_e_self : + (ulcorner Field[Text][Text]) -- + (xpart llcorner Field[Text][Text],y_e_self-d_e_self) ; + else : + (ulcorner Field[Text][Text]) -- + (llcorner Field[Text][Text]) ; + fi ; + p := p shifted (-llcorner Field[Text][Text]-(distance,0)) ; + interim linecap := butt ; + draw p + withpen pencircle scaled linewidth + withcolor linecolor ; + StopPage ; +enddef ; + endinput ; diff --git a/tex/context/base/anch-bar.mkiv b/tex/context/base/anch-bar.mkiv index d08573c0f..f914976b2 100644 --- a/tex/context/base/anch-bar.mkiv +++ b/tex/context/base/anch-bar.mkiv @@ -119,30 +119,15 @@ {\removelastspace\tpos{side:\the\currentsidebar}\carryoverpar\egroup} \startMPpositionmethod{mpos:bar} - \startMPpositiongraphic{mpos:bar}{linecolor,linewidth,distance}% - StartPage ; - path p ; p := - if \MPp\MPbself=\MPp\MPeself : - (xpart ulcorner Field[Text][Text],\MPy\MPbself+\MPh\MPbself) -- - (xpart llcorner Field[Text][Text],\MPy\MPeself-\MPd\MPeself) ; - elseif RealPageNumber=\MPp\MPbself : - (xpart ulcorner Field[Text][Text],\MPy\MPbself+\MPh\MPbself) -- - (llcorner Field[Text][Text]) ; - elseif RealPageNumber=\MPp\MPeself : - (ulcorner Field[Text][Text]) -- - (xpart llcorner Field[Text][Text],\MPy\MPeself-\MPd\MPeself) ; - else : - (ulcorner Field[Text][Text]) -- - (llcorner Field[Text][Text]) ; - fi ; - p := p shifted (-llcorner Field[Text][Text]-(\MPvar{distance},0)) ; - interim linecap := butt ; - draw p - withpen pencircle scaled \MPvar{linewidth} - withcolor \MPvar{linecolor} ; - StopPage ; - \stopMPpositiongraphic - \MPpositiongraphic{mpos:bar}{}% + \startMPpositiongraphic{mpos:bar}{linecolor,linewidth,distance}% + position_anchor_bar ( + \MPp\MPbself, \MPp\MPeself, + \MPy\MPbself, \MPy\MPeself, + \MPh\MPbself, \MPd\MPeself, + \MPvar{distance}, \MPvar{linewidth}, \MPvar{linecolor} + ) ; + \stopMPpositiongraphic + \MPpositiongraphic{mpos:bar}{}% \stopMPpositionmethod %D We now reimplement the margin rules handler defined in diff --git a/tex/context/base/anch-pgr.mkiv b/tex/context/base/anch-pgr.mkiv index 642a20d93..7a8fcd07f 100644 --- a/tex/context/base/anch-pgr.mkiv +++ b/tex/context/base/anch-pgr.mkiv @@ -1031,6 +1031,8 @@ linecolor=blue, linewidth=1pt] +% these might become macros in mp-page + \startuseMPgraphic{mpos:common:ec} path pa ; pair ca ; color lc ; numeric lw ; lw := \MPvar{linewidth} ; diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index ce16ac69a..6269e5a61 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,29 +11,15 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -% 2009-07-15 / vista sp 2 / 2.2G duo dell M90 precision: -% -% \dorecurse{10000}{test \page} % 300 pps -% \dorecurse {2000}{test \page} % 260 pps -% \dorecurse {300}{test \page} % 135 pps - -% \ctxlua { fonts.define.method = 2 } % normally 3 - -\enablemode[mkiv] \setsystemmode{mkiv} - % potential new defaults: % % \setbreakpoints[compound] -\ctxlua{logs.report=function(s,t,...) commands.writestatus("!"..s,string.format(t,...)) end} - \unprotect -\def\immediatemessage#1{\ctxlua{commands.writestatus("message","#1")}} - -% % % % % % needs testing but saves runtime +\ctxlua{logs.report = commands.report} % this will become default -\let\checknotes\relax % probably not needed, checking already done +\def\immediatemessage#1{\ctxlua{commands.writestatus("message","#1")}} % we need to figure this out (to be discussed) @@ -47,60 +33,8 @@ \unexpanded\def\textplus {\char"002B } % plus -\let\\=\crlf % till we fixed all styles - -% \def\pagedir{\expandafter\gobblethreearguments} -% \def\bodydir{\expandafter\gobblethreearguments} - -%D Since this can be a showstopper, we report the path at the beginning -%D as well as at the end of a run. - -% \writestatus\m!lua{used config path - \ctxlua{tex.print(caches.configpath())}} -% \writestatus\m!lua{used cache path - \ctxlua{tex.print(caches.path)}} - -%D For the moment we report some statistics. Later this will become an option, -%D but for now we need this information. +% till we fixed all styles -\def\nomkivstatistics{\ctxlua{statistics.enable = false}} % for taco - -\def\resettimer {\ctxlua{environment.starttime = os.clock()}} -\def\elapsedtime {\ctxlua{tex.sprint(os.clock()-environment.starttime)}} -\let\elapsedseconds \elapsedtime - -% we will have a bunch of extra tracers (--dumphash --dumpdelta) - -\def\tracersdumphash {\ctxlua{tracers.register_dump_hash(false)}} -\def\tracersdumpdelta{\ctxlua{tracers.register_dump_hash(true)}} - -\resettimer - -%D For me. - -\def\traceluausage - {\dosingleempty\dotraceluausage} - -\def\dotraceluausage[#1]% - {\ctxlua{debugger.enable()}% - \appendtoks\ctxlua{debugger.disable() debugger.showstats(print,\doifnumberelse{#1}{#1}{5000})}\to\everybye} - -%D Fonts (experimental AFM loading} - -% \ctxlua { -% remapper.define('encoding','^lm' ,'^(.*)$','lm-\letterpercent1') -% remapper.define('encoding','^qbk','^(.*)$','q-\letterpercent1') -% remapper.define('encoding','^qcs','^(.*)$','q-\letterpercent1') -% remapper.define('encoding','^qpl','^(.*)$','q-\letterpercent1') -% remapper.define('encoding','^qtm','^(.*)$','q-\letterpercent1') -% } - -% \appendtoksonce \loadallXfontmapfiles \to \pdfbackendeveryximage -% \appendtoksonce \loadallXfontmapfiles \to \pdfbackendeveryxform -% \appendtoksonce \loadallXfontmapfiles \to \everystarttext -% \appendtoksonce \loadallXfontmapfiles \to \everybeforepagebody - -% \def\loadallXfontmapfiles{\ctxlua{fonts.map.flush("pdftex")}} +\let\\=\crlf \protect \endinput - -% \expanded{\defineactivecharacter \number"2000E} {\textdir TRT\relax} -% \expanded{\defineactivecharacter \number"2000F} {\textdir TLT\relax} diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex index 1c4d68b39..ad7d67d32 100644 --- a/tex/context/base/cont-new.tex +++ b/tex/context/base/cont-new.tex @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2010.02.24 22:28} +\newcontextversion{2010.02.25 19:46} %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.tex b/tex/context/base/context.tex index f030aa5e1..20cd0b843 100644 --- a/tex/context/base/context.tex +++ b/tex/context/base/context.tex @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2010.02.24 22:28} +\edef\contextversion{2010.02.25 19:46} %D For those who want to use this: diff --git a/tex/context/base/core-def.mkiv b/tex/context/base/core-def.mkiv index 9f9d5b927..38c467a55 100644 --- a/tex/context/base/core-def.mkiv +++ b/tex/context/base/core-def.mkiv @@ -35,7 +35,6 @@ \appendtoks \settopskip \to \everyjob \appendtoks \preloadlanguages \to \everyjob \appendtoks \preloadspecials \to \everyjob -\appendtoks \checknotes \to \everyjob % depends on bodyfont \appendtoks \initializeMPgraphics \to \everyjob % after loading system files \appendtoks \initializemainlanguage \to \everyjob \appendtoks \MPLIBregister \to \everyjob diff --git a/tex/context/base/core-env.mkiv b/tex/context/base/core-env.mkiv index db05e8bd5..573aae0b2 100644 --- a/tex/context/base/core-env.mkiv +++ b/tex/context/base/core-env.mkiv @@ -162,6 +162,10 @@ \long\def\dostopallmodes #1\stopallmodes {} \long\def\dostopnotallmodes#1\stopnotallmodes{} +%D Lets now set a mode: + +\enablemode[mkiv] \setsystemmode{mkiv} + %D Setups: \let\startsetups\relax % to please dep checker diff --git a/tex/context/base/core-mis.mkiv b/tex/context/base/core-mis.mkiv index 0babb77f1..63f279c92 100644 --- a/tex/context/base/core-mis.mkiv +++ b/tex/context/base/core-mis.mkiv @@ -895,6 +895,39 @@ \doifinsetelse{\delimitedtextparameter\c!location}{\v!paragraph,\v!margin}% {\dosingleempty\dostartdelimitedtextpar}\dostartdelimitedtexttxt}} +% \def\dostartdelimitedtextpar[#1]% +% {\let\dostopdelimitedtext\dostopdelimitedtextpar +% \doifsomething{\delimitedtextparameter\c!spacebefore} +% {\blank[\delimitedtextparameter\c!spacebefore]}% +% \delimitedtextparameter\c!before +% % nicer: +% % \doadaptleftskip {\delimitedtextparameter\c!leftmargin}% +% % \doadaptrightskip{\delimitedtextparameter\c!rightmargin}% +% % backward compatible: +% \doifelsenothing{#1} +% {\endgraf +% \doadaptleftskip {\delimitedtextparameter\c!leftmargin}% +% \doadaptrightskip{\delimitedtextparameter\c!rightmargin}% +% \let\dodostopdelimitedtextpar\endgraf} +% {\startnarrower[#1]\let\dodostopdelimitedtextpar\stopnarrower}% +% % so far +% % \dochecknextindentation{\??ci\currentdelimitedtext}% AM: not here +% \dostartattributes{\??ci\currentdelimitedtext}\c!style\c!color\empty +% \leftdelimitedtextmark +% \ignorespaces} + +% \def\dostopdelimitedtextpar +% {\removeunwantedspaces +% \removelastskip +% \rightdelimitedtextmark +% \dostopattributes +% \dodostopdelimitedtextpar +% \delimitedtextparameter\c!after +% \doifsomething{\delimitedtextparameter\c!spaceafter} +% {\blank[\delimitedtextparameter\c!spaceafter]}% +% \dochecknextindentation{\??ci\currentdelimitedtext}% AM: here +% \dorechecknextindentation}% AM: This was missing! + \def\dostartdelimitedtextpar[#1]% {\let\dostopdelimitedtext\dostopdelimitedtextpar \doifsomething{\delimitedtextparameter\c!spacebefore} @@ -912,6 +945,9 @@ {\startnarrower[#1]\let\dodostopdelimitedtextpar\stopnarrower}% % so far % \dochecknextindentation{\??ci\currentdelimitedtext}% AM: not here + \pushmacro\checkindentation + \doifsomething{\delimitedtextparameter\c!indenting} % WS + {\setupindenting[\delimitedtextparameter\c!indenting]}% \dostartattributes{\??ci\currentdelimitedtext}\c!style\c!color\empty \leftdelimitedtextmark \ignorespaces} @@ -921,6 +957,7 @@ \removelastskip \rightdelimitedtextmark \dostopattributes + \popmacro\checkindentation \dodostopdelimitedtextpar \delimitedtextparameter\c!after \doifsomething{\delimitedtextparameter\c!spaceafter} diff --git a/tex/context/base/enco-ini.mkiv b/tex/context/base/enco-ini.mkiv index af4ddabaa..bab631ef9 100644 --- a/tex/context/base/enco-ini.mkiv +++ b/tex/context/base/enco-ini.mkiv @@ -335,39 +335,29 @@ \fallbackcontrolspace \fi} -\unexpanded\def\fastcontrolspace +\unexpanded\def\fastcontrolspace % no glyph resolving after first (use grouped) + {\dofastcontrolspace} + +\def\dofastcontrolspace {\iffontchar\font\textcontrolspace - \textcontrolspace + \nofastfallbackcontrolspace \else - \fallbackcontrolspace - \let\normalcontrolspace\fallbackcontrolspace - \fi} + \dofastfallbackcontrolspace + \fi + \dofastcontrolspace} -% helpers +\newbox\controlspacebox -\def\fakepercent - {\mathematics{^{\scriptscriptstyle0}\kern-.25em/\kern-.2em_{\scriptscriptstyle0}}} - -\def\fakeperthousand - {\mathematics{^{\scriptscriptstyle0}\kern-.25em/\kern-.2em_{\scriptscriptstyle00}}} +\def\nofastfallbackcontrolspace + {\let\dofastcontrolspace\textcontrolspace} -\def\fakepermine - {\dontleavehmode - \bgroup - \setbox\scratchbox\hbox - {\mathematics{+}}% - \hbox to \wd\scratchbox - {\hss\mathematics{^{\scriptscriptstyle-}\kern-.4em/\kern-.3em_{\scriptscriptstyle-}}\hss}% - \egroup} +\def\dofastfallbackcontrolspace + {\setbox\controlspacebox\hbox{\space}% + \setbox\controlspacebox\hbox to \wd\controlspacebox{\hss\fallbackcontrolspace\hss}% + \let\dofastcontrolspace\flushcontrolspacebox} -\def\fakedcontrolspace % can be virtual in luatex - {\dontleavehmode\hbox - {\scratchdimen.1ex% - \kern\scratchdimen - \vrule \!!width\scratchdimen \!!height5.5\scratchdimen\!!depth3\scratchdimen - \vrule \!!width\dimexpr.5em-4\scratchdimen\!!height -2\scratchdimen\!!depth3\scratchdimen - \vrule \!!width\scratchdimen \!!height5.5\scratchdimen\!!depth3\scratchdimen - \kern\scratchdimen}} +\def\flushcontrolspacebox + {\copy\controlspacebox} % from enco-acc: % diff --git a/tex/context/base/font-ctx.lua b/tex/context/base/font-ctx.lua index 6ee2ca0d9..e37c0ea76 100644 --- a/tex/context/base/font-ctx.lua +++ b/tex/context/base/font-ctx.lua @@ -451,12 +451,14 @@ function fonts.cleanname(name) texsprint(ctxcatcodes,fonts.names.cleanname(name)) end -local p, f = 1, "%0.01fpt" -- normally this value is changed only once +local p, f = 1, "%0.1fpt" -- normally this value is changed only once + +local stripper = lpeg.patterns.strip_zeros function fonts.nbfs(amount,precision) if precision ~= p then p = precision - f = "%0.0" .. p .. "fpt" + f = "%0." .. p .. "fpt" end - texsprint(ctxcatcodes,format(f,amount/65536)) + texsprint(ctxcatcodes,lpegmatch(stripper,format(f,amount/65536))) end diff --git a/tex/context/base/l-aux.lua b/tex/context/base/l-aux.lua index e55f59758..4cee5f324 100644 --- a/tex/context/base/l-aux.lua +++ b/tex/context/base/l-aux.lua @@ -209,6 +209,8 @@ local stripper = lpeg.Cs((number + 1)^0) --~ lpegmatch(stripper,str) --~ print(#str, os.clock()-ts, lpegmatch(stripper,sample)) +lpeg.patterns.strip_zeros = stripper + function aux.strip_zeros(str) return lpegmatch(stripper,str) end diff --git a/tex/context/base/l-lpeg.lua b/tex/context/base/l-lpeg.lua index 9e761e4b3..e7b319874 100644 --- a/tex/context/base/l-lpeg.lua +++ b/tex/context/base/l-lpeg.lua @@ -8,6 +8,8 @@ if not modules then modules = { } end modules ['l-lpeg'] = { lpeg = require("lpeg") +lpeg.patterns = lpeg.patterns or { } -- so that we can share + local P, R, S, Ct, C, Cs, Cc = lpeg.P, lpeg.R, lpeg.S, lpeg.Ct, lpeg.C, lpeg.Cs, lpeg.Cc local match = lpeg.match diff --git a/tex/context/base/luat-cbk.lua b/tex/context/base/luat-cbk.lua index aa6f8c794..47dd94a05 100644 --- a/tex/context/base/luat-cbk.lua +++ b/tex/context/base/luat-cbk.lua @@ -29,6 +29,8 @@ local trace_callbacks = false trackers.register("system.callbacks", function(v) local register_callback, find_callback = callback.register, callback.find local frozen, stack = { }, { } +callback.original_register_callback = register_callback + local function frozenmessage(what,name) logs.report("callbacks","not %s frozen '%s' (%s)",what,name,frozen[name]) end diff --git a/tex/context/base/node-par.lua b/tex/context/base/node-par.lua index 2066d8ca4..ee0dfaf8a 100644 --- a/tex/context/base/node-par.lua +++ b/tex/context/base/node-par.lua @@ -44,7 +44,7 @@ end -- also for testing (no surrounding spacing done) function parbuilders.constructors.oneline(head,is_display) --- head.list = node.hpack(head) + return node.hpack(head) end local actions = tasks.actions("parbuilders",1) diff --git a/tex/context/base/page-not.mkiv b/tex/context/base/page-not.mkiv index 9628b9d5f..95229f9d0 100644 --- a/tex/context/base/page-not.mkiv +++ b/tex/context/base/page-not.mkiv @@ -29,17 +29,15 @@ \flushnotes \savenotecontent \fi - \savenotedata - \checknotes} + \savenotedata} \def\checkendcolumnfootnotes - {\restorenotedata % maybe better just \checknotes + {\restorenotedata \ifcase\clevernotes\else \restorenotecontent \fi} -\def\checksinglecolumnfootnotes - {\checknotes} % niet : \restorenotedata +\let\checksinglecolumnfootnotes\relax \newdimen\totalinsertionheight @@ -58,8 +56,7 @@ \flushnotes \savenotecontent \fi - \savenotedata - \checknotes} + \savenotedata} \def\checkendcolumnfootnotes {\restorenotedata diff --git a/tex/context/base/spac-def.mkiv b/tex/context/base/spac-def.mkiv index db4f4c2a4..3aa85dda5 100644 --- a/tex/context/base/spac-def.mkiv +++ b/tex/context/base/spac-def.mkiv @@ -59,7 +59,6 @@ \appendtoks \simplesetupindenting \to \everybodyfont \appendtoks \simplesetupblank \to \everybodyfont \appendtoks \simplesetupwhitespace \to \everybodyfont -%appendtoks \checknotes \to \everybodyfont % not \appendtoks \simplesetupspacing \to \everybodyfont % nieuw \appendtoks \setrelativeinterlinespace \to \everybodyfont diff --git a/tex/context/base/strc-not.mkiv b/tex/context/base/strc-not.mkiv index 088475d34..824fe3def 100644 --- a/tex/context/base/strc-not.mkiv +++ b/tex/context/base/strc-not.mkiv @@ -405,15 +405,8 @@ \ifnotelimit \global\dimen\currentnoteins\dimexpr\noteparameter\c!height*\scratchcounter\relax \fi - % distance - \begingroup - \setbox\scratchbox\vbox - {\forgetall - \noteparameter\c!before - \placenoterule - \noteparameter\c!after}% - \global\skip\currentnoteins\ht\scratchbox - \endgroup + % distance -> tricky as this might depend on a font switch so we need a fast checker + \dosetnotedistance % play safe \ifnum\noteparameter\s!noteloc=\plusfive \ctxlua{structure.notes.setstate("\currentnote","store")}% @@ -423,10 +416,28 @@ \global\skip \currentnoteins\zeropoint \fi} -% \def\checknotes -% {\processnotes\dochecknote} +\def\dosetnotedistance + {\begingroup + \setbox\scratchbox\vbox + {\forgetall + \dontcomplain + \noteparameter\c!before + \placenoterule + \noteparameter\c!after}% + \global\skip\currentnoteins\ht\scratchbox + \endgroup} -\let\checknotes\relax % experiment, avoiding this saves a lot of time +% \def\checknotes % no longer needed +% {\processnotes\dochecknote} +% +% \def\checknotedistances +% {\processnotes\dosetnotedistance} +% +% fails but not that much needed anyway: +% +% \appendtoks +% \checknotedistances +% \to \everyglobalbodyfont % D When \type{n} exceeds~1, footnotes are typeset in % D multi||columns, using the algoritm presented on page~397 diff --git a/tex/context/base/supp-dir.mkiv b/tex/context/base/supp-dir.mkiv index 2d7f6bd66..70738357b 100644 --- a/tex/context/base/supp-dir.mkiv +++ b/tex/context/base/supp-dir.mkiv @@ -15,4 +15,7 @@ \unprotect +% \expanded{\defineactivecharacter \number"2000E} {\textdir TRT\relax} +% \expanded{\defineactivecharacter \number"2000F} {\textdir TLT\relax} + \protect \endinput diff --git a/tex/context/base/syst-aux.mkiv b/tex/context/base/syst-aux.mkiv index b8551999e..815d5add0 100644 --- a/tex/context/base/syst-aux.mkiv +++ b/tex/context/base/syst-aux.mkiv @@ -6532,10 +6532,15 @@ % awaiting the definitive implementation -\ifdefined\resettimer \else - \let\resettimer \relax - \newcount\elapsedtime -\fi +% \ifdefined\resettimer \else +% \let\resettimer \relax +% \newcount\elapsedtime +% \fi +% \def\elapsedseconds{\expandafter\withoutpt\the\dimexpr\elapsedtime sp\relax} + +\def\resettimer {\ctxlua{commands.resettimer()}} +\def\elapsedtime {\ctxlua{commands.elapsedtime()}} +\let\elapsedseconds \elapsedtime \newcount\featuretest @@ -6555,8 +6560,6 @@ \wait \egroup} -\def\elapsedseconds{\expandafter\withoutpt\the\dimexpr\elapsedtime sp\relax} - \def\showtimer#1% {\writestatus{runtime}{\elapsedseconds\space s / #1}} @@ -6812,8 +6815,7 @@ %D \stoptyping \def\stripstring#1% #1 is \cs - {\edef\cs{\ctxlua - {tex.sprint(tex.vrbcatcodes,string.strip(\!!bs\detokenize\expandafter{#1}\!!es))}}} + {\edef\cs{\ctxlua{tex.sprint(tex.vrbcatcodes,string.strip(\!!bs\detokenize\expandafter{#1}\!!es))}}} %D \macros %D {dowithrange} diff --git a/tex/context/base/syst-lua.lua b/tex/context/base/syst-lua.lua index 23c5b05ef..bd4aad891 100644 --- a/tex/context/base/syst-lua.lua +++ b/tex/context/base/syst-lua.lua @@ -29,6 +29,10 @@ function commands.writedebug(a,b,c,...) end end +function commands.report(s,t,...) + commands.writestatus("!"..s,format(t,...)) +end + function commands.doifelse(b) if b then -- faster with if than with expression texsprint(ctxcatcodes,"\\firstoftwoarguments") diff --git a/tex/context/base/trac-deb.lua b/tex/context/base/trac-deb.lua index 1a7c55594..11d044af4 100644 --- a/tex/context/base/trac-deb.lua +++ b/tex/context/base/trac-deb.lua @@ -182,3 +182,6 @@ function tracers.register_dump_hash(delta) end main.register_stop_actions(1,function() tracers.dump_hash(nil,true) end) -- at front end + +directives.register("system.dumphash", function() tracers.register_dump_hash(false) end) +directives.register("system.dumpdelta", function() tracers.register_dump_hash(true ) end) diff --git a/tex/context/base/trac-inf.lua b/tex/context/base/trac-inf.lua index 84fa5507a..315195012 100644 --- a/tex/context/base/trac-inf.lua +++ b/tex/context/base/trac-inf.lua @@ -25,6 +25,14 @@ function statistics.hastimer(instance) return instance and instance.starttime end +function statistics.resettiming(instance) + if not instance then + notimer = { timing = 0, loadtime = 0 } + else + instance.timing, instance.loadtime = 0, 0 + end +end + function statistics.starttiming(instance) if not instance then notimer = { } @@ -168,3 +176,20 @@ function statistics.timed(action,report) report("total runtime: %s",statistics.elapsedtime(timer)) end +-- where, not really the best spot for this: + +commands = commands or { } + +local timer + +function commands.resettimer() + statistics.resettiming(timer) + statistics.starttiming(timer) +end + +function commands.elapsedtime() + statistics.stoptiming(timer) + tex.sprint(statistics.elapsedtime(timer)) +end + +commands.resettimer() diff --git a/tex/context/base/trac-tex.mkiv b/tex/context/base/trac-tex.mkiv index 844354160..9c596feab 100644 --- a/tex/context/base/trac-tex.mkiv +++ b/tex/context/base/trac-tex.mkiv @@ -33,4 +33,23 @@ \def\doenabletextracer #1{\csname enabletracer#1\endcsname} \def\dodisabletextracer#1{\csname disabletracer#1\endcsname} +% context --directives=system.nostatistics ... + +\def\nomkivstatistics{\ctxlua{statistics.enable = false}} % for taco + +\def\tracersdumphash {\ctxlua{tracers.register_dump_hash(false)}} +\def\tracersdumpdelta{\ctxlua{tracers.register_dump_hash(true)}} + +% wrong place: + +\def\traceluausage + {\dosingleempty\dotraceluausage} + +\def\dotraceluausage[#1]% + {\ctxlua{debugger.enable()}% + \appendtoks + \ctxlua{debugger.disable() debugger.showstats(print,\doifnumberelse{#1}{#1}{5000})}^ + \to \everybye + \gdef\dotraceluausage[#1]{}} + \protect \endinput diff --git a/tex/context/base/trac-tra.lua b/tex/context/base/trac-tra.lua index b6598484e..4c578fcee 100644 --- a/tex/context/base/trac-tra.lua +++ b/tex/context/base/trac-tra.lua @@ -329,3 +329,10 @@ function experiments.disable(...) commands.writestatus("experiments","disabling: %s",concat({...}," ")) d(...) end + +-- a useful example + +directives.register("system.nostatistics", function(v) + statistics.enable = not v +end) + diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua index 559220bc8..47feb5236 100644 --- a/tex/generic/context/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : c:/data/develop/context/texmf/tex/generic/context/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/texmf/tex/generic/context/luatex-fonts.lua --- merge date : 02/24/10 22:33:12 +-- merge date : 02/25/10 19:56:12 do -- begin closure to overcome local limits and interference @@ -304,6 +304,8 @@ if not modules then modules = { } end modules ['l-lpeg'] = { lpeg = require("lpeg") +lpeg.patterns = lpeg.patterns or { } -- so that we can share + local P, R, S, Ct, C, Cs, Cc = lpeg.P, lpeg.R, lpeg.S, lpeg.Ct, lpeg.C, lpeg.Cs, lpeg.Cc local match = lpeg.match |