22 #ifndef __MYGUI_RESOURCE_TRUE_TYPE_FONT_H__
23 #define __MYGUI_RESOURCE_TRUE_TYPE_FONT_H__
29 #ifdef MYGUI_USE_FREETYPE
31 #include FT_FREETYPE_H
32 #endif // MYGUI_USE_FREETYPE
44 virtual ~ResourceTrueTypeFont();
55 virtual
int getDefaultHeight();
59 std::vector<std::pair<
Char, Char> > getCodePointRanges() const;
63 Char getSubstituteCodePoint() const;
66 void addCodePoint(Char _codePoint);
67 void removeCodePoint(Char _codePoint);
69 void addCodePointRange(Char _first, Char _second);
70 void removeCodePointRange(Char _first, Char _second);
72 void clearCodePoints();
84 Char mSubstituteCodePoint;
92 static const
int mGlyphSpacing;
93 static const
float mSelectedWidth;
94 static const
float mCursorWidth;
96 #ifdef MYGUI_USE_FREETYPE
100 typedef std::map<Char, FT_UInt> CharMap;
103 typedef std::map<FT_UInt, GlyphInfo> GlyphMap;
106 typedef std::map<FT_Pos, std::map<FT_UInt, GlyphInfo*> > GlyphHeightMap;
108 template<
bool LAMode,
bool Antialias>
109 void initialiseFreeType();
116 FT_Face loadFace(
const FT_Library& _ftLibrary,
uint8*& _fontBuffer);
120 void autoWrapGlyphPos(
int _glyphWidth,
int _texWidth,
int _lineHeight,
int& _texX,
int& _texY);
123 GlyphInfo createFaceGlyphInfo(Char _codePoint,
int _fontAscent, FT_GlyphSlot _glyph);
127 int createGlyph(FT_UInt _glyphIndex,
const GlyphInfo& _glyphInfo, GlyphHeightMap& _glyphHeightMap);
131 int createFaceGlyph(FT_UInt _glyphIndex, Char _codePoint,
int _fontAscent,
const FT_Face& _face, GlyphHeightMap& _glyphHeightMap);
134 template<
bool LAMode,
bool Antialias>
135 void renderGlyphs(
const GlyphHeightMap& _glyphHeightMap,
const FT_Library& _ftLibrary,
const FT_Face& _face,
uint8* _texBuffer,
int _texWidth,
int _texHeight);
140 template<
bool LAMode,
bool UseBuffer,
bool Antialias>
141 void renderGlyph(
GlyphInfo& _info,
uint8 _luminance0,
uint8 _luminance1,
uint8 _alpha,
int _lineHeight,
uint8* _texBuffer,
int _texWidth,
int _texHeight,
int& _texX,
int& _texY,
uint8* _glyphBuffer =
nullptr);
146 #endif // MYGUI_USE_FREETYPE
152 #endif // __MYGUI_RESOURCE_TRUE_TYPE_FONT_H__