Extra space before special symbol in TLatex due to SetCanvasPreferGL

gStyle->SetCanvasPreferGL(1);
TLatex *   tex = new TLatex(0.3,0.6,"Integrated Luminosity [fb^{-1}]");
tex->Draw();

produces

gStyle->SetCanvasPreferGL(0);
TLatex *   tex = new TLatex(0.3,0.6,"Integrated Luminosity [fb^{-1}]");
tex->Draw();

produces

This problem also exists in #ddot{}, #Delta, etc.

The point is I would like to use the function by enabling SetCanvasPreferGL (such as transparent pad and correct order of objects), while maintaining correct display of the special characters or symbols. But this bug avoids me to do that.

ROOT Version: 6.22/08
Platform: Ubuntu
Compiler: Not Provided


Hi @Marco1224 ,

thank you for your report, that looks like a bug. @couet should be able to confirm/deny/provide a solution when he’s back next week, let’s ping him.

Cheers,
Enrico

I see this issue on Mac with ROOT master also. I have no idea what it is for now. I need to investigate, Thanks for reporting.

1 Like

Indeed the rendering size in the case of GL does not correspond to the FreeType measurements:

void GLTLatex()
{

   TCanvas *c1 = new TCanvas("c1", "c1",0,0,700,500);

   TLatex *t1 = new TLatex(0.3,0.6,"123456789^{2}");
   t1->Draw();

   TLatex *t2 = new TLatex(0.3,0.5,"123456789^{2}");
   t2->SetTextSize(0.008421052);
   t2->Draw();

   gStyle->SetCanvasPreferGL(kTRUE);
   TCanvas *c2 = new TCanvas("c2", "c2",0,500,700,500);

   TLatex *t3 = new TLatex(0.3,0.6,"123456789^{2}");
   t3->Draw();

   TLatex *t4 = new TLatex(0.3,0.5,"123456789^{2}");
   t4->SetTextSize(0.008421052);
   t4->Draw();
}

In the following picture the GL version is below:


I continue to investigate.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.