[dev-context] Leaders

Hans Hagen pragma at wxs.nl
Sun Jan 13 22:00:45 CET 2013


On 1/13/2013 9:34 PM, Wolfgang Schuster wrote:

> That version is even better, maybe remove spaces before/after the command to avoid unwanted spaces.

Ok, added (spac-flt.mkiv).

> Even though the \fillers command is slower than direct use of leaders it’s in my opinion more user friendly.

I've added it to the beta (ftp):

\setupbodyfont[dejavu]

\definefiller[test-a][alternative=stretch]
\definefiller[test-b][alternative=symbol,symbol=!]
\definefiller[test-c][alternative=rule,height=.1ex,leftmargin=.5em,rightmargin=.25em]

\starttext

     text\filler[test-a]text \par
     text\filler[test-b]text \par
     text\filler[test-c]text \par
     text\checkedfiller{<nothing>}text \par

\stoptext

Up to you to suggest list replacements. Concerning speed:

\setupbodyfont[dejavu]

\definefiller[test][alternative=symbol,symbol=!]

\starttext

dummy \page

\testfeatureonce{1000} { % 0.19  | 0.60
%     \setbox0
         \hbox to \hsize
             {text
             \removeunwantedspaces\leaders\hbox to 1em{\hss 
!\hss}\hfill\ignorespaces
             text}
}

\page

\testfeatureonce{1000} { % 0.27 | 0.65
%     \setbox0
         \hbox to \hsize
             {text
              \filler[test]
              text}
}

\stoptext

so it's neglectable on a document (most documents don't have 1000 such 
fillers): 0.0008 seconds per filler and that's an old machine. The 
performance of the commandhandler code is quite ok given what it does.

Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the dev-context mailing list