ROOT   Reference Guide
TGTextLayout Class Reference

Is used to keep track of string measurement information when using the text layout facilities.

It can be displayed with respect to any origin.

Definition at line 106 of file TGFont.h.

## Public Member Functions

TGTextLayout ()

virtual ~TGTextLayout ()
destructor More...

Int_t CharBbox (Int_t index, Int_t *x, Int_t *y, Int_t *w, Int_t *h) const
Use the information in the TGTextLayout token to return the bounding box for the character specified by index. More...

Int_t DistanceToText (Int_t x, Int_t y) const
Computes the distance in pixels from the given point to the given text layout. More...

void DrawText (Drawable_t dst, GContext_t gc, Int_t x, Int_t y, Int_t firstChar, Int_t lastChar) const
Use the information in the TGTextLayout object to display a multi-line, justified string of text. More...

Int_t IntersectText (Int_t x, Int_t y, Int_t w, Int_t h) const
Determines whether a text layout lies entirely inside, entirely outside, or overlaps a given rectangle. More...

TClassIsA () const override

Int_t PointToChar (Int_t x, Int_t y) const
Use the information in the TGTextLayout token to determine the character closest to the given point. More...

void Streamer (TBuffer &) override
Stream an object of class TObject. More...

void StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b)

void ToPostscript (TString *dst) const
Outputs the contents of a text layout in Postscript format. More...

void UnderlineChar (Drawable_t dst, GContext_t gc, Int_t x, Int_t y, Int_t underline) const
Use the information in the TGTextLayout object to display an underline below an individual character. More...

Public Member Functions inherited from TObject
TObject ()
TObject constructor. More...

TObject (const TObject &object)
TObject copy ctor. More...

virtual ~TObject ()
TObject destructor. More...

void AbstractMethod (const char *method) const
Use this method to implement an "abstract" method that you don't want to leave purely abstract. More...

Append graphics object to current pad. More...

virtual void Browse (TBrowser *b)
Browse object. May be overridden for another default action. More...

ULong_t CheckedHash ()
Check and record whether this class has a consistent Hash/RecursiveRemove setup (*) and then return the regular Hash value for this object. More...

virtual const char * ClassName () const
Returns name of class to which the object belongs. More...

virtual void Clear (Option_t *="")

virtual TObjectClone (const char *newname="") const
Make a clone of an object using the Streamer facility. More...

virtual Int_t Compare (const TObject *obj) const
Compare abstract method. More...

virtual void Copy (TObject &object) const
Copy this to obj. More...

virtual void Delete (Option_t *option="")
Delete this object. More...

virtual Int_t DistancetoPrimitive (Int_t px, Int_t py)
Computes distance from point (px,py) to the object. More...

virtual void Draw (Option_t *option="")
Default Draw method for all objects. More...

virtual void DrawClass () const
Draw class inheritance tree of the class to which this object belongs. More...

virtual TObjectDrawClone (Option_t *option="") const
Draw a clone of this object in the current selected pad for instance with: gROOT->SetSelectedPad(gPad). More...

virtual void Dump () const
Dump contents of object on stdout. More...

virtual void Error (const char *method, const char *msgfmt,...) const
Issue error message. More...

virtual void Execute (const char *method, const char *params, Int_t *error=nullptr)
Execute method on this object with the given parameter string, e.g. More...

virtual void Execute (TMethod *method, TObjArray *params, Int_t *error=nullptr)
Execute method on this object with parameters stored in the TObjArray. More...

virtual void ExecuteEvent (Int_t event, Int_t px, Int_t py)
Execute action corresponding to an event at (px,py). More...

virtual void Fatal (const char *method, const char *msgfmt,...) const
Issue fatal error message. More...

virtual TObjectFindObject (const char *name) const
Must be redefined in derived classes. More...

virtual TObjectFindObject (const TObject *obj) const
Must be redefined in derived classes. More...

virtual Option_tGetDrawOption () const
Get option used by the graphics system to draw this object. More...

virtual const char * GetIconName () const
Returns mime type name of object. More...

virtual const char * GetName () const
Returns name of object. More...

virtual char * GetObjectInfo (Int_t px, Int_t py) const
Returns string containing info about the object at position (px,py). More...

virtual Option_tGetOption () const

virtual const char * GetTitle () const
Returns title of object. More...

virtual UInt_t GetUniqueID () const
Return the unique object id. More...

virtual Bool_t HandleTimer (TTimer *timer)
Execute action in response of a timer timing out. More...

virtual ULong_t Hash () const
Return hash value for this object. More...

Bool_t HasInconsistentHash () const
Return true is the type of this object is known to have an inconsistent setup for Hash and RecursiveRemove (i.e. More...

virtual void Info (const char *method, const char *msgfmt,...) const
Issue info message. More...

virtual Bool_t InheritsFrom (const char *classname) const
Returns kTRUE if object inherits from class "classname". More...

virtual Bool_t InheritsFrom (const TClass *cl) const
Returns kTRUE if object inherits from TClass cl. More...

virtual void Inspect () const
Dump contents of this object in a graphics canvas. More...

void InvertBit (UInt_t f)

virtual TClassIsA () const

Bool_t IsDestructed () const
IsDestructed. More...

virtual Bool_t IsEqual (const TObject *obj) const
Default equal comparison (objects are equal if they have the same address in memory). More...

virtual Bool_t IsFolder () const
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects). More...

R__ALWAYS_INLINE Bool_t IsOnHeap () const

virtual Bool_t IsSortable () const

R__ALWAYS_INLINE Bool_t IsZombie () const

virtual void ls (Option_t *option="") const
The ls function lists the contents of a class on stdout. More...

void MayNotUse (const char *method) const
Use this method to signal that a method (defined in a base class) may not be called in a derived class (in principle against good design since a child class should not provide less functionality than its parent, however, sometimes it is necessary). More...

virtual Bool_t Notify ()
This method must be overridden to handle object notification. More...

void Obsolete (const char *method, const char *asOfVers, const char *removedFromVers) const
Use this method to declare a method obsolete. More...

void operator delete (void *ptr)
Operator delete. More...

void operator delete[] (void *ptr)
Operator delete []. More...

void * operator new (size_t sz)

void * operator new (size_t sz, void *vp)

void * operator new[] (size_t sz)

void * operator new[] (size_t sz, void *vp)

TObjectoperator= (const TObject &rhs)
TObject assignment operator. More...

virtual void Paint (Option_t *option="")
This method must be overridden if a class wants to paint itself. More...

virtual void Pop ()
Pop on object drawn in a pad to the top of the display list. More...

virtual void Print (Option_t *option="") const
This method must be overridden when a class wants to print itself. More...

virtual Int_t Read (const char *name)
Read contents of object with specified name from the current directory. More...

virtual void RecursiveRemove (TObject *obj)
Recursively remove this object from a list. More...

void ResetBit (UInt_t f)

virtual void SaveAs (const char *filename="", Option_t *option="") const
Save this object in the file specified by filename. More...

virtual void SavePrimitive (std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out". More...

void SetBit (UInt_t f)

void SetBit (UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f. More...

virtual void SetDrawOption (Option_t *option="")
Set drawing option for object. More...

virtual void SetUniqueID (UInt_t uid)
Set the unique object id. More...

virtual void Streamer (TBuffer &)
Stream an object of class TObject. More...

void StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b)

virtual void SysError (const char *method, const char *msgfmt,...) const
Issue system error message. More...

R__ALWAYS_INLINE Bool_t TestBit (UInt_t f) const

Int_t TestBits (UInt_t f) const

virtual void UseCurrentStyle ()
Set current style settings in this object This function is called when either TCanvas::UseCurrentStyle or TROOT::ForceStyle have been invoked. More...

virtual void Warning (const char *method, const char *msgfmt,...) const
Issue warning message. More...

virtual Int_t Write (const char *name=nullptr, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory. More...

virtual Int_t Write (const char *name=nullptr, Int_t option=0, Int_t bufsize=0) const
Write this object to the current directory. More...

## Static Public Member Functions

static TClassClass ()

static const char * Class_Name ()

static Version_t Class_Version ()

static const char * DeclFileName ()

Static Public Member Functions inherited from TObject
static TClassClass ()

static const char * Class_Name ()

static Version_t Class_Version ()

static const char * DeclFileName ()

static Longptr_t GetDtorOnly ()
Return destructor only flag. More...

static Bool_t GetObjectStat ()
Get status of object stat flag. More...

static void SetDtorOnly (void *obj)
Set destructor only flag. More...

static void SetObjectStat (Bool_t stat)
Turn on/off tracking of objects in the TObjectTable. More...

## Protected Member Functions

TGTextLayout (const TGTextLayout &tlayout)=delete

void operator= (const TGTextLayout &tlayout)=delete

Protected Member Functions inherited from TObject
virtual void DoError (int level, const char *location, const char *fmt, va_list va) const
Interface to ErrorHandler (protected). More...

void MakeZombie ()

## Protected Attributes

LayoutChunk_tfChunks
Array of chunks. The actual size will be maxChunks. More...

const TGFontfFont
The font used when laying out the text. More...

Int_t fNumChunks
Number of chunks actually used in following array. More...

const char * fString
The string that was laid out. More...

Int_t fWidth
The maximum width of all lines in the text layout. More...

## Friends

class TGFont

Public Types inherited from TObject
enum  {
kIsOnHeap = 0x01000000 , kNotDeleted = 0x02000000 , kZombie = 0x04000000 , kInconsistent = 0x08000000 ,
}

enum  { kSingleKey = (1ULL << ( 0 )) , kOverwrite = (1ULL << ( 1 )) , kWriteDelete = (1ULL << ( 2 )) }

enum  EDeprecatedStatusBits { kObjInCanvas = (1ULL << ( 3 )) }

enum  EStatusBits {
kCanDelete = (1ULL << ( 0 )) , kMustCleanup = (1ULL << ( 3 )) , kIsReferenced = (1ULL << ( 4 )) , kHasUUID = (1ULL << ( 5 )) ,
kCannotPick = (1ULL << ( 6 )) , kNoContextMenu = (1ULL << ( 8 )) , kInvalidObject = (1ULL << ( 13 ))
}

Protected Types inherited from TObject
enum  { kOnlyPrepStep = (1ULL << ( 3 )) }

#include <TGFont.h>

Inheritance diagram for TGTextLayout:
[legend]

## ◆ TGTextLayout() [1/2]

 TGTextLayout::TGTextLayout ( const TGTextLayout & tlayout )
protecteddelete

## ◆ TGTextLayout() [2/2]

 TGTextLayout::TGTextLayout ( )
inline

Definition at line 121 of file TGFont.h.

## ◆ ~TGTextLayout()

 TGTextLayout::~TGTextLayout ( )
virtual

destructor

Definition at line 900 of file TGFont.cxx.

## ◆ CharBbox()

 Int_t TGTextLayout::CharBbox ( Int_t index, Int_t * x, Int_t * y, Int_t * w, Int_t * h ) const

Use the information in the TGTextLayout token to return the bounding box for the character specified by index.

The width of the bounding box is the advance width of the character, and does not include and left- or right-bearing. Any character that extends partially outside of the text layout is considered to be truncated at the edge. Any character which is located completely outside of the text layout is considered to be zero-width and pegged against the edge.

The height of the bounding box is the line height for this font, extending from the top of the ascent to the bottom of the descent. Information about the actual height of the individual letter is not available.

A text layout that contains no characters is considered to contain a single zero-width placeholder character.

The return value is 0 if the index did not specify a character in the text layout, or non-zero otherwise. In that case, *bbox is filled with the bounding box of the character.

layout – Layout information, from a previous call to ComputeTextLayout(). index – The index of the character whose bbox is desired. x, y – Filled with the upper-left hand corner, in pixels, of the bounding box for the character specified by index, if non-NULL. w, h – Filled with the width and height of the bounding box for the character specified by index, if non-NULL.

Definition at line 1109 of file TGFont.cxx.

## ◆ Class()

 static TClass * TGTextLayout::Class ( )
static
Returns
TClass describing this class

## ◆ Class_Name()

 static const char * TGTextLayout::Class_Name ( )
static
Returns
Name of this class

## ◆ Class_Version()

 static Version_t TGTextLayout::Class_Version ( )
inlinestatic
Returns
Version of this class

Definition at line 134 of file TGFont.h.

## ◆ DeclFileName()

 static const char * TGTextLayout::DeclFileName ( )
inlinestatic
Returns
Name of the file containing the class declaration

Definition at line 134 of file TGFont.h.

## ◆ DistanceToText()

 Int_t TGTextLayout::DistanceToText ( Int_t x, Int_t y ) const

Computes the distance in pixels from the given point to the given text layout.

Non-displaying space characters that occur at the end of individual lines in the text layout are ignored for hit detection purposes.

The return value is 0 if the point (x, y) is inside the text layout. If the point isn't inside the text layout then the return value is the distance in pixels from the point to the text item.

x, y – Coordinates of point to check, with respect to the upper-left corner of the text layout (in pixels).

Definition at line 1191 of file TGFont.cxx.

## ◆ DrawText()

 void TGTextLayout::DrawText ( Drawable_t dst, GContext_t gc, Int_t x, Int_t y, Int_t firstChar, Int_t lastChar ) const

Use the information in the TGTextLayout object to display a multi-line, justified string of text.

This procedure is useful for simple widgets that need to display single-font, multi-line text and want TGFont to handle the details.

dst – Window or pixmap in which to draw. gc – Graphics context to use for drawing text. x, y – Upper-left hand corner of rectangle in which to draw (pixels). firstChar – The index of the first character to draw from the given text item. 0 specfies the beginning. lastChar – The index just after the last character to draw from the given text item. A number < 0 means to draw all characters.

Definition at line 923 of file TGFont.cxx.

## ◆ IntersectText()

 Int_t TGTextLayout::IntersectText ( Int_t x, Int_t y, Int_t w, Int_t h ) const

Determines whether a text layout lies entirely inside, entirely outside, or overlaps a given rectangle.

Non-displaying space characters that occur at the end of individual lines in the text layout are ignored for intersection calculations.

The return value is -1 if the text layout is entirely outside of the rectangle, 0 if it overlaps, and 1 if it is entirely inside of the rectangle.

x, y – Upper-left hand corner, in pixels, of rectangular area to compare with text layout. Coordinates are with respect to the upper-left hand corner of the text layout itself. w, h – The width and height of the above rectangular area, in pixels.

Definition at line 1257 of file TGFont.cxx.

## ◆ IsA()

 TClass * TGTextLayout::IsA ( ) const
inlineoverridevirtual
Returns
TClass describing current object

Reimplemented from TObject.

Definition at line 134 of file TGFont.h.

## ◆ operator=()

 void TGTextLayout::operator= ( const TGTextLayout & tlayout )
protecteddelete

## ◆ PointToChar()

 Int_t TGTextLayout::PointToChar ( Int_t x, Int_t y ) const

Use the information in the TGTextLayout token to determine the character closest to the given point.

The point must be specified with respect to the upper-left hand corner of the text layout, which is considered to be located at (0, 0).

Any point whose y-value is less that 0 will be considered closest to the first character in the text layout; any point whose y-value is greater than the height of the text layout will be considered closest to the last character in the text layout.

Any point whose x-value is less than 0 will be considered closest to the first character on that line; any point whose x-value is greater than the width of the text layout will be considered closest to the last character on that line.

The return value is the index of the character that was closest to the point. Given a text layout with no characters, the value 0 will always be returned, referring to a hypothetical zero-width placeholder character.

Definition at line 1003 of file TGFont.cxx.

## ◆ Streamer()

 void TGTextLayout::Streamer ( TBuffer & R__b )
overridevirtual

Stream an object of class TObject.

Reimplemented from TObject.

## ◆ StreamerNVirtual()

 void TGTextLayout::StreamerNVirtual ( TBuffer & ClassDef_StreamerNVirtual_b )
inline

Definition at line 134 of file TGFont.h.

## ◆ ToPostscript()

 void TGTextLayout::ToPostscript ( TString * result ) const

Outputs the contents of a text layout in Postscript format.

The set of lines in the text layout will be rendered by the user supplied Postscript function. The function should be of the form:

justify x y string  function  --


Justify is -1, 0, or 1, depending on whether the following string should be left, center, or right justified, x and y is the location for the origin of the string, string is the sequence of characters to be printed, and function is the name of the caller-provided function; the function should leave nothing on the stack.

The meaning of the origin of the string (x and y) depends on the justification. For left justification, x is where the left edge of the string should appear. For center justification, x is where the center of the string should appear. And for right justification, x is where the right edge of the string should appear. This behavior is necessary because, for example, right justified text on the screen is justified with screen metrics. The same string needs to be justified with printer metrics on the printer to appear in the correct place with respect to other similarly justified strings. In all circumstances, y is the location of the baseline for the string.

result is modified to hold the Postscript code that will render the text layout.

Definition at line 1334 of file TGFont.cxx.

## ◆ UnderlineChar()

 void TGTextLayout::UnderlineChar ( Drawable_t dst, GContext_t gc, Int_t x, Int_t y, Int_t underline ) const

Use the information in the TGTextLayout object to display an underline below an individual character.

This procedure does not draw the text, just the underline.

This procedure is useful for simple widgets that need to display single-font, multi-line text with an individual character underlined and want TGFont to handle the details. To display larger amounts of underlined text, construct and use an underlined font.

dst – Window or pixmap in which to draw. gc – Graphics context to use for drawing text. x, y – Upper-left hand corner of rectangle in which to draw (pixels). underline – Index of the single character to underline, or -1 for no underline.

Definition at line 970 of file TGFont.cxx.

## ◆ TGFont

 friend class TGFont
friend

Definition at line 108 of file TGFont.h.

## ◆ fChunks

 LayoutChunk_t* TGTextLayout::fChunks
protected

Array of chunks. The actual size will be maxChunks.

Definition at line 115 of file TGFont.h.

## ◆ fFont

 const TGFont* TGTextLayout::fFont
protected

The font used when laying out the text.

Definition at line 111 of file TGFont.h.

## ◆ fNumChunks

 Int_t TGTextLayout::fNumChunks
protected

Number of chunks actually used in following array.

Definition at line 114 of file TGFont.h.

## ◆ fString

 const char* TGTextLayout::fString
protected

The string that was laid out.

Definition at line 112 of file TGFont.h.

## ◆ fWidth

 Int_t TGTextLayout::fWidth
protected

The maximum width of all lines in the text layout.

Definition at line 113 of file TGFont.h.

Libraries for TGTextLayout:
[legend]

The documentation for this class was generated from the following files: