12 #ifndef ROOT_TGLFontManager
13 #define ROOT_TGLFontManager
30 kTexture, kOutline, kPolygon, kExtrude
33 enum ETextAlignH_e { kLeft, kRight, kCenterH };
34 enum ETextAlignV_e { kBottom, kTop, kCenterV };
37 TGLFont& operator=(
const TGLFont& o);
40 TGLFontManager *fManager;
45 void RenderHelper(
const Char *txt, Double_t x, Double_t y, Double_t angle, Double_t )
const;
52 mutable Int_t fTrashCount;
55 TGLFont(Int_t size, Int_t font, EMode mode, FTFont *f=0, TGLFontManager *mng=0);
56 TGLFont(
const TGLFont& o);
59 void CopyAttributes(
const TGLFont &o);
61 Int_t GetSize()
const {
return fSize;}
62 Int_t GetFile()
const {
return fFile;}
63 EMode GetMode()
const {
return fMode;}
65 Int_t GetTrashCount()
const {
return fTrashCount; }
66 void SetTrashCount(Int_t c)
const { fTrashCount = c; }
67 Int_t IncTrashCount()
const {
return ++fTrashCount; }
69 void SetFont(FTFont *f) { fFont =f;}
70 const FTFont* GetFont()
const {
return fFont; }
71 void SetManager(TGLFontManager *mng) { fManager = mng; }
72 const TGLFontManager* GetManager()
const {
return fManager; }
74 Float_t GetDepth()
const {
return fDepth; }
75 void SetDepth(Float_t d) { fDepth = d; }
78 Float_t GetAscent()
const;
79 Float_t GetDescent()
const;
80 Float_t GetLineHeight()
const;
81 void MeasureBaseLineParams(Float_t& ascent, Float_t& descent, Float_t& line_height,
82 const char* txt=
"Xj")
const;
84 void BBox(
const char* txt,
85 Float_t& llx, Float_t& lly, Float_t& llz,
86 Float_t& urx, Float_t& ury, Float_t& urz)
const;
87 void BBox(
const wchar_t* txt,
88 Float_t& llx, Float_t& lly, Float_t& llz,
89 Float_t& urx, Float_t& ury, Float_t& urz)
const;
91 void Render(
const char* txt, Double_t x, Double_t y, Double_t angle, Double_t mgn)
const;
92 void Render(
const wchar_t* txt, Double_t x, Double_t y, Double_t angle, Double_t mgn)
const;
93 void Render(
const TString &txt)
const;
94 void Render(
const TString &txt, Float_t x, Float_t y, Float_t z, ETextAlignH_e alignH, ETextAlignV_e alignV)
const;
97 virtual void PreRender(Bool_t autoLight=kTRUE, Bool_t lightOn=kFALSE)
const;
98 virtual void PostRender()
const;
100 Bool_t operator< (
const TGLFont& o)
const
102 if (fSize == o.fSize)
106 return fMode < o.fMode;
108 return fFile < o.fFile;
110 return fSize < o.fSize;
113 ClassDef(TGLFont, 0);
122 typedef std::vector<Int_t> FontSizeVec_t;
125 TGLFontManager(
const TGLFontManager&);
126 TGLFontManager& operator=(
const TGLFontManager&);
129 typedef std::map<TGLFont, Int_t> FontMap_t;
130 typedef std::map<TGLFont, Int_t>::iterator FontMap_i;
132 typedef std::list<const TGLFont*> FontList_t;
133 typedef std::list<const TGLFont*>::iterator FontList_i;
134 typedef std::list<const TGLFont*>::const_iterator FontList_ci;
137 FontList_t fFontTrash;
139 static TObjArray fgFontFileArray;
141 static Int_t fgExtendedFontStart;
143 static FontSizeVec_t fgFontSizeArray;
144 static Bool_t fgStaticInitDone;
145 static void InitStatics();
148 TGLFontManager() : fFontMap(), fFontTrash() {}
149 virtual ~TGLFontManager();
151 void RegisterFont(Int_t size, Int_t file, TGLFont::EMode mode, TGLFont& out);
152 void RegisterFont(Int_t size,
const char* name, TGLFont::EMode mode, TGLFont& out);
153 void ReleaseFont(TGLFont& font);
155 static TObjArray* GetFontFileArray();
156 static FontSizeVec_t* GetFontSizeArray();
158 static Int_t GetExtendedFontStartIndex();
159 static Int_t GetFontSize(Int_t ds);
160 static Int_t GetFontSize(Int_t ds, Int_t min, Int_t max);
161 static const char* GetFontNameFromId(Int_t);
163 void ClearFontTrash();
165 ClassDef(TGLFontManager, 0);