[NTG-context] Loop and graphictext (Metafun)

Hans Hagen pragma at wxs.nl
Mon Oct 5 19:48:05 CEST 2015


On 10/5/2015 6:28 PM, Fabrice Couvreur wrote:
> Hi,
> I tried to write a loop to display the title, but it does not. How to do ?
> Thank you,
> Fabrice
>
> \setuppagenumbering[location=]
>
> \setupcolors
>    [state=start]
>
> \definecolor[pagecolor][s=.6]
> \definecolor[textcolor][r=.6]
>
>
> \startMPinclusions
>    color pagecolor ; pagecolor := \MPcolor{pagecolor} ;
>    color textcolor ; textcolor := \MPcolor{textcolor} ;
> \stopMPinclusions
>
> \setMPtext{title}{Serie statistiques à deux variables}
>
> \startuseMPgraphic{Title}
>
>    path p ; p := OverlayBox  ;
>    fill OverlayBox withcolor pagecolor ;
>    setbounds currentpicture to OverlayBox ;
>
> \stopuseMPgraphic
>
> \defineoverlay[Title][\useMPgraphic{Title}]
>
> \defineframedtext
>    [MyTitle]
>    [before={\blank[line,halfline]},
>     after={\blank},
>     frame=off,
>     background=Title,
>     width=\textwidth,
>     height=fit,
>     ]
>
> \starttext
>
> \startMyTitle
>
> \startMPcode
>
> numeric k ; k :=0 ;
> string s ; s := \MPstring{title} ;
> picture r ;
> r := image (graphictext
>          substring (k,k+1) of s
>          randomized .5pt
>          scaled 5pt
>          withfillcolor textcolor
>          withpen pencircle scaled 1pt ; ) ;
>    draw r ;
>
> \stopMPcode
>
> \stopMyTitle
>
> \stoptext

i see no loop, why not just

r := image (graphictext
         s
        ....


-----------------------------------------------------------------
                                           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 ntg-context mailing list