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