ROOT logo

class TGFont: public TNamed, public TRefCnt

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)

voidTObject::AbstractMethod(const char* method) const
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidTObject::Browse(TBrowser* b)
static TClass*Class()
static TClass*TNamed::Class()
static TClass*TObject::Class()
virtual const char*TObject::ClassName() const
virtual voidTNamed::Clear(Option_t* option = "")
virtual voidTObject::Clear(Option_t* = "")
virtual TObject*TNamed::Clone(const char* newname = "") const
virtual TObject*TObject::Clone(const char* newname = "") const
virtual Int_tTNamed::Compare(const TObject* obj) const
virtual Int_tTObject::Compare(const TObject* obj) const
TGTextLayout*ComputeTextLayout(const char* string, Int_t numChars, Int_t wrapLength, Int_t justify, Int_t flags, UInt_t* width, UInt_t* height) const
virtual voidTNamed::Copy(TObject& named) const
virtual voidTObject::Copy(TObject& object) const
virtual voidTObject::Delete(Option_t* option = "")MENU
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTObject::Draw(Option_t* option = "")
voidDrawChars(Drawable_t dst, GContext_t gc, const char* source, Int_t numChars, Int_t x, Int_t y) const
voidDrawCharsExp(Drawable_t dst, GContext_t gc, const char* source, Int_t numChars, Int_t x, Int_t y) const
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
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 voidTNamed::FillBuffer(char*& buffer)
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()
FontAttributes_tGetFontAttributes() const
FontH_tGetFontHandle() const
voidGetFontMetrics(FontMetrics_t* m) const
FontStruct_tGetFontStruct() const
virtual const char*TObject::GetIconName() const
virtual const char*TNamed::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*TNamed::GetTitle() const
virtual const char*TObject::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTNamed::Hash() const
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
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual TClass*TNamed::IsA() const
virtual TClass*TObject::IsA() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTNamed::IsSortable() const
virtual Bool_tTObject::IsSortable() const
Bool_tTObject::IsZombie() const
virtual voidTNamed::ls(Option_t* option = "") const
virtual voidTObject::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
Int_tMeasureChars(const char* source, Int_t numChars, Int_t maxLength, Int_t flags, Int_t* length) const
virtual Bool_tTObject::Notify()
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static 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)
FontStruct_toperator()() const
TRefCnt&TRefCnt::operator=(const TRefCnt&)
TNamed&TNamed::operator=(const TNamed& rhs)
TObject&TObject::operator=(const TObject& rhs)
virtual voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
Int_tPostscriptFontName(TString* dst) const
virtual voidPrint(Option_t* option = "") const
virtual voidTNamed::Print(Option_t* option = "") const
virtual voidTObject::Print(Option_t* option = "") const
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
UInt_tTRefCnt::References() const
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidSavePrimitive(ostream& out, Option_t* = "")
virtual voidTObject::SavePrimitive(basic_ostream<char,char_traits<char> >& 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)
virtual voidTNamed::SetName(const char* name)MENU
virtual voidTNamed::SetNameTitle(const char* name, const char* title)
static voidTObject::SetObjectStat(Bool_t stat)
voidTRefCnt::SetRefCount(UInt_t r)
virtual voidTNamed::SetTitle(const char* title = "")MENU
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidShowMembers(TMemberInspector& insp, char* parent)
virtual voidTNamed::ShowMembers(TMemberInspector& insp, char* parent)
virtual voidTObject::ShowMembers(TMemberInspector& insp, char* parent)
virtual Int_tTNamed::Sizeof() const
virtual voidStreamer(TBuffer& b)
virtual voidTNamed::Streamer(TBuffer& b)
virtual voidTObject::Streamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
voidTNamed::StreamerNVirtual(TBuffer& b)
voidTObject::StreamerNVirtual(TBuffer& 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
Int_tTextHeight() const
Int_tTextWidth(const char* string, Int_t numChars = -1) const
voidUnderlineChars(Drawable_t dst, GContext_t gc, const char* string, Int_t x, Int_t y, Int_t firstChar, Int_t lastChar) 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
Int_tXTextWidth(const char* string, Int_t numChars = -1) const
TGFont(const char* name)
TGFont(const TGFont& font)
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
LayoutChunk_t*NewChunk(TGTextLayout* layout, int* maxPtr, const char* start, int numChars, int curX, int newX, int y) const
voidoperator=(const TGFont& font)

Data Members

enum TObject::EStatusBits { kCanDelete
enum TObject::[unnamed] { kIsOnHeap
enum TRefCnt::EReferenceFlag { kStaticInit
TStringTNamed::fNameobject identifier
UInt_tTRefCnt::fRefs(1 less than) number of references
TStringTNamed::fTitleobject title
Int_tfBarHeightHeight of underline or overstrike bar
FontAttributes_tfFAActual font attributes obtained when the font was created
FontMetrics_tfFMCached font metrics
FontH_tfFontHFont handle (derived from fontstruct)
FontStruct_tfFontStructLow level graphics fontstruct
TObjString*fNamedHashPointer to the named object TGFont was based on
Int_tfTabWidthWidth of tabs in this font (pixels).
charfTypes[256]Array giving types of all characters in
Int_tfUnderlineHeightHeight of underline bar (used for drawing
Int_tfUnderlinePosOffset from baseline to origin of underline bar
Int_tfWidths[256]Array giving widths of all possible characters in the font.

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

 Delete font.
void GetFontMetrics(FontMetrics_t* m) const
 Get font metrics.
FontStruct_t operator()() const
 Not inline due to a bug in g++ 2.96 20000731 (Red Hat Linux 7.0)
void Print(Option_t* option = "") const
 Print font info.
Int_t PostscriptFontName(TString* dst) const
 Return the name of the corresponding Postscript font for this TGFont.

 The return value is the pointsize of the TGFont. The name of the
 Postscript font is appended to ds.

 If the font does not exist on the printer, the print job will fail at
 print time. Given a "reasonable" Postscript printer, the following
 TGFont font families should print correctly:

     Avant Garde, Arial, Bookman, Courier, Courier New, Geneva,
     Helvetica, Monaco, New Century Schoolbook, New York,
     Palatino, Symbol, Times, Times New Roman, Zapf Chancery,
     and Zapf Dingbats.

 Any other TGFont font families may not print correctly because the
 computed Postscript font name may be incorrect.

 dst -- Pointer to an initialized TString object to which the name of the
        Postscript font that corresponds to the font will be appended.
Int_t MeasureChars(const char* source, Int_t numChars, Int_t maxLength, Int_t flags, Int_t* length) const
 Determine the number of characters from the string that will fit in the
 given horizontal span. The measurement is done under the assumption that
 DrawChars() will be used to actually display the characters.

 The return value is the number of characters from source that fit into
 the span that extends from 0 to maxLength. *length is filled with the
 x-coordinate of the right edge of the last character that did fit.

 source    -- Characters to be displayed. Need not be '\0' terminated.
 numChars  -- Maximum number of characters to consider from source string.
 maxLength -- If > 0, maxLength specifies the longest permissible line
              length; don't consider any character that would cross this
              x-position. If <= 0, then line length is unbounded and the
              flags argument is ignored.
 flags     -- Various flag bits OR-ed together:
              TEXT_PARTIAL_OK means include the last char which only
              partially fit on this line.
              TEXT_WHOLE_WORDS means stop on a word boundary, if possible.
              TEXT_AT_LEAST_ONE means return at least one character even
              if no characters fit.
 *length   -- Filled with x-location just after the terminating character.
Int_t TextWidth(const char* string, Int_t numChars = -1) const
 A wrapper function for the more complicated interface of MeasureChars.
 Computes how much space the given simple string needs.

 The return value is the width (in pixels) of the given string.

 string   -- String whose width will be computed.
 numChars -- Number of characters to consider from string, or < 0 for
Int_t XTextWidth(const char* string, Int_t numChars = -1) const
 Return text widht in pixels
void UnderlineChars(Drawable_t dst, GContext_t gc, const char* string, Int_t x, Int_t y, Int_t firstChar, Int_t lastChar) const
 This procedure draws an underline for a given range of characters in a
 given string. It doesn't draw the characters (which are assumed to have
 been displayed previously); it just draws the underline. This procedure
 would mainly be used to quickly underline a few characters without having
 to construct an underlined font. To produce properly underlined text, the
 appropriate underlined font should be constructed and used.

 dst       -- Window or pixmap in which to draw.
 gc        -- Graphics context for actually drawing line.
 string    -- String containing characters to be underlined or overstruck.
 x, y      -- Coordinates at which first character of string is drawn.
 firstChar -- Index of first character.
 lastChar  -- Index of one after the last character.
TGTextLayout * ComputeTextLayout(const char* string, Int_t numChars, Int_t wrapLength, Int_t justify, Int_t flags, UInt_t* width, UInt_t* height) const
 Computes the amount of screen space needed to display a multi-line,
 justified string of text. Records all the measurements that were done
 to determine to size and positioning of the individual lines of text;
 this information can be used by the TGTextLayout::DrawText() procedure
 to display the text quickly (without remeasuring it).

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

 The return value is a TGTextLayout token that holds the measurement
 information for the given string. The token is only valid for the given
 string. If the string is freed, the token is no longer valid and must
 also be deleted.

 The dimensions of the screen area needed to display the text are stored
 in *width and *height.

 string     -- String whose dimensions are to be computed.
 numChars   -- Number of characters to consider from string, or < 0 for
 wrapLength -- Longest permissible line length, in pixels. <= 0 means no
               automatic wrapping: just let lines get as long as needed.
 justify    -- How to justify lines.
 flags      -- Flag bits OR-ed together. kTextIgnoreTabs means that tab
               characters should not be expanded. kTextIgnoreNewlines
               means that newline characters should not cause a line break.
 width      -- Filled with width of string.
 height     -- Filled with height of string.
LayoutChunk_t * NewChunk(TGTextLayout* layout, int* maxPtr, const char* start, int numChars, int curX, int newX, int y) const
 Helper function for ComputeTextLayout(). Encapsulates a measured set of
 characters in a chunk that can be quickly drawn.

 Returns a pointer to the new chunk in the text layout. The text layout is
 reallocated to hold more chunks as necessary.

 Currently, ComputeTextLayout() stores contiguous ranges of "normal"
 characters in a chunk, along with individual tab and newline chars in
 their own chunks. All characters in the text layout are accounted for.
void DrawCharsExp(Drawable_t dst, GContext_t gc, const char* source, Int_t numChars, Int_t x, Int_t y) const
 Draw a string of characters on the screen. DrawCharsExp() expands
 control characters that occur in the string to \X or \xXX sequences.
 DrawChars() just draws the strings.

 dst      -- Window or pixmap in which to draw.
 gc       -- Graphics context for drawing characters.
 source   -- Characters to be displayed. Need not be'\0' terminated.
             For DrawChars(), all meta-characters (tabs, control
             characters, and newlines) should be stripped out of the
             string that is passed to this function. If they are not
             stripped out, they will be displayed as regular printing
 numChars -- Number of characters in string.
 x, y     -- Coordinates at which to place origin of string when drawing.
void DrawChars(Drawable_t dst, GContext_t gc, const char* source, Int_t numChars, Int_t x, Int_t y) const
 Perform a quick sanity check to ensure we won't overflow the X
 coordinate space.
void SavePrimitive(ostream& out, Option_t* = "")
 Save the used font as a C++ statement(s) on output stream out.
FontAttributes_t& operator=(const TGFont& font)
TGFont(const char *name)
 (used for simulating a native underlined or strikeout font).
TGFont(const TGFont &font)
FontH_t GetFontHandle() const
{ return fFontH; }
FontStruct_t GetFontStruct() const
{ return fFontStruct; }
FontAttributes_t GetFontAttributes() const
{ return fFA; }
Int_t TextHeight() const
{ return fFM.fLinespace; }