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  1:46 TraceRot? Denis B. Roegel
@ 2000-11-02 10:22 ` Hans Hagen
  0 siblings, 0 replies; 5+ messages in thread
From: Hans Hagen @ 2000-11-02 10:22 UTC (permalink / raw)
  Cc: ntg-context, roegel

At 02:46 AM 11/2/00 +0100, Denis B. Roegel wrote:
>
>Where should TraceRot be specified in the \followtokens
>example of the metafun manual? It doesn't seem to work for me.

Hm. it should work since [see meta-txt.tex] it is only defined if the user
has not defined it.  

>Also, what is the difference between \startMPenvironment

tex code

>and \startMPinclusions ?

mp code

Hans
-------------------------------------------------------------------------
                                                  Hans Hagen | PRAGMA ADE
                      Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------


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

* Re: TraceRot?
  2000-11-02 13:12 ` TraceRot? Hans Hagen
@ 2000-11-03 15:25   ` Denis B. Roegel
  0 siblings, 0 replies; 5+ messages in thread
From: Denis B. Roegel @ 2000-11-03 15:25 UTC (permalink / raw)
  Cc: Denis B. Roegel, ntg-context, roegel

`Hans Hagen' wrote

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

>   >\def\processfollowingtoken#1%
>   >\def\followtokens#1%
>   
>   These are defined in the loaded library, you must omit these defs. 

Actually, when I omit the two definitions it works, so I guess
there was an error in my definitions.

Denis


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

* Re: TraceRot?
  2000-11-02 12:32 TraceRot? Denis B. Roegel
@ 2000-11-02 13:12 ` Hans Hagen
  2000-11-03 15:25   ` TraceRot? Denis B. Roegel
  0 siblings, 1 reply; 5+ messages in thread
From: Hans Hagen @ 2000-11-02 13:12 UTC (permalink / raw)
  Cc: ntg-context, roegel

At 01:32 PM 11/2/00 +0100, Denis B. Roegel wrote:
>
>Thanks for the answers concerning my typo (ouline!),
>\setupbodyfont[ber,pcr,10pt] (which works, but where
>is my font configuration defined?), \RotFont (which

you may take a look at cont-sys.rme 

>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%
>\def\followtokens#1%

These are defined in the loaded library, you must omit these defs. 

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

-------------------------------------------------------------------------
                                                  Hans Hagen | PRAGMA ADE
                      Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------


^ 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).