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 "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
42 A wrapper class for FTFont.
43 Holds pointer to FTFont object and its description: face size, font file
44 and 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 
62 TGLFont::TGLFont(Int_t size, Int_t font, EMode mode, FTFont* f, TGLFontManager* mng):
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 
141 void 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 
154 void 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 
165 void 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 
177 template<class Char>
178 void 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 
276 void 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 
283 void TGLFont::Render(const char* txt, Double_t x, Double_t y, Double_t angle, Double_t mgn) const
284 {
285  RenderHelper(txt, x, y, angle, mgn);
286 }
287 
288 ////////////////////////////////////////////////////////////////////////////////
289 /// Render text.
290 
291 void 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 
330  case TGLFont::kCenterH:
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;
342  case TGLFont::kCenterV:
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 
365 void 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
413 A FreeType GL font manager.
414 
415 Each GL rendering context has an instance of FTGLManager.
416 This 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;
473  case TGLFont::kOutline:
474  ftfont = new FTGLOutlineFont(file);
475  break;
476  case TGLFont::kPolygon:
477  ftfont = new FTGLPolygonFont(file);
478  break;
479  case TGLFont::kExtrude:
480  ftfont = new FTGLExtrdFont(file);
481  ftfont->Depth(0.2*size);
482  break;
483  case TGLFont::kTexture:
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 
510 void TGLFontManager::RegisterFont(Int_t size, const char* name, TGLFont::EMode mode, TGLFont &out)
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 
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 }
TGLFontManager::fgExtendedFontStart
static Int_t fgExtendedFontStart
Definition: TGLFontManager.h:141
TGLFontManager::~TGLFontManager
virtual ~TGLFontManager()
Destructor.
Definition: TGLFontManager.cxx:429
TGLFontManager
A FreeType GL font manager.
Definition: TGLFontManager.h:120
TGLFont
A wrapper class for FTFont.
Definition: TGLFontManager.h:24
TGLFont::GetSize
Int_t GetSize() const
Definition: TGLFontManager.h:61
TGLFont::kPolygon
@ kPolygon
Definition: TGLFontManager.h:30
TGLFont::ETextAlignV_e
ETextAlignV_e
Definition: TGLFontManager.h:34
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
TGLFontManager::fgStaticInitDone
static Bool_t fgStaticInitDone
Definition: TGLFontManager.h:144
TObjArray
An array of TObjects.
Definition: TObjArray.h:37
Warning
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Definition: TError.cxx:231
f
#define f(i)
Definition: RSha256.hxx:104
TGLFontManager::fFontTrash
FontList_t fFontTrash
Definition: TGLFontManager.h:137
TGLFont::TGLFont
TGLFont()
Constructor.
Definition: TGLFontManager.cxx:52
TGLFontManager::FontMap_i
std::map< TGLFont, Int_t >::iterator FontMap_i
Definition: TGLFontManager.h:130
gEnv
R__EXTERN TEnv * gEnv
Definition: TEnv.h:171
gVirtualX
#define gVirtualX
Definition: TVirtualX.h:338
TGLFont::kCenterV
@ kCenterV
Definition: TGLFontManager.h:34
TGLFont::EMode
EMode
Definition: TGLFontManager.h:27
TString::Data
const char * Data() const
Definition: TString.h:369
TSystem::Which
virtual char * Which(const char *search, const char *file, EAccessMode mode=kFileExists)
Find location of file in a search path.
Definition: TSystem.cxx:1544
ClassImp
#define ClassImp(name)
Definition: Rtypes.h:364
TObjString.h
TGLFontManager::fgFontSizeArray
static FontSizeVec_t fgFontSizeArray
Definition: TGLFontManager.h:143
TGLFont::kCenterH
@ kCenterH
Definition: TGLFontManager.h:33
TGLFontManager::FontSizeVec_t
std::vector< Int_t > FontSizeVec_t
Definition: TGLFontManager.h:122
TGLFont::BBox
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.
Definition: TGLFontManager.cxx:154
TGLFont::ETextAlignH_e
ETextAlignH_e
Definition: TGLFontManager.h:33
extract_docstrings.ds
ds
Definition: extract_docstrings.py:40
TMath::CeilNint
Int_t CeilNint(Double_t x)
Definition: TMath.h:699
Float_t
float Float_t
Definition: RtypesCore.h:57
TGLFont::fDepth
Float_t fDepth
Definition: TGLFontManager.h:42
Int_t
int Int_t
Definition: RtypesCore.h:45
TGLFont::GetAscent
Float_t GetAscent() const
Get font's ascent.
Definition: TGLFontManager.cxx:115
TObjArray::GetEntries
Int_t GetEntries() const
Return the number of objects in array (i.e.
Definition: TObjArray.cxx:523
x
Double_t x[n]
Definition: legend1.C:17
TGLFontManager::GetFontSizeArray
static FontSizeVec_t * GetFontSizeArray()
Get valid font size vector.
Definition: TGLFontManager.cxx:561
TGLFont::MeasureBaseLineParams
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.
Definition: TGLFontManager.cxx:141
TGLFont::SetManager
void SetManager(TGLFontManager *mng)
Definition: TGLFontManager.h:71
TEnv::GetValue
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
Definition: TEnv.cxx:491
TVirtualX.h
TGLFont::kTexture
@ kTexture
Definition: TGLFontManager.h:30
TGLFont::kOutline
@ kOutline
Definition: TGLFontManager.h:30
TEnv.h
TGLFontManager::GetFontNameFromId
static const char * GetFontNameFromId(Int_t)
Get font name from TAttAxis font id.
Definition: TGLFontManager.cxx:605
TGLFont::kBitmap
@ kBitmap
Definition: TGLFontManager.h:29
TString
Basic string class.
Definition: TString.h:136
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TGLFont::fFile
Int_t fFile
Definition: TGLFontManager.h:49
TGLFont::RenderHelper
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.
Definition: TGLFontManager.cxx:178
TGLFont::kPixmap
@ kPixmap
Definition: TGLFontManager.h:29
bool
TObjArray::Add
void Add(TObject *obj)
Definition: TObjArray.h:74
TObjString::String
TString & String()
Definition: TObjString.h:48
TGLFont::GetDescent
Float_t GetDescent() const
Get font's descent. The returned value is positive.
Definition: TGLFontManager.cxx:123
TROOT.h
TObjString
Collectable string class.
Definition: TObjString.h:28
TGLFont::fManager
TGLFontManager * fManager
Definition: TGLFontManager.h:40
TGLFont::PreRender
virtual void PreRender(Bool_t autoLight=kTRUE, Bool_t lightOn=kFALSE) const
Set-up GL state before FTFont rendering.
Definition: TGLFontManager.cxx:365
TGLFont::Render
void Render(const char *txt, Double_t x, Double_t y, Double_t angle, Double_t mgn) const
Definition: TGLFontManager.cxx:283
TSystem.h
TGLFontManager::ClearFontTrash
void ClearFontTrash()
Delete FTFFont objects registered for destruction.
Definition: TGLFontManager.cxx:699
TGLFontManager::ReleaseFont
void ReleaseFont(TGLFont &font)
Release font with given attributes.
Definition: TGLFontManager.cxx:533
TGLFont::GetFont
const FTFont * GetFont() const
Definition: TGLFontManager.h:70
TGLFont::fSize
Int_t fSize
Definition: TGLFontManager.h:48
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
xmlio::String
const char * String
Definition: TXMLSetup.cxx:94
TGLFontManager.h
TGLFont::SetFont
void SetFont(FTFont *f)
Definition: TGLFontManager.h:69
TGLFontManager::GetFontFileArray
static TObjArray * GetFontFileArray()
Get id to file name map.
Definition: TGLFontManager.cxx:552
TGLFont::fTrashCount
Int_t fTrashCount
Definition: TGLFontManager.h:52
TGLFontManager::GetExtendedFontStartIndex
static Int_t GetExtendedFontStartIndex()
Definition: TGLFontManager.cxx:569
TGLFontManager::GetFontSize
static Int_t GetFontSize(Int_t ds)
Get availabe font size.
Definition: TGLFontManager.cxx:581
UInt_t
unsigned int UInt_t
Definition: RtypesCore.h:46
y
Double_t y[n]
Definition: legend1.C:17
TGLFontManager::fFontMap
FontMap_t fFontMap
Definition: TGLFontManager.h:136
TGLFont::kExtrude
@ kExtrude
Definition: TGLFontManager.h:30
TGLFontManager::fgFontFileArray
static TObjArray fgFontFileArray
Definition: TGLFontManager.h:139
TGLFont::kBottom
@ kBottom
Definition: TGLFontManager.h:34
unsigned int
TMath::BinarySearch
Long64_t BinarySearch(Long64_t n, const T *array, T value)
Definition: TMathBase.h:278
gSystem
R__EXTERN TSystem * gSystem
Definition: TSystem.h:559
TGLFont::kRight
@ kRight
Definition: TGLFontManager.h:33
Double_t
double Double_t
Definition: RtypesCore.h:59
TGLFont::SetDepth
void SetDepth(Float_t d)
Definition: TGLFontManager.h:75
TGLFont::fFont
FTFont * fFont
Definition: TGLFontManager.h:39
TGLFontManager::InitStatics
static void InitStatics()
Create a list of available font files and allowed font sizes.
Definition: TGLFontManager.cxx:623
kUndef
@ kUndef
Definition: XProofProtocol.h:109
file
Definition: file.py:1
TGLFont::~TGLFont
virtual ~TGLFont()
Destructor.
Definition: TGLFontManager.cxx:87
TGLFontManager::RegisterFont
void RegisterFont(Int_t size, Int_t file, TGLFont::EMode mode, TGLFont &out)
Provide font with given size, file and FTGL class.
Definition: TGLFontManager.cxx:442
TGLFontManager::FontList_i
std::list< const TGLFont * >::iterator FontList_i
Definition: TGLFontManager.h:133
TGLFont::fMode
EMode fMode
Definition: TGLFontManager.h:50
TGLFont::GetFile
Int_t GetFile() const
Definition: TGLFontManager.h:62
name
char name[80]
Definition: TGX11.cxx:110
TGLUtil.h
TGLFont::CopyAttributes
void CopyAttributes(const TGLFont &o)
Assignment operator.
Definition: TGLFontManager.cxx:95
TIter
Definition: TCollection.h:233
fSize
size_t fSize
Definition: DeclareConverters.h:342
TROOT::GetTTFFontDir
static const TString & GetTTFFontDir()
Get the fonts directory in the installation. Static utility function.
Definition: TROOT.cxx:3101
xmlio::cnt
const char * cnt
Definition: TXMLSetup.cxx:75
sqlio::Char
const char * Char
Definition: TSQLStructure.cxx:70
TGLFont::GetMode
EMode GetMode() const
Definition: TGLFontManager.h:63
TGLFont::GetLineHeight
Float_t GetLineHeight() const
Get font's line-height.
Definition: TGLFontManager.cxx:131
TGLFont::PostRender
virtual void PostRender() const
Reset GL state after FTFont rendering.
Definition: TGLFontManager.cxx:406
TMath.h
int
Error
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition: TError.cxx:187