TGX11TTF


class description - source file - inheritance tree

class TGX11TTF : public TGX11

    private:
void Align(UInt_t w, UInt_t h, Int_t maxAscent, Int_t& x, Int_t& y) void AlignRotated(UInt_t w, UInt_t h, Int_t xoff, Int_t yoff, Int_t& x, Int_t& y) TTChar* AllocChar(UInt_t code, UInt_t size, const char* fontname) TTChar* AllocRotatedChar(UInt_t code, UInt_t size, Float_t angle, const char* fontname) Short_t CharToUnicode(UInt_t code) void ClearCache() void DrawImage(TTChar* c, ULong_t fore, ULong_t back, XImage* xim, Int_t bx, Int_t by) void DrawRotatedText(Int_t x, Int_t y, Float_t angle, const char* text, TVirtualX::ETextMode mode) XImage* GetBackground(Int_t x, Int_t y, UInt_t w, UInt_t h) TTChar* GetChar(UInt_t code, UInt_t size, Float_t angle, Bool_t force = kTRUE) void GetRotatedTextExtent(UInt_t& w, UInt_t& h, Int_t& xoff, Int_t& yoff, Float_t angle, const char* text) void GetTextExtent(UInt_t& w, UInt_t& h, Int_t& maxAscent, const char* text) Bool_t IsVisible(Int_t x, Int_t y, UInt_t w, UInt_t h) Int_t LoadTrueTypeChar(Int_t idx) TTChar* LookupChar(UInt_t code, UInt_t size, Float_t angle, const char* fontname) void SetRotationMatrix(Float_t angle) public:
TGX11TTF TGX11TTF() TGX11TTF TGX11TTF(const TGX11& org) TGX11TTF TGX11TTF(const TGX11TTF&) virtual void ~TGX11TTF() static TClass* Class() virtual void DrawText(Int_t x, Int_t y, Float_t angle, Float_t mgn, const char* text, TVirtualX::ETextMode mode) Int_t GetCacheCount() const Int_t GetCacheHits() const Int_t GetCacheMisses() const Bool_t GetHinting() const Bool_t GetSmoothing() const virtual void GetTextExtent(UInt_t& w, UInt_t& h, char* text) virtual TClass* IsA() const void SetHinting(Bool_t state) void SetSmoothing(Bool_t state) virtual Int_t SetTextFont(char* fontname, TVirtualX::ETextSetMode mode) virtual void SetTextFont(Font_t fontnumber) virtual void SetTextSize(Float_t textsize) virtual void ShowMembers(TMemberInspector& insp, char* parent) virtual void Streamer(TBuffer& b) void StreamerNVirtual(TBuffer& b)

Data Members

    private:
Int_t fFontCount number of fonts loaded Int_t fCurFontIdx current font index char* fFontName[32] font name TT_Face_Properties* fProperties[32] font properties TT_Face* fFace[32] font face TT_Glyph* fGlyph[32] font glyph TT_Instance* fInstance[32] font instance TT_CharMap* fCharMap[32] font character map TT_Engine* fEngine TrueType font renderer TT_Matrix* fRotMatrix rotation matrix Int_t fCacheCount number of chars in cache Int_t fCacheHits number of cache hits Int_t fCacheMisses number of cache misses THashTable* fCharCache character cache TList* fLRU Least Recent Used chars Bool_t fHinting use hinting (true by default) Bool_t fSmoothing use anti-aliasing (true when >8 planes, false otherwise) public:
static const enum TObject:: kTTMaxFonts static const enum TObject:: kCacheSize static const enum TObject:: kHashSize static const TGX11TTF::EAlign kNone static const TGX11TTF::EAlign kTLeft static const TGX11TTF::EAlign kTCenter static const TGX11TTF::EAlign kTRight static const TGX11TTF::EAlign kMLeft static const TGX11TTF::EAlign kMCenter static const TGX11TTF::EAlign kMRight static const TGX11TTF::EAlign kBLeft static const TGX11TTF::EAlign kBCenter static const TGX11TTF::EAlign kBRight

Class Description

                                                                      
 TGX11TTF                                                             
                                                                      
 Interface to low level X11 (Xlib). This class gives access to basic  
 X11 graphics via the parent class TGX11. However, all text and font  
 handling is done via the Freetype TrueType library. When the         
 shared library containing this class is loaded the global gVirtualX  
 is redirected to point to this class.                                
                                                                      


TGX11TTF(const TGX11 &org) : TGX11(org)
 Create copy of TGX11 but now use TrueType fonts.

~TGX11TTF()
 Cleanup.

void ClearCache()
 Clear TTChar cache.

void Align(UInt_t w, UInt_t, Int_t ascent, Int_t &x, Int_t &y)
 Change x,y position depending on required alignment.

void AlignRotated(UInt_t w, UInt_t, Int_t, Int_t yoff, Int_t &x, Int_t &y)
 Change x,y position or rotated text depending on required alignment.

void DrawText(Int_t x, Int_t y, Float_t angle, Float_t mgn, const char *text, ETextMode mode)
 Draw text using TrueType fonts.

void DrawRotatedText(Int_t x, Int_t y, Float_t angle, const char *text, ETextMode mode)
 Draw rotated text using TrueType fonts.

void GetTextExtent(UInt_t &w, UInt_t &h, Int_t &maxAscent, const char *text)
 Get bounding box of text, returns also the maximum ascent
 in the string. This is used to position the string (at y-maxAscent).
 Private interface.

void GetRotatedTextExtent(UInt_t &w, UInt_t &h, Int_t &xoff, Int_t &yoff, Float_t angle, const char *text)
 Get bounding box of rotated text, returns also the maximum descent
 in the string. This is used to position the string. Private interface.

void GetTextExtent(UInt_t &w, UInt_t &h, char *text)
 Get bounding box of text.

Int_t SetTextFont(char *fontname, ETextSetMode mode)
 Set text font to specified name.
 mode       : loading flag
 mode=0     : search if the font exist (kCheck)
 mode=1     : search the font and load it if it exists (kLoad)
 font       : font name

 Set text font to specified name. This function returns 0 if
 the specified font is found, 1 if not.

void SetTextFont(Font_t fontnumber)
 Set specified font.
 List of the currently supported fonts (screen and PostScript)
 =============================================================
   Font ID       X11                        TTF
        1 : times-medium-i-normal       timesi.ttf
        2 : times-bold-r-normal         timesbd.ttf
        3 : times-bold-i-normal         timesi.ttf
        4 : helvetica-medium-r-normal   arial.ttf
        5 : helvetica-medium-o-normal   ariali.ttf
        6 : helvetica-bold-r-normal     arialbd.ttf
        7 : helvetica-bold-o-normal     arialbi.ttf
        8 : courier-medium-r-normal     cour.ttf
        9 : courier-medium-o-normal     couri.ttf
       10 : courier-bold-r-normal       courbd.ttf
       11 : courier-bold-o-normal       courbi.ttf
       12 : symbol-medium-r-normal      symbol.ttf
       13 : times-medium-r-normal       times.ttf
       14 :                             wingding.ttf

void SetTextSize(Float_t textsize)
 Set current text size.

TTChar* GetChar(UInt_t code, UInt_t size, Float_t angle, Bool_t force)
 Get a TTChar corresponding to the char code, size and current font.
 If force is true (the default) and the cache is full the lru char
 will be removed from the cache. If false it returns 0.

TTChar* LookupChar(UInt_t code, UInt_t size, Float_t angle, const char *fontname)
 Find TTChar corresponding to the char code, size and font in cache.
 Returns 0 if not in cache.

TTChar* AllocChar(UInt_t code, UInt_t size, const char *fontname)
 Allocate a TTChar object corresponding to the char code, size and font.
 TTChar is added to the cache for later reuse. In case of failure
 return 0.

TTChar* AllocRotatedChar(UInt_t code, UInt_t size, Float_t angle, const char *fontname)
 Allocate a TTChar object corresponding to the char code, size, angle
 and font. TTChar is added to the cache for later reuse. In case of failure
 return 0.

Short_t CharToUnicode(UInt_t code)
 Map char to unicode. Returns 0 in case no mapping exists.

Int_t LoadTrueTypeChar(Int_t idx)
 Load the True Type character.

XImage* GetBackground(Int_t x, Int_t y, UInt_t w, UInt_t h)
 Get the background of the current window in an XImage.

Bool_t IsVisible(Int_t x, Int_t y, UInt_t w, UInt_t h)
 If string falls outside window, there is probably no need to draw it.

void DrawImage(TTChar *c, ULong_t fore, ULong_t back, XImage *xim, Int_t bx, Int_t by)
 Draw TTChar bitmap to xim image at position bx,by using specified
 foreground color.

void SetRotationMatrix(Float_t angle)
 Set the rotation matrix used to rotate the font outlines.

void SetHinting(Bool_t state)
 Set hinting flag. If status changes clear cache.

void SetSmoothing(Bool_t state)
 Set smoothing (anit-aliasing) flag. If status changes clear cache.



Inline Functions


           TGX11TTF TGX11TTF(const TGX11& org)
              Int_t GetCacheCount() const
              Int_t GetCacheHits() const
              Int_t GetCacheMisses() const
             Bool_t GetHinting() const
             Bool_t GetSmoothing() const
            TClass* Class()
            TClass* IsA() const
               void ShowMembers(TMemberInspector& insp, char* parent)
               void Streamer(TBuffer& b)
               void StreamerNVirtual(TBuffer& b)
           TGX11TTF TGX11TTF(const TGX11TTF&)


Author: Fons Rademakers 21/11/98
Last update: root/x11ttf:$Name: $:$Id: TGX11TTF.cxx,v 1.7 2002/08/23 14:49:23 rdm Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *


ROOT page - Class index - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.