You can also use mkii as command line drawing tool:
#> mtxrun texexec test.tex

\starttext
\startTEXpage
\resetMPdrawing
\startMPdrawing
picture pic[] ;
numeric wid[], len[], pos[], n ;
wid[0] := len[0] := pos[0] := n := 0 ;
\stopMPdrawing

\def\whatever#1%
{\appendtoks#1\to\MPtoks
 \setbox\MPbox=\hbox{\bfd\the\MPtoks}%
 \startMPdrawing
 n := n + 1 ; len[n] := \the\wd\MPbox ;
 \stopMPdrawing
 \startMPdrawing[-]
 pic[n] := textext("\bfd\setstrut\strut#1") ;
 pic[n] := pic[n] shifted - llcorner pic[n] ;
 \stopMPdrawing}

\handletokens MetaPost is Fun!\with\whatever

\startMPdrawing
     pair len ; len := origin ;
     for i=1 upto n :
       draw pic[i] shifted len ;
       draw boundingbox pic[i] shifted len
          withpen pencircle scaled .25pt withcolor red ;
       len := len+(xpart lrcorner pic[i]-xpart llcorner pic[i],0) ;
     endfor ;
\stopMPdrawing

\MPdrawingdonetrue\getMPdrawing

\stopTEXpage
\stoptext


-- 
luigi
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to