Warning, file /include/root/TTF.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef ROOT_TTF
0014 #define ROOT_TTF
0015
0016
0017 #include "Rtypes.h"
0018
0019
0020
0021
0022
0023
0024 extern "C" {
0025 struct FT_LibraryRec_;
0026 struct FT_FaceRec_;
0027 struct FT_CharMapRec_;
0028 struct FT_GlyphRec_;
0029 struct FT_Matrix_;
0030 struct FT_Bitmap_;
0031 typedef struct FT_LibraryRec_* FT_Library;
0032 typedef struct FT_FaceRec_* FT_Face;
0033 typedef struct FT_CharMapRec_* FT_CharMap;
0034 typedef struct FT_GlyphRec_* FT_Glyph;
0035 typedef struct FT_Matrix_ FT_Matrix;
0036 typedef struct FT_Bitmap_ FT_Bitmap;
0037 typedef signed long FT_Pos;
0038 #ifndef FT_FREETYPE_H
0039 struct FT_Vector_ { FT_Pos x, y; };
0040 struct FT_BBox_ { FT_Pos xMin, yMin, xMax, yMax; };
0041 #endif
0042 typedef struct FT_Vector_ FT_Vector;
0043 typedef struct FT_BBox_ FT_BBox;
0044 }
0045
0046
0047
0048 class TGX11TTF;
0049 class TGWin32;
0050 class TMathTextRenderer;
0051
0052
0053 class TTF {
0054
0055 friend class TGX11TTF;
0056 friend class TGWin32;
0057 friend class TMathTextRenderer;
0058
0059 public:
0060
0061
0062
0063
0064
0065 class TTGlyph {
0066 public:
0067 UInt_t fIndex{0};
0068 FT_Vector fPos;
0069 FT_Glyph fImage{nullptr};
0070 };
0071
0072 protected:
0073 enum { kTTMaxFonts = 32, kMaxGlyphs = 1024 };
0074
0075 static Int_t fgAscent;
0076 static FT_BBox fgCBox;
0077 static FT_CharMap fgCharMap[kTTMaxFonts];
0078 static Int_t fgCurFontIdx;
0079 static Int_t fgSymbItaFontIdx;
0080 static Int_t fgFontCount;
0081 static char *fgFontName[kTTMaxFonts];
0082 static FT_Face fgFace[kTTMaxFonts];
0083 static TTF::TTGlyph fgGlyphs[kMaxGlyphs];
0084 static Bool_t fgHinting;
0085 static Bool_t fgInit;
0086 static Bool_t fgKerning;
0087 static FT_Library fgLibrary;
0088 static Int_t fgNumGlyphs;
0089 static FT_Matrix *fgRotMatrix;
0090 static Bool_t fgSmoothing;
0091 static Int_t fgTBlankW;
0092 static Int_t fgWidth;
0093
0094 public:
0095 static Short_t CharToUnicode(UInt_t code);
0096 static void LayoutGlyphs();
0097 static void PrepareString(const char *string);
0098 static void PrepareString(const wchar_t *string);
0099 static void SetRotationMatrix(Float_t angle);
0100
0101 public:
0102 TTF() { }
0103 virtual ~TTF();
0104
0105 static void Init();
0106 static void Cleanup();
0107 static Int_t GetAscent();
0108 static const FT_BBox &GetBox();
0109 static TTGlyph *GetGlyphs();
0110 static Bool_t GetHinting();
0111 static Bool_t GetKerning();
0112 static Int_t GetNumGlyphs();
0113 static FT_Matrix *GetRotMatrix();
0114 static Bool_t GetSmoothing();
0115 static Int_t GetWidth();
0116 static void SetHinting(Bool_t state);
0117 static void SetKerning(Bool_t state);
0118 static void SetSmoothing(Bool_t state);
0119 static void GetTextExtent(UInt_t &w, UInt_t &h, char *text);
0120 static void GetTextExtent(UInt_t &w, UInt_t &h, wchar_t *text);
0121 static void GetTextAdvance(UInt_t &a, char *text);
0122 static void SetTextFont(Font_t fontnumber);
0123 static Int_t SetTextFont(const char *fontname, Int_t italic=0);
0124 static void SetTextSize(Float_t textsize);
0125 static Bool_t IsInitialized();
0126 static void Version(Int_t &major, Int_t &minor, Int_t &patch);
0127
0128 ClassDef(TTF,0)
0129 };
0130
0131 #endif