Hello,
I'm a bit "out" of programming at the moment (and not following mkiv
as deep as I should), but here's one of the old sins that keeps
preventing my module to be used in MKIV.
How can I get rid of \startTeXtexts in the following code, so that the
code will be usable by both mkii and mkiv? (Metapost code is probably
[almost] OK, but the TeX part needs some minor polishing. One could
definitely rewrite metapost code into lua, but then I would need to
take care for two paralel versions - I do not want to go there since
metapost does all the work at the moment.)
Any hinst most welcome,
Mojca
\defineconversion
[hans and taco]
[H,a,n,s,\ ,\&,\ ,T,a,c,o,\ ]
\setupcolors
[state=start]
\chardef\TeXtextcolormode\zerocount
\startTeXtexts
\doloop{\doifelseconversionnumber{hans and taco}{\recurselevel}%
% +500 is a hack (hopefully the plot doesn't contain more than 500 labels)
% otherwise the points would be overwritten by labels with another \TeXtext:
% it might need a fix in ConTeXt core
{\TeXtext{\numexpr\recurselevel+500\relax}{\strut{\convertnumber{hans
and taco}{\recurselevel}}}}%
{\exitloop}}%
\stopTeXtexts
\edef\numberofsymbols{1}%
\doloop{\doifelseconversionnumber{hans and taco}{\recurselevel}%
{\edef\numberofsymbols{\recurselevel}}%
{\exitloop}}%
\starttext
\startMPcode
color c[];
for i=1 upto \numberofsymbols:
c[i] = ((i-1)/(\numberofsymbols-1))[red,blue];
endfor;
vardef the_number(expr n) = ((n mod \numberofsymbols) + 1) enddef;
vardef the_symbol(expr n) =
picture pict;
pict := sometxt(the_number(n) + 500);
pict shifted -.5[llcorner pict,lrcorner pict]
enddef;
def draw_point(expr x, y, n) =
draw (the_symbol(n) shifted (x,y)) withcolor c[the_number(n)];
enddef;
for i=0 upto 23:
draw_point(0,-i*3mm,i);
endfor;
\stopMPcode
\stoptext