7 #ifndef __MYGUI_RESOURCE_TRUE_TYPE_FONT_H__
8 #define __MYGUI_RESOURCE_TRUE_TYPE_FONT_H__
14 #ifdef MYGUI_USE_FREETYPE
15 # include <ft2build.h>
16 # include FT_FREETYPE_H
17 #endif // MYGUI_USE_FREETYPE
29 virtual ~ResourceTrueTypeFont();
40 virtual
int getDefaultHeight();
44 std::vector<std::pair<
Char, Char> > getCodePointRanges() const;
48 Char getSubstituteCodePoint() const;
53 void setSource(const std::
string& _value);
54 void setSize(
float _value);
55 void setResolution(
uint _value);
56 void setHinting(const std::
string& _value);
57 void setAntialias(
bool _value);
58 void setTabWidth(
float _value);
59 void setOffsetHeight(
int _value);
60 void setSubstituteCode(
int _value);
61 void setDistance(
int _value);
63 void addCodePointRange(Char _first, Char _second);
64 void removeCodePointRange(Char _first, Char _second);
66 #ifdef MYGUI_USE_FREETYPE
76 void addCodePoint(Char _codePoint);
77 void removeCodePoint(Char _codePoint);
79 void clearCodePoints();
91 Char mSubstituteCodePoint;
99 static const int mDefaultGlyphSpacing;
100 static const float mDefaultTabWidth;
101 static const float mSelectedWidth;
102 static const float mCursorWidth;
106 typedef std::map<Char, FT_UInt> CharMap;
109 typedef std::map<FT_UInt, GlyphInfo> GlyphMap;
112 typedef std::map<FT_Pos, std::map<FT_UInt, GlyphInfo*> > GlyphHeightMap;
114 template<
bool LAMode,
bool Antialias>
115 void initialiseFreeType();
122 FT_Face loadFace(
const FT_Library& _ftLibrary,
uint8*& _fontBuffer);
126 void autoWrapGlyphPos(
int _glyphWidth,
int _texWidth,
int _lineHeight,
int& _texX,
int& _texY);
129 GlyphInfo createFaceGlyphInfo(Char _codePoint,
int _fontAscent, FT_GlyphSlot _glyph);
133 int createGlyph(FT_UInt _glyphIndex,
const GlyphInfo& _glyphInfo, GlyphHeightMap& _glyphHeightMap);
137 int createFaceGlyph(FT_UInt _glyphIndex, Char _codePoint,
int _fontAscent,
const FT_Face& _ftFace, FT_Int32 _ftLoadFlags, GlyphHeightMap& _glyphHeightMap);
140 template<
bool LAMode,
bool Antialias>
141 void renderGlyphs(
const GlyphHeightMap& _glyphHeightMap,
const FT_Library& _ftLibrary,
const FT_Face& _ftFace, FT_Int32 _ftLoadFlags,
uint8* _texBuffer,
int _texWidth,
int _texHeight);
146 template<
bool LAMode,
bool UseBuffer,
bool Antialias>
147 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);
152 #endif // MYGUI_USE_FREETYPE
158 #endif // __MYGUI_RESOURCE_TRUE_TYPE_FONT_H__