ROOT » GUI » GUI » TGTextLayout

class TGTextLayout: public TObject


TGFont and TGFontPool

Encapsulate fonts used in the GUI system.
TGFontPool provides a pool of fonts.
TGTextLayout is used to keep track of string  measurement
information when  using the text layout facilities.
It can be displayed with respect to any origin.


Function Members (Methods)

public:
virtual~TGTextLayout()
voidTObject::AbstractMethod(const char* method) const
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidTObject::Browse(TBrowser* b)
Int_tCharBbox(Int_t index, Int_t* x, Int_t* y, Int_t* w, Int_t* h) const
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTObject::Clear(Option_t* = "")
virtual TObject*TObject::Clone(const char* newname = "") const
virtual Int_tTObject::Compare(const TObject* obj) const
virtual voidTObject::Copy(TObject& object) const
virtual voidTObject::Delete(Option_t* option = "")MENU
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
Int_tDistanceToText(Int_t x, Int_t y) const
virtual voidTObject::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
voidDrawText(Drawable_t dst, GContext_t gc, Int_t x, Int_t y, Int_t firstChar, Int_t lastChar) const
virtual voidTObject::Dump() constMENU
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual const char*TObject::GetIconName() const
virtual const char*TObject::GetName() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
virtual const char*TObject::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTObject::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() constMENU
Int_tIntersectText(Int_t x, Int_t y, Int_t w, Int_t h) const
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTObject::IsSortable() const
Bool_tTObject::IsZombie() const
virtual voidTObject::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
virtual Bool_tTObject::Notify()
voidTObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const
voidTObject::operator delete(void* ptr)
voidTObject::operator delete(void* ptr, void* vp)
voidTObject::operator delete[](void* ptr)
voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
virtual voidTObject::Paint(Option_t* option = "")
Int_tPointToChar(Int_t x, Int_t y) const
virtual voidTObject::Pop()
virtual voidTObject::Print(Option_t* option = "") const
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTObject::SavePrimitive(ostream& out, Option_t* option = "")
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidShowMembers(TMemberInspector& insp) const
virtual voidStreamer(TBuffer&)
voidStreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
TGTextLayout()
voidToPostscript(TString* dst) const
voidUnderlineChar(Drawable_t dst, GContext_t gc, Int_t x, Int_t y, Int_t underline) const
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
protected:
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidTObject::MakeZombie()
voidoperator=(const TGTextLayout& tlayout)
TGTextLayout(const TGTextLayout& tlayout)

Data Members

public:
static TObject::<anonymous>TObject::kBitMask
static TObject::EStatusBitsTObject::kCanDelete
static TObject::EStatusBitsTObject::kCannotPick
static TObject::EStatusBitsTObject::kHasUUID
static TObject::EStatusBitsTObject::kInvalidObject
static TObject::<anonymous>TObject::kIsOnHeap
static TObject::EStatusBitsTObject::kIsReferenced
static TObject::EStatusBitsTObject::kMustCleanup
static TObject::EStatusBitsTObject::kNoContextMenu
static TObject::<anonymous>TObject::kNotDeleted
static TObject::EStatusBitsTObject::kObjInCanvas
static TObject::<anonymous>TObject::kOverwrite
static TObject::<anonymous>TObject::kSingleKey
static TObject::<anonymous>TObject::kWriteDelete
static TObject::<anonymous>TObject::kZombie
protected:
LayoutChunk_t*fChunksArray of chunks. The actual size will be maxChunks.
const TGFont*fFontThe font used when laying out the text.
Int_tfNumChunksNumber of chunks actually used in following array.
const char*fStringThe string that was layed out.
Int_tfWidthThe maximum width of all lines in the text layout.

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

~TGTextLayout()
 destructor
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.

 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.
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. 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.
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. 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.
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.

 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.
Int_t 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).
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. 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.
void ToPostscript(TString* dst) 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.
FontAttributes_t& operator=(const TGTextLayout& tlayout)
TGTextLayout(const TGTextLayout& tlayout)
TGTextLayout()
{}