[ROOT] change font in TLegend

From: Thomas Schietinger (Thomas.Schietinger@cern.ch)
Date: Thu Mar 28 2002 - 17:23:54 MET


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