Re: [ROOT] getting TText to fit in a TPaveText

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Dec 08 2000 - 16:41:41 MET


Hi Matt,
I am afraid that your request is already implemented in TPaveText. And we have
functions returning the length of a string. However, I am aware that this
function is not always returning a right value (problem seems to be in the very
basic function called by TVirtualX::GetTextExtend).
When you have cases like this, it would be more helpful to me if you could
provide
a copy of your canvas in the form canvas.root.
I can then inspect the content to understand topologies where the algorithm
does not function correctly.

Rene Brun


Matthew D. Langston wrote:
> 
> I always run into the problem of having text extend past the boundaries of a
> TPaveText.  For example, sometimes I have really long histogram titles, and
> these titles extend out past the right boundary of the TPaveText when the
> histogram is drawn.
> 
> Is there some way to get the text in a TPaveText to automatically resize
> itself when the TPaveText is resized, so that the TText object(s) remain
> inside the boundaries of the TPaveText?
> 
> I tried to program this myself, but I soon discovered that there didn't seem
> to be a way to calculate the length of the text for a given font.
> Therefore, there doesn't seem to be anyway to calculate a scale factor.
> 
> Thank you for any help.
> 
> Regards, Matt
> 
> --
> Matthew D. Langston
> SLD, Stanford Linear Accelerator Center
> langston@SLAC.Stanford.EDU



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:38 MET