Alexandre Billon wrote:
Dear all,
I am quite new to context (but love it) and i am trying tind a way to typeset texts "properly kerned" in such a way that the characters be all rotated with tiny randomized angle (strange project indeed). I tried to do it by writing a macro inspired by \followtokens. I have two questions :
1. It works but just for text within a single line : I have no clue how to manage the line breaking, and I have to admit that I don't know eanough TeX ConTeXt to find out.
2. In playing with the macro followtoken I happened to write two files with no apparent significant difference (I mean for me) but which give quite different results : one properly kerned, and another that is not. Could someone explain me what's happening here ? (files attached)
\startMPenvironment[global] \definefont[RotFont][RegularBold] \stopMPenvironment \def\whatever#1% {\appendtoks#1\to\MPtoks \setbox\MPbox=\hbox{\RotFont\setstrut\strut\the\MPtoks}% \startMPdrawing n := n + 1 ; len[n] := \the\wd\MPbox ; \stopMPdrawing \startMPdrawing[-] pic[n] := btex \RotFont\setstrut\strut#1 etex ; \stopMPdrawing} \def\funnywriting#1% {\bgroup \resetMPdrawing \startMPdrawing picture pic[] ; numeric wid[], len[], pos[], n ; wid[0] := len[0] := pos[0] := n := 0 ; \stopMPdrawing \handletokens#1\with\whatever \startMPdrawing for i=1 upto n : wid[i] := abs(xpart lrcorner pic[i] - xpart llcorner pic[i]) ; pos[i] := len[i]-wid[i] ; pic[i] := pic[i] rotatedaround(origin, -10 randomized 20) ; pic[i] := pic[i] shifted (pos[i],0) ; draw pic[i]; endfor ; \stopMPdrawing \MPdrawingdonetrue \getMPdrawing \resetMPdrawing \egroup} \starttext \funnywriting{La vie est belle} \stoptext watch the rotatedaround: you have to provide a pair as first argument (so both your files failed) Hans