TPaveText get size of automatic resized text

Hi rooters,

I have a question concerning the text size in a TPaveText. I simply add text to the TPaveText which then, looking at the source, sets the TextSize of the TAttText to 0, which then leads to the text size being adjusted automatically. Is it possible to access this automatically calculated text size from the TPaveText? When simply calling GetTextSize I get 0. I have a bunch of TPaveTexts and I would like to have the size of all texts to be identical, but I don’t know before how large this can be, so I would like to use, say one TPaveText to have the text size calculated automatically and then set the text size of the other to this size. At the moment the text sizes between the paves are slightly different despite the text content is very similar.

This – quite artificial – code can maybe illustrate the problem:

#include <iostream>

#include <TObjArray.h>
#include <TPaveText.h>
#include <TCanvas.h>

void pave()
  TCanvas *c1 = new TCanvas("c1","Canvas",500,500);
  TObjArray *paves = new TObjArray;
  for(int i = 0;i < 10; ++i) {
    paves->Add(new TPaveText(i*10,0,(i+1)*10,20));

the text for the first TPaveText is smaller than for the others. I would like to set the size of the other PaveTexts to the text size of the first.

Any hints appreciated.



In TPaveText::PaintPrimitives the variable textsize, used to store the automatically computed text size, is internal and cannot be access from outside.