#ifndef ROOT_TTF
#define ROOT_TTF
#ifndef ROOT_Rtypes
#include "Rtypes.h"
#endif
extern "C" {
struct FT_LibraryRec_;
struct FT_FaceRec_;
struct FT_CharMapRec_;
struct FT_GlyphRec_;
struct FT_Matrix_;
struct FT_Bitmap_;
typedef struct FT_LibraryRec_* FT_Library;
typedef struct FT_FaceRec_* FT_Face;
typedef struct FT_CharMapRec_* FT_CharMap;
typedef struct FT_GlyphRec_* FT_Glyph;
typedef struct FT_Matrix_ FT_Matrix;
typedef struct FT_Bitmap_ FT_Bitmap;
typedef signed long FT_Pos;
#ifndef FT_FREETYPE_H
struct FT_Vector_ { FT_Pos x, y; };
struct FT_BBox_ { FT_Pos xMin, yMin, xMax, yMax; };
#endif
typedef struct FT_Vector_ FT_Vector;
typedef struct FT_BBox_ FT_BBox;
}
class TTGlyph {
public:
UInt_t fIndex;
FT_Vector fPos;
FT_Glyph fImage;
};
class TGX11TTF;
class TGWin32;
class TMathTextRenderer;
class TTF {
friend class TGX11TTF;
friend class TGWin32;
friend class TMathTextRenderer;
protected:
enum { kTTMaxFonts = 32, kMaxGlyphs = 1024 };
static Int_t fgAscent;
static FT_BBox fgCBox;
static FT_CharMap fgCharMap[kTTMaxFonts];
static Int_t fgCurFontIdx;
static Int_t fgSymbItaFontIdx;
static Int_t fgFontCount;
static char *fgFontName[kTTMaxFonts];
static FT_Face fgFace[kTTMaxFonts];
static TTGlyph fgGlyphs[kMaxGlyphs];
static Bool_t fgHinting;
static Bool_t fgInit;
static Bool_t fgKerning;
static FT_Library fgLibrary;
static Int_t fgNumGlyphs;
static FT_Matrix *fgRotMatrix;
static Bool_t fgSmoothing;
static Int_t fgTBlankW;
static Int_t fgWidth;
public:
static Short_t CharToUnicode(UInt_t code);
static void LayoutGlyphs();
static void PrepareString(const char *string);
static void PrepareString(const wchar_t *string);
static void SetRotationMatrix(Float_t angle);
public:
TTF() { }
virtual ~TTF();
static void Init();
static void Cleanup();
static Int_t GetAscent();
static const FT_BBox &GetBox();
static TTGlyph *GetGlyphs();
static Bool_t GetHinting();
static Bool_t GetKerning();
static Int_t GetNumGlyphs();
static FT_Matrix *GetRotMatrix();
static Bool_t GetSmoothing();
static Int_t GetWidth();
static void SetHinting(Bool_t state);
static void SetKerning(Bool_t state);
static void SetSmoothing(Bool_t state);
static void GetTextExtent(UInt_t &w, UInt_t &h, char *text);
static void GetTextExtent(UInt_t &w, UInt_t &h, wchar_t *text);
static void GetTextAdvance(UInt_t &a, char *text);
static void SetTextFont(Font_t fontnumber);
static Int_t SetTextFont(const char *fontname, Int_t italic=0);
static void SetTextSize(Float_t textsize);
static Bool_t IsInitialized();
static void Version(Int_t &major, Int_t &minor, Int_t &patch);
ClassDef(TTF,0)
};
#endif