RE: [ROOT] TLatex::PaintLatex

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue Nov 05 2002 - 08:36:08 MET


Ed,

Of course, the position of the text MUST change with your logic!
Why are you doing:
         pl->PaintLatex(pl->GetX()-.5,pl->GetY()-.05,angle,size,text);
instead of:
         pl->PaintLatex(pl->GetX(),pl->GetY(),angle,size,text);

Rene Brun


On Tue, 5 Nov 2002, Ed Oltman wrote:

> Hello,
>  The following script illustrates the effect I observe...
> 
> {
>     gROOT->Reset();
>     TF1 *pf = new TF1("pf","sin(x)/x",0.,10.);
>     pf->Draw();
>     TLatex *pl = new TLatex(6.,.5,"A^{b}");
>     pl->Draw();
>     double angle = pl->GetTextAngle();
>     double size = pl->GetTextSize();
>     char *text = pl->GetTitle();
> 
> 
>     // now, some PaintLatex calls and the object's position changes..
>     for(int i=1;i<10;i++)
>     {
>         pl->PaintLatex(pl->GetX()-.5,pl->GetY()-.05,angle,size,text);
>         printf("%f %f\n",pl->GetX(),pl->GetY());
>         gPad->GetCanvas()->Update();
>         gSystem->Sleep(100);
>     }
> }
> 
> > -----Original Message-----
> > From: Rene Brun [mailto:brun@pcbrun.cern.ch]
> > Sent: Tuesday, November 05, 2002 12:40 AM
> > To: Ed Oltman
> > Cc: Roottalk@Pcroot. Cern. Ch
> > Subject: Re: [ROOT] TLatex::PaintLatex 
> > 
> > 
> > Hi Ed,
> > 
> > The values are changed inside the function, but reset to their
> > original values on return.
> > PaintLatex is a complex algorithm going recursively through all
> > the sub-expressions.
> > 
> > Rene Brun
> > 
> > On Mon, 4 Nov 2002, Ed Oltman wrote:
> > 
> > > Hello,
> > > 
> > >  I notice that TLatex::PaintLatex() changes the values of the object's
> > > position in contrast to other "Paint" methods,  for example,
> > > TText::PaintText(),  TLine::PaintLine(), TBox::PaintBox() etc.. do not
> > > change their corresponding positions.  Is there a reason for 
> > this apparent
> > > inconsistency?
> > > 
> > > Thanks,
> > > Ed Oltman
> > > 
> > > 
> > 
> > 
> > 
> > 
> 



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:16 MET