Logo ROOT  
Reference Guide
TGLFontManager.cxx
Go to the documentation of this file.
1// @(#)root/gl:$Id$
2// Author: Alja Mrak-Tadel 2008
3
4/*************************************************************************
5 * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#include "Riostream.h"
13#include "RConfigure.h"
14#include "TGLFontManager.h"
15
16
17#include "TROOT.h"
18#include "TVirtualX.h"
19#include "TMath.h"
20#include "TSystem.h"
21#include "TEnv.h"
22#include "TObjString.h"
23#include "TGLUtil.h"
24#include "TGLIncludes.h"
25
26// Direct inclusion of FTGL headers is deprecated in ftgl-2.1.3 while
27// ftgl-2.1.2 shipped with ROOT requires manual inclusion.
28#ifndef BUILTIN_FTGL
29# include <FTGL/ftgl.h>
30#else
31# include "FTFont.h"
32# include "FTGLExtrdFont.h"
33# include "FTGLOutlineFont.h"
34# include "FTGLPolygonFont.h"
35# include "FTGLTextureFont.h"
36# include "FTGLPixmapFont.h"
37# include "FTGLBitmapFont.h"
38#endif
39
40
41/** \class TGLFont
42\ingroup opengl
43A wrapper class for FTFont.
44Holds pointer to FTFont object and its description: face size, font file
45and class ID. It wraps Render and BBox functions.
46*/
47
49
50////////////////////////////////////////////////////////////////////////////////
51/// Constructor.
52
54 fFont(0), fManager(0), fDepth(0),
55 fSize(0), fFile(0), fMode(kUndef),
56 fTrashCount(0)
57{
58}
59
60////////////////////////////////////////////////////////////////////////////////
61/// Constructor.
62
63TGLFont::TGLFont(Int_t size, Int_t font, EMode mode, FTFont* f, TGLFontManager* mng):
64 fFont(f), fManager(mng), fDepth(0),
65 fSize(size), fFile(font), fMode(mode),
66 fTrashCount(0)
67{
68}
69
70////////////////////////////////////////////////////////////////////////////////
71/// Assignment operator.
72
74 fFont(0), fManager(0), fDepth(0), fTrashCount(0)
75{
76 fFont = (FTFont*)o.GetFont();
77
78 fSize = o.fSize;
79 fFile = o.fFile;
80 fMode = o.fMode;
81
83}
84
85////////////////////////////////////////////////////////////////////////////////
86///Destructor
87
89{
90 if (fManager) fManager->ReleaseFont(*this);
91}
92
93////////////////////////////////////////////////////////////////////////////////
94/// Assignment operator.
95
97{
98 SetFont(o.fFont);
100
101 SetDepth(o.fDepth);
102
103 fSize = o.fSize;
104 fFile = o.fFile;
105 fMode = o.fMode;
106
108}
109
110
111/******************************************************************************/
112
113////////////////////////////////////////////////////////////////////////////////
114/// Get font's ascent.
115
117{
118 return fFont->Ascender();
119}
120
121////////////////////////////////////////////////////////////////////////////////
122/// Get font's descent. The returned value is positive.
123
125{
126 return -fFont->Descender();
127}
128
129////////////////////////////////////////////////////////////////////////////////
130/// Get font's line-height.
131
133{
134 return fFont->LineHeight();
135}
136
137////////////////////////////////////////////////////////////////////////////////
138/// Measure font's base-line parameters from the passed text.
139/// Note that the measured parameters are not the same as the ones
140/// returned by get-functions - those were set by the font designer.
141
142void TGLFont::MeasureBaseLineParams(Float_t& ascent, Float_t& descent, Float_t& line_height,
143 const char* txt) const
144{
145 Float_t dum, lly, ury;
146 const_cast<FTFont*>(fFont)->BBox(txt, dum, lly, dum, dum, ury, dum);
147 ascent = ury;
148 descent = -lly;
149 line_height = ury - lly;
150}
151
152////////////////////////////////////////////////////////////////////////////////
153/// Get bounding box.
154
155void TGLFont::BBox(const char* txt,
156 Float_t& llx, Float_t& lly, Float_t& llz,
157 Float_t& urx, Float_t& ury, Float_t& urz) const
158{
159 // FTGL is not const correct.
160 const_cast<FTFont*>(fFont)->BBox(txt, llx, lly, llz, urx, ury, urz);
161}
162
163////////////////////////////////////////////////////////////////////////////////
164/// Get bounding box.
165
166void TGLFont::BBox(const wchar_t* txt,
167 Float_t& llx, Float_t& lly, Float_t& llz,
168 Float_t& urx, Float_t& ury, Float_t& urz) const
169{
170 // FTGL is not const correct.
171 const_cast<FTFont*>(fFont)->BBox(txt, llx, lly, llz, urx, ury, urz);
172}
173
174////////////////////////////////////////////////////////////////////////////////
175///mgn is simply ignored, because ROOT's TVirtualX TGX11 are complete mess with
176///painting attributes.
177
178template<class Char>
179void TGLFont::RenderHelper(const Char *txt, Double_t x, Double_t y, Double_t angle, Double_t /*mgn*/) const
180{
181 glPushMatrix();
182 //glLoadIdentity();
183
184 // FTGL is not const correct.
185 Float_t llx = 0.f, lly = 0.f, llz = 0.f, urx = 0.f, ury = 0.f, urz = 0.f;
186 BBox(txt, llx, lly, llz, urx, ury, urz);
187
188 /*
189 V\H | left | center | right
190 _______________________________
191 bottom | 7 | 8 | 9
192 _______________________________
193 center | 4 | 5 | 6
194 _______________________________
195 top | 1 | 2 | 3
196 */
197 const Double_t dx = urx - llx, dy = ury - lly;
198 Double_t xc = 0., yc = 0.;
199 const UInt_t align = gVirtualX->GetTextAlign();
200
201 //Here's the nice X11 bullshido: you call gVirtualX->SetTextAlign(11),
202 //later gVirtualX->GetTextAling() will give you 7. Brilliant!
203 //But with Cocoa you'll have 11. As it should be, of course.
204
205 if (gVirtualX->InheritsFrom("TGCocoa")) {
206 const UInt_t hAlign = UInt_t(align / 10);
207 switch (hAlign) {
208 case 1:
209 xc = 0.5 * dx;
210 break;
211 case 2:
212 break;
213 case 3:
214 xc = -0.5 * dy;
215 break;
216 }
217
218 const UInt_t vAlign = UInt_t(align % 10);
219 switch (vAlign) {
220 case 1:
221 yc = 0.5 * dy;
222 break;
223 case 2:
224 break;
225 case 3:
226 yc = -0.5 * dy;
227 break;
228 }
229 } else {
230 switch (align) {
231 case 7:
232 xc += 0.5 * dx;
233 yc += 0.5 * dy;
234 break;
235 case 8:
236 yc += 0.5 * dy;
237 break;
238 case 9:
239 xc -= 0.5 * dx;
240 yc += 0.5 * dy;
241 break;
242 case 4:
243 xc += 0.5 * dx;
244 break;
245 case 5:
246 break;
247 case 6:
248 xc = -0.5 * dx;
249 break;
250 case 1:
251 xc += 0.5 * dx;
252 yc -= 0.5 * dy;
253 break;
254 case 2:
255 yc -= 0.5 * dy;
256 break;
257 case 3:
258 xc -= 0.5 * dx;
259 yc -= 0.5 * dy;
260 break;
261 }
262 }
263
264 glTranslated(x, y, 0.);
265 glRotated(angle, 0., 0., 1.);
266 glTranslated(xc, yc, 0.);
267 glTranslated(-0.5 * dx, -0.5 * dy, 0.);
268 //glScaled(mgn, mgn, 1.);
269
270 const_cast<FTFont*>(fFont)->Render(txt);
271
272 glPopMatrix();
273}
274
275////////////////////////////////////////////////////////////////////////////////
276
277void TGLFont::Render(const wchar_t* txt, Double_t x, Double_t y, Double_t angle, Double_t mgn) const
278{
279 RenderHelper(txt, x, y, angle, mgn);
280}
281
282////////////////////////////////////////////////////////////////////////////////
283
284void TGLFont::Render(const char* txt, Double_t x, Double_t y, Double_t angle, Double_t mgn) const
285{
286 RenderHelper(txt, x, y, angle, mgn);
287}
288
289////////////////////////////////////////////////////////////////////////////////
290/// Render text.
291
292void TGLFont::Render(const TString &txt) const
293{
294 Bool_t scaleDepth = (fMode == kExtrude && fDepth != 1.0f);
295
296 if (scaleDepth) {
297 glPushMatrix();
298 // !!! 0.2*fSize is hard-coded in TGLFontManager::GetFont(), too.
299 glTranslatef(0.0f, 0.0f, 0.5f*fDepth * 0.2f*fSize);
300 glScalef(1.0f, 1.0f, fDepth);
301 }
302
303 // FTGL is not const correct.
304 const_cast<FTFont*>(fFont)->Render(txt);
305
306 if (scaleDepth) {
307 glPopMatrix();
308 }
309}
310
311////////////////////////////////////////////////////////////////////////////////
312/// Render text with given alignmentrepl and at given position.
313
315 ETextAlignH_e alignH, ETextAlignV_e alignV) const
316{
317 glPushMatrix();
318
319 glTranslatef(x, y, z);
320
321 x=0, y=0;
322 Float_t llx, lly, llz, urx, ury, urz;
323 BBox(txt, llx, lly, llz, urx, ury, urz);
324
325 switch (alignH)
326 {
327 case TGLFont::kRight:
328 x = -urx;
329 break;
330
332 x = -urx*0.5;
333 break;
334 default:
335 break;
336 };
337
338 switch (alignV)
339 {
340 case TGLFont::kBottom:
341 y = -ury;
342 break;
344 y = -ury*0.5;
345 break;
346 default:
347 break;
348 };
349
351 {
352 glRasterPos2i(0, 0);
353 glBitmap(0, 0, 0, 0, x, y, 0);
354 }
355 else
356 {
357 glTranslatef(x, y, 0);
358 }
359 Render(txt);
360 glPopMatrix();
361}
362
363////////////////////////////////////////////////////////////////////////////////
364/// Set-up GL state before FTFont rendering.
365
366void TGLFont::PreRender(Bool_t autoLight, Bool_t lightOn) const
367{
368 switch (fMode)
369 {
370 case kBitmap:
371 case kPixmap:
372 glPushAttrib(GL_CURRENT_BIT | GL_COLOR_BUFFER_BIT | GL_ENABLE_BIT);
373 glEnable(GL_ALPHA_TEST);
374 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
375 glAlphaFunc(GL_GEQUAL, 0.0625);
376 break;
377 case kTexture:
378 glPushAttrib(GL_POLYGON_BIT | GL_ENABLE_BIT);
379 glEnable(GL_TEXTURE_2D);
380 glDisable(GL_CULL_FACE);
381 glEnable(GL_ALPHA_TEST);
382 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
383 glAlphaFunc(GL_GEQUAL, 0.0625);
384 break;
385 case kOutline:
386 case kPolygon:
387 case kExtrude:
388 glPushAttrib(GL_POLYGON_BIT | GL_ENABLE_BIT);
389 glEnable(GL_NORMALIZE);
390 glDisable(GL_CULL_FACE);
391 break;
392 default:
393 Warning("TGLFont::PreRender", "Font mode undefined.");
394 glPushAttrib(GL_LIGHTING_BIT);
395 break;
396 }
397
398 if ((autoLight && fMode > TGLFont::kOutline) || (!autoLight && lightOn))
399 glEnable(GL_LIGHTING);
400 else
401 glDisable(GL_LIGHTING);
402}
403
404////////////////////////////////////////////////////////////////////////////////
405/// Reset GL state after FTFont rendering.
406
408{
409 glPopAttrib();
410}
411
412/** \class TGLFontManager
413\ingroup opengl
414A FreeType GL font manager.
415
416Each GL rendering context has an instance of FTGLManager.
417This enables FTGL fonts to be shared same way as textures and display lists.
418*/
419
421
426
427////////////////////////////////////////////////////////////////////////////////
428/// Destructor.
429
431{
432 FontMap_i it = fFontMap.begin();
433 while (it != fFontMap.end()) {
434 delete it->first.GetFont();
435 it++;
436 }
437 fFontMap.clear();
438}
439
440////////////////////////////////////////////////////////////////////////////////
441/// Provide font with given size, file and FTGL class.
442
444{
446
447 Int_t size = GetFontSize(sizeIn);
448 if (mode == out.GetMode() && fileID == out.GetFile() && size == out.GetSize())
449 return;
450
451 FontMap_i it = fFontMap.find(TGLFont(size, fileID, mode));
452 if (it == fFontMap.end())
453 {
454 TString ttpath, file;
455 ttpath = gEnv->GetValue("Root.TTGLFontPath", TROOT::GetTTFFontDir());
456 {
457 //For extenede we have both ttf and otf.
458 char *fp = gSystem->Which(ttpath, fileID < fgExtendedFontStart ?
459 ((TObjString*)fgFontFileArray[fileID])->String() + ".ttf" :
460 ((TObjString*)fgFontFileArray[fileID])->String());
461 file = fp;
462 delete [] fp;
463 }
464
465 FTFont* ftfont = 0;
466 switch (mode)
467 {
468 case TGLFont::kBitmap:
469 ftfont = new FTGLBitmapFont(file);
470 break;
471 case TGLFont::kPixmap:
472 ftfont = new FTGLPixmapFont(file);
473 break;
475 ftfont = new FTGLOutlineFont(file);
476 break;
478 ftfont = new FTGLPolygonFont(file);
479 break;
481 ftfont = new FTGLExtrdFont(file);
482 ftfont->Depth(0.2*size);
483 break;
485 ftfont = new FTGLTextureFont(file);
486 break;
487 default:
488 Error("TGLFontManager::RegisterFont", "invalid FTGL type");
489 return;
490 break;
491 }
492 ftfont->FaceSize(size);
493 const TGLFont &mf = fFontMap.insert(std::make_pair(TGLFont(size, fileID, mode, ftfont, 0), 1)).first->first;
494 out.CopyAttributes(mf);
495 }
496 else
497 {
498 if (it->first.GetTrashCount() > 0) {
499 fFontTrash.remove(&(it->first));
500 it->first.SetTrashCount(0);
501 }
502 ++(it->second);
503 out.CopyAttributes(it->first);
504 }
505 out.SetManager(this);
506}
507
508////////////////////////////////////////////////////////////////////////////////
509/// Get mapping from ttf id to font names. Table taken from TTF.cxx.
510
512{
513 TObjArray* farr = GetFontFileArray();
514 TIter next(farr);
515 TObjString* os;
516 Int_t cnt = 0;
517 while ((os = (TObjString*) next()) != 0)
518 {
519 if (os->String() == name)
520 break;
521 cnt++;
522 }
523
524 if (cnt < farr->GetEntries())
525 RegisterFont(size, cnt, mode, out);
526 else
527 Error("TGLFontManager::RegisterFont", "unknown font name %s", name);
528}
529
530////////////////////////////////////////////////////////////////////////////////
531/// Release font with given attributes. Returns false if font has
532/// not been found in the managers font set.
533
535{
536 FontMap_i it = fFontMap.find(font);
537
538 if (it != fFontMap.end())
539 {
540 --(it->second);
541 if (it->second == 0)
542 {
543 assert(it->first.GetTrashCount() == 0);
544 it->first.IncTrashCount();
545 fFontTrash.push_back(&it->first);
546 }
547 }
548}
549
550////////////////////////////////////////////////////////////////////////////////
551/// Get id to file name map.
552
554{
556 return &fgFontFileArray;
557}
558
559////////////////////////////////////////////////////////////////////////////////
560/// Get valid font size vector.
561
563{
565 return &fgFontSizeArray;
566}
567
568////////////////////////////////////////////////////////////////////////////////
569
571{
573
574 assert(fgExtendedFontStart > 0 && "GetExtendedFontStartIndex, invalid index");
575
576 return fgExtendedFontStart;
577}
578
579////////////////////////////////////////////////////////////////////////////////
580/// Get availabe font size.
581
583{
585
587 TMath::CeilNint(ds));
588
589 if (idx < 0) idx = 0;
590 return fgFontSizeArray[idx];
591}
592
593////////////////////////////////////////////////////////////////////////////////
594/// Get availabe font size.
595
597{
598 if (ds < min) ds = min;
599 if (ds > max) ds = max;
600 return GetFontSize(ds);
601}
602
603////////////////////////////////////////////////////////////////////////////////
604/// Get font name from TAttAxis font id.
605
607{
609
610 Int_t fontIndex = id / 10;
611
612 if (fontIndex > fgFontFileArray.GetEntries() || !fontIndex)
613 fontIndex = 5;//arialbd
614 else
615 fontIndex -= 1;
616
617 TObjString* os = (TObjString*)fgFontFileArray[fontIndex];
618 return os->String().Data();
619}
620
621////////////////////////////////////////////////////////////////////////////////
622/// Create a list of available font files and allowed font sizes.
623
625{
626 fgFontFileArray.Add(new TObjString("timesi")); // 10
627 fgFontFileArray.Add(new TObjString("timesbd")); // 20
628 fgFontFileArray.Add(new TObjString("timesbi")); // 30
629
630 fgFontFileArray.Add(new TObjString("arial")); // 40
631 fgFontFileArray.Add(new TObjString("ariali")); // 50
632 fgFontFileArray.Add(new TObjString("arialbd")); // 60
633 fgFontFileArray.Add(new TObjString("arialbi")); // 70
634
635 fgFontFileArray.Add(new TObjString("cour")); // 80
636 fgFontFileArray.Add(new TObjString("couri")); // 90
637 fgFontFileArray.Add(new TObjString("courbd")); // 100
638 fgFontFileArray.Add(new TObjString("courbi")); // 110
639
640 fgFontFileArray.Add(new TObjString("symbol")); // 120
641 fgFontFileArray.Add(new TObjString("times")); // 130
642 fgFontFileArray.Add(new TObjString("wingding")); // 140
643 fgFontFileArray.Add(new TObjString("symbol")); // 150
644
646 //"Extended" fonts for gl-pad.
647 //fgPadFontStart + ...
648 fgFontFileArray.Add(new TObjString("FreeSerifItalic.otf")); // 10 (160)
649 fgFontFileArray.Add(new TObjString("FreeSerifBold.otf")); // 20 (170)
650 fgFontFileArray.Add(new TObjString("FreeSerifBoldItalic.otf")); // 30
651
652 fgFontFileArray.Add(new TObjString("FreeSans.otf")); // 40
653 fgFontFileArray.Add(new TObjString("FreeSansOblique.otf")); // 50
654 fgFontFileArray.Add(new TObjString("FreeSansBold.otf")); // 60
655 fgFontFileArray.Add(new TObjString("FreeSansBoldOblique.otf")); // 70
656
657 fgFontFileArray.Add(new TObjString("FreeMono.otf")); // 80
658 fgFontFileArray.Add(new TObjString("FreeMonoOblique.otf")); // 90
659 fgFontFileArray.Add(new TObjString("FreeMonoBold.otf")); // 100
660 fgFontFileArray.Add(new TObjString("FreeMonoBoldOblique.otf")); // 110
661
662 fgFontFileArray.Add(new TObjString("symbol.ttf")); // 120
663 fgFontFileArray.Add(new TObjString("FreeSerif.otf")); // 130
664 fgFontFileArray.Add(new TObjString("wingding.ttf")); // 140
665 fgFontFileArray.Add(new TObjString("symbol.ttf")); // 150
666
667 fgFontFileArray.Add(new TObjString("STIXGeneral.otf")); // 200
668 fgFontFileArray.Add(new TObjString("STIXGeneralItalic.otf")); // 210
669 fgFontFileArray.Add(new TObjString("STIXGeneralBol.otf")); // 220
670 fgFontFileArray.Add(new TObjString("STIXGeneralBolIta.otf")); // 230
671
672 fgFontFileArray.Add(new TObjString("STIXSiz1Sym.otf")); // 240
673 fgFontFileArray.Add(new TObjString("STIXSiz1SymBol.otf")); // 250
674 fgFontFileArray.Add(new TObjString("STIXSiz2Sym.otf")); // 260
675 fgFontFileArray.Add(new TObjString("STIXSiz2SymBol.otf")); // 270
676
677 fgFontFileArray.Add(new TObjString("STIXSiz3Sym.otf")); // 280
678 fgFontFileArray.Add(new TObjString("STIXSiz3SymBol.otf")); // 290
679 fgFontFileArray.Add(new TObjString("STIXSiz4Sym.otf")); // 300
680 fgFontFileArray.Add(new TObjString("STIXSiz4SymBol.otf")); // 310
681
682 fgFontFileArray.Add(new TObjString("STIXSiz5Sym.otf")); // 320
683 fgFontFileArray.Add(new TObjString("DroidSansFallback.ttf")); // 330
684 fgFontFileArray.Add(new TObjString("DroidSansFallback.ttf")); // 340
685 fgFontFileArray.Add(new TObjString("DroidSansFallback.ttf")); // 350
686
687 for (Int_t i = 10; i <= 20; i+=2)
688 fgFontSizeArray.push_back(i);
689 for (Int_t i = 24; i <= 64; i+=4)
690 fgFontSizeArray.push_back(i);
691 for (Int_t i = 72; i <= 128; i+=8)
692 fgFontSizeArray.push_back(i);
693
695}
696
697////////////////////////////////////////////////////////////////////////////////
698/// Delete FTFFont objects registered for destruction.
699
701{
702 FontList_i it = fFontTrash.begin();
703 while (it != fFontTrash.end())
704 {
705 if ((*it)->IncTrashCount() > 10000)
706 {
707 FontMap_i mi = fFontMap.find(**it);
708 assert(mi != fFontMap.end());
709 fFontMap.erase(mi);
710 delete (*it)->GetFont();
711
712 FontList_i li = it++;
713 fFontTrash.erase(li);
714 }
715 else
716 {
717 ++it;
718 }
719 }
720}
#define f(i)
Definition: RSha256.hxx:104
int Int_t
Definition: RtypesCore.h:41
unsigned int UInt_t
Definition: RtypesCore.h:42
const Bool_t kFALSE
Definition: RtypesCore.h:88
bool Bool_t
Definition: RtypesCore.h:59
double Double_t
Definition: RtypesCore.h:55
float Float_t
Definition: RtypesCore.h:53
const Bool_t kTRUE
Definition: RtypesCore.h:87
#define ClassImp(name)
Definition: Rtypes.h:365
R__EXTERN TEnv * gEnv
Definition: TEnv.h:171
void Error(const char *location, const char *msgfmt,...)
void Warning(const char *location, const char *msgfmt,...)
char name[80]
Definition: TGX11.cxx:109
R__EXTERN TSystem * gSystem
Definition: TSystem.h:560
#define gVirtualX
Definition: TVirtualX.h:345
@ kUndef
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
Definition: TEnv.cxx:491
A FreeType GL font manager.
virtual ~TGLFontManager()
Destructor.
static TObjArray fgFontFileArray
FontMap_t fFontMap
void RegisterFont(Int_t size, Int_t file, TGLFont::EMode mode, TGLFont &out)
Provide font with given size, file and FTGL class.
static Int_t GetFontSize(Int_t ds)
Get availabe font size.
static void InitStatics()
Create a list of available font files and allowed font sizes.
static Int_t GetExtendedFontStartIndex()
static Bool_t fgStaticInitDone
static FontSizeVec_t fgFontSizeArray
static Int_t fgExtendedFontStart
static FontSizeVec_t * GetFontSizeArray()
Get valid font size vector.
std::list< constTGLFont * >::iterator FontList_i
void ClearFontTrash()
Delete FTFFont objects registered for destruction.
std::map< TGLFont, Int_t >::iterator FontMap_i
std::vector< Int_t > FontSizeVec_t
static const char * GetFontNameFromId(Int_t)
Get font name from TAttAxis font id.
static TObjArray * GetFontFileArray()
Get id to file name map.
void ReleaseFont(TGLFont &font)
Release font with given attributes.
FontList_t fFontTrash
A wrapper class for FTFont.
void MeasureBaseLineParams(Float_t &ascent, Float_t &descent, Float_t &line_height, const char *txt="Xj") const
Measure font's base-line parameters from the passed text.
Float_t GetDescent() const
Get font's descent. The returned value is positive.
virtual ~TGLFont()
Destructor.
Float_t GetAscent() const
Get font's ascent.
EMode GetMode() const
void SetManager(TGLFontManager *mng)
void SetFont(FTFont *f)
Float_t GetLineHeight() const
Get font's line-height.
EMode fMode
Int_t GetSize() const
const FTFont * GetFont() const
void RenderHelper(const Char *txt, Double_t x, Double_t y, Double_t angle, Double_t) const
mgn is simply ignored, because ROOT's TVirtualX TGX11 are complete mess with painting attributes.
FTFont * fFont
TGLFontManager * fManager
Int_t GetFile() const
void BBox(const char *txt, Float_t &llx, Float_t &lly, Float_t &llz, Float_t &urx, Float_t &ury, Float_t &urz) const
Get bounding box.
Int_t fTrashCount
Float_t fDepth
void Render(const char *txt, Double_t x, Double_t y, Double_t angle, Double_t mgn) const
virtual void PostRender() const
Reset GL state after FTFont rendering.
void SetDepth(Float_t d)
virtual void PreRender(Bool_t autoLight=kTRUE, Bool_t lightOn=kFALSE) const
Set-up GL state before FTFont rendering.
Int_t fSize
TGLFont()
Constructor.
void CopyAttributes(const TGLFont &o)
Assignment operator.
Int_t fFile
An array of TObjects.
Definition: TObjArray.h:37
void Add(TObject *obj)
Definition: TObjArray.h:74
Int_t GetEntries() const
Return the number of objects in array (i.e.
Definition: TObjArray.cxx:522
Collectable string class.
Definition: TObjString.h:28
TString & String()
Definition: TObjString.h:48
static const TString & GetTTFFontDir()
Get the fonts directory in the installation. Static utility function.
Definition: TROOT.cxx:3124
Basic string class.
Definition: TString.h:131
const char * Data() const
Definition: TString.h:364
virtual char * Which(const char *search, const char *file, EAccessMode mode=kFileExists)
Find location of file in a search path.
Definition: TSystem.cxx:1537
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17
Int_t CeilNint(Double_t x)
Definition: TMath.h:689
Long64_t BinarySearch(Long64_t n, const T *array, T value)
Definition: TMathBase.h:278
Definition: file.py:1
const char * Char
const char * String
Definition: TXMLSetup.cxx:93
const char * cnt
Definition: TXMLSetup.cxx:74