Changing text size breaks TLegend marker/text alignment

Hello,

when I resize TLegend text size for the entries the vertical alignment between marker and entry text is lost: to reproduce try

TH1D *histo = new TH1D("histo", "", 100, -10, 10); histo->FillRandom("gaus"); histo->Fit("gaus"); TF1 *function = histo->GetFunction("gaus"); function->SetLineColor(kRed); histo->Draw(); plot_legend = new TLegend(); plot_legend->SetName("legend"); plot_legend->SetX1NDC(0.2); plot_legend->SetY1NDC(0.7); plot_legend->SetX2NDC(0.65); plot_legend->SetY2NDC(0.78); //plot_legend->SetTextSize(0.033); plot_legend->AddEntry(histo, "text for histo", "p"); plot_legend->AddEntry(function, "text for the fit", "l"); plot_legend->SetBorderSize(0); plot_legend->SetFillColor(0); plot_legend->Draw();

and repeat uncommenting the “SetTextSize” line. Is this normal? How can it be prevented?

It works fine if you do:

{
TH1D *histo = new TH1D("histo", "", 100, -10, 10);
histo->FillRandom("gaus");
histo->Fit("gaus");
TF1 *function = histo->GetFunction("gaus");
function->SetLineColor(kRed);
histo->Draw();
plot_legend = new TLegend(0.2,0.7,0.65,0.78);
plot_legend->SetName("legend");
plot_legend->AddEntry(histo, "text for histo", "pf");
plot_legend->AddEntry(function, "text for the fit", "lf");
plot_legend->SetBorderSize(0);
plot_legend->SetFillColor(0);
plot_legend->Draw();
}

why doesn’t it work in the other way?

Now fixed in the SVN trunk.
Thanks for reporting.