ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* TraceRot?
@ 2000-11-02  1:46 Denis B. Roegel
  2000-11-02 10:22 ` TraceRot? Hans Hagen
  0 siblings, 1 reply; 5+ messages in thread
From: Denis B. Roegel @ 2000-11-02  1:46 UTC (permalink / raw)
  Cc: roegel

Where should TraceRot be specified in the \followtokens
example of the metafun manual? It doesn't seem to work for me.
Also, what is the difference between \startMPenvironment
and \startMPinclusions ?

Thanks,

Denis

Example where TraceRot has no effect (and why is the type of TraceRot
declared here?):

\setupcolors[state=start]
\starttext

\startMPenvironment
%\setupbodyfont[loc,mt,ppl,pcr,10pt]
\setupbodyfont[loc,mt,10pt]
\definefont[RotFont][RegularBold]
\stopMPenvironment

\startuseMPgraphic{followtokens}
  path RotPath; RotPath:=fullcircle scaled 5cm;
\stopuseMPgraphic

\startMPinclusions
  boolean TraceRot; TraceRot := true;
\stopMPinclusions

\def\processfollowingtoken#1%
  {\appendtoks#1\to\MPtoks
   \setbox\MPbox=\hbox{\bfd\setstrut\strut\the\MPtoks}%
   \startMPdrawing
     n:=n+1; len[n]:=\the\wd\MPbox;
   \stopMPdrawing
   \startMPdrawing[-]
     pic[n]:=btex \bfd\setstrut\strut#1 etex;
   \stopMPdrawing}

\def\followtokens#1%
  {\vbox\bgroup
   \MPtoks\emptytoks
   \resetMPdrawing
   \startMPdrawing
     \includeMPgraphic{followtokens}
     picture pic[];  numeric len[],n;n:=0;
    \stopMPdrawing
    \handletokens#1\with\processfollowingtoken
    \startMPdrawing
      numeric al,pl,at,wid,pos; pair ap,ad;
      al:=arclength RotPath;
      pl:=(al-len[n])/(n-1);
      for i=1 upto n:
        wid:=abs(xpart lrcorner pic[i]-xpart llcorner pic[i]);
        pos := len[i]-wid/2+(i-1)*pl;
        at := arctime pos of RotPath;
        ap := point at of RotPath;
        ad := direction at of RotPath;
        draw pic[i]
          shifted (-wid/2,0)
          rotated (angle(ad)) shifted ap;
      endfor;
    \stopMPdrawing
    \MPdrawingdonetrue
    \getMPdrawing
    \resetMPdrawing
    \egroup} 

\followtokens{We now follow some arbitrary path ...}

\stoptext

-------


^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: TraceRot?
@ 2000-11-02 12:32 Denis B. Roegel
  2000-11-02 13:12 ` TraceRot? Hans Hagen
  0 siblings, 1 reply; 5+ messages in thread
From: Denis B. Roegel @ 2000-11-02 12:32 UTC (permalink / raw)
  Cc: roegel

Thanks for the answers concerning my typo (ouline!),
\setupbodyfont[ber,pcr,10pt] (which works, but where
is my font configuration defined?), \RotFont (which
works now with \useMPlibrary[txt]), \bgroup/\egroup, etc.

However, I still can't manage to make TraceRot work.
Below is my exact example. I do not see tha characters
framed.

Denis

\useMPlibrary[txt]
\setupcolors[state=start]
\starttext

\startMPenvironment
%\setupbodyfont[loc,mt,ppl,pcr,10pt]
\setupbodyfont[loc,mt,10pt]
\definefont[RotFont][RegularBold]
\stopMPenvironment

\startuseMPgraphic{followtokens}
  path RotPath; RotPath:=fullcircle scaled 5cm;
\stopuseMPgraphic

\startMPinclusions
  boolean TraceRot; TraceRot := true;
\stopMPinclusions

\def\processfollowingtoken#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\followtokens#1%
  {\vbox\bgroup
   \MPtoks\emptytoks
   \resetMPdrawing
   \startMPdrawing
     \includeMPgraphic{followtokens}
     picture pic[];  numeric len[],n;n:=0;
    \stopMPdrawing
    \handletokens#1\with\processfollowingtoken
    \startMPdrawing
      numeric al,pl,at,wid,pos; pair ap,ad;
      al:=arclength RotPath;
      pl:=(al-len[n])/(n-1);
      for i=1 upto n:
        wid:=abs(xpart lrcorner pic[i]-xpart llcorner pic[i]);
        pos := len[i]-wid/2+(i-1)*pl;
        at := arctime pos of RotPath;
        ap := point at of RotPath;
        ad := direction at of RotPath;
        draw pic[i]
          shifted (-wid/2,0)
          rotated (angle(ad)) shifted ap;
      endfor;
    \stopMPdrawing
    \MPdrawingdonetrue
    \getMPdrawing
    \resetMPdrawing
    \egroup} 

\followtokens{We now follow some arbitrary path ...}

\stoptext


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2000-11-03 15:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-11-02  1:46 TraceRot? Denis B. Roegel
2000-11-02 10:22 ` TraceRot? Hans Hagen
2000-11-02 12:32 TraceRot? Denis B. Roegel
2000-11-02 13:12 ` TraceRot? Hans Hagen
2000-11-03 15:25   ` TraceRot? Denis B. Roegel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).