Re: [ROOT] change font in TLegend

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Mar 28 2002 - 17:47:35 MET


Hi Thomas,

The "legend entry" is correctly paint with the font 132.
The problem is with the legend header currently using font 62.
I have modified TLegend::SetHeader such that the header will use the font number
of the TLegend at the time you call SetHeader. I want to give the possibility
in this way to set a different font for the header and the normal entries.
Fix now in CVS.

Rene Brun

Thomas Schietinger wrote:
> 
> Hello,
> 
> I am unable to change the font in a TLegend
> using SetTextFont (such that it actually prints
> in that font). Changing the text size with
> SetTextSize works fine (see example macro).
> 
> Does anyone understand why?
> 
> Thanks,
> 
> Thomas
> 
> Example macro:
> 
> {
>   Double_t x[] = {2,10};
>   Double_t y[] = {0.4,1};
>   TGraph *gr = new TGraph(2,x,y);
>   gr->SetMarkerStyle(20);
>   gr->Draw("AP");
> 
>   leg = new TLegend(0.2,0.2,0.5,0.4);
>   leg->AddEntry(gr,"legend entry","p");
>   leg->SetHeader("legend header");
> 
>   cout << "font before:" << leg->GetTextFont() << endl;
>   leg->SetTextFont(132);  // does not work - why?
>   cout << "font after:" << leg->GetTextFont() << endl;
> 
>   leg->SetTextSize(0.05); // works fine
> 
>   leg->Draw();
> }



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