[NTG-context] Circled text in metapost

Henri Menke henrimenke at gmail.com
Sat Mar 31 01:22:32 CEST 2018


On Thu, 2018-03-29 at 18:05 +0200, Gerhard Kugler wrote:
> On Thu, Mar 29, 2018 at 07:11:50AM -0600, Alan Braslau wrote:
> > 
> > On Thu, 29 Mar 2018 12:43:56 +0200
> > Gerhard Kugler <G.W.Kugler at posteo.de> wrote:
> > 
> > > 
> > > One misunderstanding made by my post: I want to write the text curved
> > > as a (half-)circle.
> > Take a look at the Metafun manual.
> > 
> In the manual is an example on page 233 with the following content:

Nah!  Don't use those macros.  They are only for demonstration.  Use the builtin
\followtokens instead:


\loadmarkfile{meta-imp-txt} % is this supposed to be loaded like that?
\starttext

\startuseMPgraphic{followtokens}
  path RotPath ; RotPath := reverse halfcircle ;
\stopuseMPgraphic
\followtokens{Text on a half circle}

\stoptext


> 
> -----
> 
> \def\rotatetokens#1#2#3#4% delta extra radius tokens
> {\vbox\bgroup
> \MPtoks\emptytoks
> \resetMPdrawing
> \startMPdrawing
> picture pic[] ;
> numeric wid, len[], rot ;
> numeric delta, extra, radius, n, r ;
> len[0] := n := 0 ;
> delta := #1 ; extra := #2 ; radius := #3 ;
> \stopMPdrawing
> \handletokens#4\with\processrotationtoken
> \startMPdrawing
> r := len[n]/Pi ;
> for i=1 upto n :
> wid := abs(xpart lrcorner pic[i] -
> xpart llcorner pic[i]) ;
> rot := extra + delta -
> ((len[i]-.5wid)/len[n]) * (180+2delta) ;
> draw pic[i]
> rotatedaround (origin,-270) shifted (-r-radius,
> ypart -.5[ulcorner pic[i], llcorner pic[i]])
> rotatedaround (origin,rot) ;
> endfor ;
> \stopMPdrawing
> \MPdrawingdonetrue
> \getMPdrawing
> \resetMPdrawing
> \egroup}
> 
> \startcombination[3*1]
> {\rotatetokens {0} {0}{0}{Does it work ok?}} {A}
> {\rotatetokens{20} {0}{0}{Does it work ok?}} {B}
> {\rotatetokens{20}{30}{0}{Does it work ok?}} {C}
> \stopcombination
> 
> -----
> 
> But I cannot see what part calls what parts and how they can be
> embedded.
> 
> Gerhard
> 
> 


More information about the ntg-context mailing list