12#include "RConfigure.h"
23#include "TGLIncludes.h"
28# include <FTGL/ftgl.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"
46 for (
auto i = 0
UL; 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)));
72 fFont(0), fManager(0), fDepth(0),
73 fSize(0), fFile(0), fMode(kUndef),
82 fFont(
f), fManager(
mng), fDepth(0),
92 fFont(0), fManager(0), fDepth(0), fTrashCount(0)
136 return fFont->Ascender();
144 return -
fFont->Descender();
152 return fFont->LineHeight();
161 const char*
txt)
const
424 Warning(
"TGLFont::PreRender",
"Font mode undefined.");
464 delete it->first.GetFont();
518 Error(
"TGLFontManager::RegisterFont",
"invalid FTGL type");
528 if (it->first.GetTrashCount() > 0) {
530 it->first.SetTrashCount(0);
557 Error(
"TGLFontManager::RegisterFont",
"unknown font name %s",
name);
573 assert(it->first.GetTrashCount() == 0);
574 it->first.IncTrashCount();
619 if (idx < 0) idx = 0;
628 if (
ds < min)
ds = min;
629 if (
ds > max)
ds = max;
717 for (
Int_t i = 10; i <= 20; i+=2)
719 for (
Int_t i = 24; i <= 64; i+=4)
721 for (
Int_t i = 72; i <= 128; i+=8)
735 if ((*it)->IncTrashCount() > 10000)
740 delete (*it)->GetFont();
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
bool Bool_t
Boolean (0=false, 1=true) (bool)
int Int_t
Signed integer 4 bytes (int)
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
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
R__EXTERN TSystem * gSystem
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
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.
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)
Float_t GetLineHeight() const
Get font's line-height.
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.
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.
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.
virtual void PreRender(Bool_t autoLight=kTRUE, Bool_t lightOn=kFALSE) const
Set-up GL state before FTFont rendering.
void CopyAttributes(const TGLFont &o)
Assignment operator.
Collectable string class.
static const TString & GetTTFFontDir()
Get the fonts directory in the installation. Static utility function.
const char * Data() const
virtual char * Which(const char *search, const char *file, EAccessMode mode=kFileExists)
Find location of file in a search path.
Int_t CeilNint(Double_t x)
Returns the nearest integer of TMath::Ceil(x).
Long64_t BinarySearch(Long64_t n, const T *array, T value)
Binary search in an array of n values to locate value.