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
39namespace {
40#ifdef HAVE_UTF8
41// https://github.com/root-project/root/issues/22076#issuecomment-4342764706
42TString AsUTF8(const char *txt)
43{
45 const auto len = strlen(txt);
46 for (auto i = 0UL; i < len; ++i) {
47 if (static_cast<unsigned char>(txt[i]) >= static_cast<unsigned char>(192)) {
48 utxt.Append(static_cast<unsigned char>(0xc3));
49 utxt.Append(static_cast<unsigned char>(0x80) +
50 (static_cast<unsigned char>(txt[i]) - static_cast<unsigned char>(192)));
51 } else {
52 utxt.Append(txt[i]);
53 }
54 }
55 return utxt;
56}
57#endif
58} // namespace
59
60/** \class TGLFont
61\ingroup opengl
62A wrapper class for FTFont.
63Holds pointer to FTFont object and its description: face size, font file
64and class ID. It wraps Render and BBox functions.
65*/
66
67
68////////////////////////////////////////////////////////////////////////////////
69/// Constructor.
70
72 fFont(0), fManager(0), fDepth(0),
73 fSize(0), fFile(0), fMode(kUndef),
74 fTrashCount(0)
75{
76}
77
78////////////////////////////////////////////////////////////////////////////////
79/// Constructor.
80
82 fFont(f), fManager(mng), fDepth(0),
83 fSize(size), fFile(font), fMode(mode),
84 fTrashCount(0)
85{
86}
87
88////////////////////////////////////////////////////////////////////////////////
89/// Assignment operator.
90
92 fFont(0), fManager(0), fDepth(0), fTrashCount(0)
93{
94 fFont = (FTFont*)o.GetFont();
95
96 fSize = o.fSize;
97 fFile = o.fFile;
98 fMode = o.fMode;
99
101}
102
103////////////////////////////////////////////////////////////////////////////////
104///Destructor
105
107{
108 if (fManager) fManager->ReleaseFont(*this);
109}
110
111////////////////////////////////////////////////////////////////////////////////
112/// Assignment operator.
113
115{
116 SetFont(o.fFont);
118
119 SetDepth(o.fDepth);
120
121 fSize = o.fSize;
122 fFile = o.fFile;
123 fMode = o.fMode;
124
126}
127
128
129/******************************************************************************/
130
131////////////////////////////////////////////////////////////////////////////////
132/// Get font's ascent.
133
135{
136 return fFont->Ascender();
137}
138
139////////////////////////////////////////////////////////////////////////////////
140/// Get font's descent. The returned value is positive.
141
143{
144 return -fFont->Descender();
145}
146
147////////////////////////////////////////////////////////////////////////////////
148/// Get font's line-height.
149
151{
152 return fFont->LineHeight();
153}
154
155////////////////////////////////////////////////////////////////////////////////
156/// Measure font's base-line parameters from the passed text.
157/// Note that the measured parameters are not the same as the ones
158/// returned by get-functions - those were set by the font designer.
159
161 const char* txt) const
162{
163#ifdef HAVE_UTF8
165 txt = utxt.Data();
166#endif
167 Float_t dum, lly, ury;
168 const_cast<FTFont*>(fFont)->BBox(txt, dum, lly, dum, dum, ury, dum);
169 ascent = ury;
170 descent = -lly;
171 line_height = ury - lly;
172}
173
174////////////////////////////////////////////////////////////////////////////////
175/// Get bounding box.
176
177void TGLFont::BBox(const char* txt,
179 Float_t& urx, Float_t& ury, Float_t& urz) const
180{
181 // HAVE_UTF8 was already called by functions above BBox so no need to transform here
182 // FTGL is not const correct.
183 const_cast<FTFont*>(fFont)->BBox(txt, llx, lly, llz, urx, ury, urz);
184}
185
186////////////////////////////////////////////////////////////////////////////////
187/// Get bounding box.
188
189void TGLFont::BBox(const wchar_t* txt,
191 Float_t& urx, Float_t& ury, Float_t& urz) const
192{
193 // HAVE_UTF8 was already called by functions above BBox so no need to transform here
194 // FTGL is not const correct.
195 const_cast<FTFont*>(fFont)->BBox(txt, llx, lly, llz, urx, ury, urz);
196}
197
198////////////////////////////////////////////////////////////////////////////////
199///mgn is simply ignored, because ROOT's TVirtualX TGX11 are complete mess with
200///painting attributes.
201
202template<class Char>
204{
205 // no need to check HAVE_UTF8 here, since it was called by functions above it
206
207 glPushMatrix();
208 //glLoadIdentity();
209
210 // FTGL is not const correct.
211 Float_t llx = 0.f, lly = 0.f, llz = 0.f, urx = 0.f, ury = 0.f, urz = 0.f;
212 BBox(txt, llx, lly, llz, urx, ury, urz);
213
214 /*
215 V\H | left | center | right
216 _______________________________
217 bottom | 7 | 8 | 9
218 _______________________________
219 center | 4 | 5 | 6
220 _______________________________
221 top | 1 | 2 | 3
222 */
223 const Double_t dx = urx - llx, dy = ury - lly;
224 Double_t xc = 0., yc = 0.;
225
226 // if align was not set before - use value from gVirtualX
227 const UInt_t align = fTextAlign ? fTextAlign : gVirtualX->GetTextAlign();
228
229 //Timur: Here's the nice X11 bullshido: you call gVirtualX->SetTextAlign(11),
230 //later gVirtualX->GetTextAling() will give you 7. Brilliant!
231 //But with Cocoa you'll have 11. As it should be, of course.
232 //Sergey: problem with gVirtualX solved, now all platforms works same way
233
234 const UInt_t hAlign = UInt_t(align / 10);
235 const UInt_t vAlign = UInt_t(align % 10);
236 switch (hAlign) {
237 case 1:
238 xc = 0.5 * dx;
239 break;
240 case 2:
241 break;
242 case 3:
243 xc = -0.5 * dy;
244 break;
245 }
246
247 switch (vAlign) {
248 case 1:
249 yc = 0.5 * dy;
250 break;
251 case 2:
252 break;
253 case 3:
254 yc = -0.5 * dy;
255 break;
256 }
257
258 glTranslated(x, y, 0.);
259 glRotated(angle, 0., 0., 1.);
260 glTranslated(xc, yc, 0.);
261 glTranslated(-0.5 * dx, -0.5 * dy, 0.);
262 //glScaled(mgn, mgn, 1.);
263
264 const_cast<FTFont*>(fFont)->Render(txt);
265
266 glPopMatrix();
267}
268
269////////////////////////////////////////////////////////////////////////////////
270
272{
273 // TODO handle UTF8
275}
276
277////////////////////////////////////////////////////////////////////////////////
278
280{
281#ifdef HAVE_UTF8
283 txt = utxt.Data();
284#endif
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#ifdef HAVE_UTF8
304 // FTGL is not const correct.
305 const_cast<FTFont *>(fFont)->Render(utxt.Data());
306#else
307 // FTGL is not const correct.
308 const_cast<FTFont *>(fFont)->Render(txt.Data());
309#endif
310
311 if (scaleDepth) {
312 glPopMatrix();
313 }
314}
315
316////////////////////////////////////////////////////////////////////////////////
317/// Render text with given alignmentrepl and at given position.
318
320 ETextAlignV_e alignV) const
321{
322 glPushMatrix();
323
324 glTranslatef(x, y, z);
325
326 x=0, y=0;
327 Float_t llx, lly, llz, urx, ury, urz;
328
329#ifdef HAVE_UTF8
331 BBox(utxt.Data(), llx, lly, llz, urx, ury, urz);
332#else
333 BBox(txt.Data(), llx, lly, llz, urx, ury, urz);
334#endif
335
336 switch (alignH)
337 {
338 case TGLFont::kRight:
339 x = -urx;
340 break;
341
343 x = -urx*0.5;
344 break;
345 default:
346 break;
347 };
348
349 switch (alignV)
350 {
351 case TGLFont::kBottom:
352 y = -ury;
353 break;
355 y = -ury*0.5;
356 break;
357 default:
358 break;
359 };
360
362 {
363 glRasterPos2i(0, 0);
364 glBitmap(0, 0, 0, 0, x, y, 0);
365 }
366 else
367 {
368 glTranslatef(x, y, 0);
369 }
370
371 Bool_t scaleDepth = (fMode == kExtrude && fDepth != 1.0f);
372
373 if (scaleDepth) {
374 glPushMatrix();
375 // !!! 0.2*fSize is hard-coded in TGLFontManager::GetFont(), too.
376 glTranslatef(0.0f, 0.0f, 0.5f * fDepth * 0.2f * fSize);
377 glScalef(1.0f, 1.0f, fDepth);
378 }
379
380#ifdef HAVE_UTF8
381 // FTGL is not const correct.
382 const_cast<FTFont *>(fFont)->Render(utxt.Data());
383#else
384 // FTGL is not const correct.
385 const_cast<FTFont *>(fFont)->Render(txt.Data());
386#endif
387
388 if (scaleDepth) {
389 glPopMatrix();
390 }
391 glPopMatrix();
392}
393
394////////////////////////////////////////////////////////////////////////////////
395/// Set-up GL state before FTFont rendering.
396
398{
399 switch (fMode)
400 {
401 case kBitmap:
402 case kPixmap:
406 glAlphaFunc(GL_GEQUAL, 0.0625);
407 break;
408 case kTexture:
414 glAlphaFunc(GL_GEQUAL, 0.0625);
415 break;
416 case kOutline:
417 case kPolygon:
418 case kExtrude:
422 break;
423 default:
424 Warning("TGLFont::PreRender", "Font mode undefined.");
426 break;
427 }
428
431 else
433}
434
435////////////////////////////////////////////////////////////////////////////////
436/// Reset GL state after FTFont rendering.
437
439{
440 glPopAttrib();
441}
442
443/** \class TGLFontManager
444\ingroup opengl
445A FreeType GL font manager.
446
447Each GL rendering context has an instance of FTGLManager.
448This enables FTGL fonts to be shared same way as textures and display lists.
449*/
450
451
456
457////////////////////////////////////////////////////////////////////////////////
458/// Destructor.
459
461{
462 FontMap_i it = fFontMap.begin();
463 while (it != fFontMap.end()) {
464 delete it->first.GetFont();
465 it++;
466 }
467 fFontMap.clear();
468}
469
470////////////////////////////////////////////////////////////////////////////////
471/// Provide font with given size, file and FTGL class.
472
474{
476
478 if (mode == out.GetMode() && fileID == out.GetFile() && size == out.GetSize())
479 return;
480
482 if (it == fFontMap.end())
483 {
484 TString ttpath, file;
485 ttpath = gEnv->GetValue("Root.TTGLFontPath", TROOT::GetTTFFontDir());
486 {
487 //For extenede we have both ttf and otf.
489 ((TObjString*)fgFontFileArray[fileID])->String() + ".ttf" :
490 ((TObjString*)fgFontFileArray[fileID])->String());
491 file = fp;
492 delete [] fp;
493 }
494
495 FTFont* ftfont = 0;
496 switch (mode)
497 {
498 case TGLFont::kBitmap:
499 ftfont = new FTGLBitmapFont(file);
500 break;
501 case TGLFont::kPixmap:
502 ftfont = new FTGLPixmapFont(file);
503 break;
505 ftfont = new FTGLOutlineFont(file);
506 break;
508 ftfont = new FTGLPolygonFont(file);
509 break;
511 ftfont = new FTGLExtrdFont(file);
512 ftfont->Depth(0.2*size);
513 break;
515 ftfont = new FTGLTextureFont(file);
516 break;
517 default:
518 Error("TGLFontManager::RegisterFont", "invalid FTGL type");
519 return;
520 break;
521 }
522 ftfont->FaceSize(size);
523 const TGLFont &mf = fFontMap.insert(std::make_pair(TGLFont(size, fileID, mode, ftfont, 0), 1)).first->first;
524 out.CopyAttributes(mf);
525 }
526 else
527 {
528 if (it->first.GetTrashCount() > 0) {
529 fFontTrash.remove(&(it->first));
530 it->first.SetTrashCount(0);
531 }
532 ++(it->second);
533 out.CopyAttributes(it->first);
534 }
535 out.SetManager(this);
536}
537
538////////////////////////////////////////////////////////////////////////////////
539/// Get mapping from ttf id to font names. Table taken from TTF.cxx.
540
542{
544 TIter next(farr);
545 TObjString* os;
546 Int_t cnt = 0;
547 while ((os = (TObjString*) next()) != 0)
548 {
549 if (os->String() == name)
550 break;
551 cnt++;
552 }
553
554 if (cnt < farr->GetEntries())
555 RegisterFont(size, cnt, mode, out);
556 else
557 Error("TGLFontManager::RegisterFont", "unknown font name %s", name);
558}
559
560////////////////////////////////////////////////////////////////////////////////
561/// Release font with given attributes. Returns false if font has
562/// not been found in the managers font set.
563
565{
566 FontMap_i it = fFontMap.find(font);
567
568 if (it != fFontMap.end())
569 {
570 --(it->second);
571 if (it->second == 0)
572 {
573 assert(it->first.GetTrashCount() == 0);
574 it->first.IncTrashCount();
575 fFontTrash.push_back(&it->first);
576 }
577 }
578}
579
580////////////////////////////////////////////////////////////////////////////////
581/// Get id to file name map.
582
588
589////////////////////////////////////////////////////////////////////////////////
590/// Get valid font size vector.
591
597
598////////////////////////////////////////////////////////////////////////////////
599
601{
603
604 assert(fgExtendedFontStart > 0 && "GetExtendedFontStartIndex, invalid index");
605
606 return fgExtendedFontStart;
607}
608
609////////////////////////////////////////////////////////////////////////////////
610/// Get availabe font size.
611
613{
615
618
619 if (idx < 0) idx = 0;
620 return fgFontSizeArray[idx];
621}
622
623////////////////////////////////////////////////////////////////////////////////
624/// Get availabe font size.
625
627{
628 if (ds < min) ds = min;
629 if (ds > max) ds = max;
630 return GetFontSize(ds);
631}
632
633////////////////////////////////////////////////////////////////////////////////
634/// Get font name from TAttAxis font id.
635
637{
639
640 Int_t fontIndex = id / 10;
641
642 if (fontIndex > fgFontFileArray.GetEntries() || !fontIndex)
643 fontIndex = 5;//arialbd
644 else
645 fontIndex -= 1;
646
648 return os->String().Data();
649}
650
651////////////////////////////////////////////////////////////////////////////////
652/// Create a list of available font files and allowed font sizes.
653
655{
656 fgFontFileArray.Add(new TObjString("timesi")); // 10
657 fgFontFileArray.Add(new TObjString("timesbd")); // 20
658 fgFontFileArray.Add(new TObjString("timesbi")); // 30
659
660 fgFontFileArray.Add(new TObjString("arial")); // 40
661 fgFontFileArray.Add(new TObjString("ariali")); // 50
662 fgFontFileArray.Add(new TObjString("arialbd")); // 60
663 fgFontFileArray.Add(new TObjString("arialbi")); // 70
664
665 fgFontFileArray.Add(new TObjString("cour")); // 80
666 fgFontFileArray.Add(new TObjString("couri")); // 90
667 fgFontFileArray.Add(new TObjString("courbd")); // 100
668 fgFontFileArray.Add(new TObjString("courbi")); // 110
669
670 fgFontFileArray.Add(new TObjString("symbol")); // 120
671 fgFontFileArray.Add(new TObjString("times")); // 130
672 fgFontFileArray.Add(new TObjString("wingding")); // 140
673 fgFontFileArray.Add(new TObjString("symbol")); // 150
674
676 //"Extended" fonts for gl-pad.
677 //fgPadFontStart + ...
678 fgFontFileArray.Add(new TObjString("FreeSerifItalic.otf")); // 10 (160)
679 fgFontFileArray.Add(new TObjString("FreeSerifBold.otf")); // 20 (170)
680 fgFontFileArray.Add(new TObjString("FreeSerifBoldItalic.otf")); // 30
681
682 fgFontFileArray.Add(new TObjString("FreeSans.otf")); // 40
683 fgFontFileArray.Add(new TObjString("FreeSansOblique.otf")); // 50
684 fgFontFileArray.Add(new TObjString("FreeSansBold.otf")); // 60
685 fgFontFileArray.Add(new TObjString("FreeSansBoldOblique.otf")); // 70
686
687 fgFontFileArray.Add(new TObjString("FreeMono.otf")); // 80
688 fgFontFileArray.Add(new TObjString("FreeMonoOblique.otf")); // 90
689 fgFontFileArray.Add(new TObjString("FreeMonoBold.otf")); // 100
690 fgFontFileArray.Add(new TObjString("FreeMonoBoldOblique.otf")); // 110
691
692 fgFontFileArray.Add(new TObjString("symbol.ttf")); // 120
693 fgFontFileArray.Add(new TObjString("FreeSerif.otf")); // 130
694 fgFontFileArray.Add(new TObjString("wingding.ttf")); // 140
695 fgFontFileArray.Add(new TObjString("symbol.ttf")); // 150
696
697 fgFontFileArray.Add(new TObjString("STIXGeneral.otf")); // 200
698 fgFontFileArray.Add(new TObjString("STIXGeneralItalic.otf")); // 210
699 fgFontFileArray.Add(new TObjString("STIXGeneralBol.otf")); // 220
700 fgFontFileArray.Add(new TObjString("STIXGeneralBolIta.otf")); // 230
701
702 fgFontFileArray.Add(new TObjString("STIXSiz1Sym.otf")); // 240
703 fgFontFileArray.Add(new TObjString("STIXSiz1SymBol.otf")); // 250
704 fgFontFileArray.Add(new TObjString("STIXSiz2Sym.otf")); // 260
705 fgFontFileArray.Add(new TObjString("STIXSiz2SymBol.otf")); // 270
706
707 fgFontFileArray.Add(new TObjString("STIXSiz3Sym.otf")); // 280
708 fgFontFileArray.Add(new TObjString("STIXSiz3SymBol.otf")); // 290
709 fgFontFileArray.Add(new TObjString("STIXSiz4Sym.otf")); // 300
710 fgFontFileArray.Add(new TObjString("STIXSiz4SymBol.otf")); // 310
711
712 fgFontFileArray.Add(new TObjString("STIXSiz5Sym.otf")); // 320
713 fgFontFileArray.Add(new TObjString("DroidSansFallback.ttf")); // 330
714 fgFontFileArray.Add(new TObjString("DroidSansFallback.ttf")); // 340
715 fgFontFileArray.Add(new TObjString("DroidSansFallback.ttf")); // 350
716
717 for (Int_t i = 10; i <= 20; i+=2)
718 fgFontSizeArray.push_back(i);
719 for (Int_t i = 24; i <= 64; i+=4)
720 fgFontSizeArray.push_back(i);
721 for (Int_t i = 72; i <= 128; i+=8)
722 fgFontSizeArray.push_back(i);
723
725}
726
727////////////////////////////////////////////////////////////////////////////////
728/// Delete FTFFont objects registered for destruction.
729
731{
732 FontList_i it = fFontTrash.begin();
733 while (it != fFontTrash.end())
734 {
735 if ((*it)->IncTrashCount() > 10000)
736 {
737 FontMap_i mi = fFontMap.find(**it);
738 assert(mi != fFontMap.end());
739 fFontMap.erase(mi);
740 delete (*it)->GetFont();
741
742 FontList_i li = it++;
743 fFontTrash.erase(li);
744 }
745 else
746 {
747 ++it;
748 }
749 }
750}
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
Boolean (0=false, 1=true) (bool)
Definition RtypesCore.h:77
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:59
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int)
Definition RtypesCore.h:60
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
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:208
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Definition TError.cxx:252
Option_t Option_t mgn
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
Option_t Option_t TPoint TPoint angle
Option_t Option_t TPoint TPoint const char mode
char name[80]
Definition TGX11.cxx:145
R__EXTERN TSystem * gSystem
Definition TSystem.h:582
#define gVirtualX
Definition TVirtualX.h:367
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
Definition TEnv.cxx:503
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.
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
UInt_t fTextAlign
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
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:3526
Basic string class.
Definition TString.h:138
const char * Data() const
Definition TString.h:384
virtual char * Which(const char *search, const char *file, EAccessMode mode=kFileExists)
Find location of file in a search path.
Definition TSystem.cxx:1563
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:685
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:329