46 ITexture* getTextureFont()
const override;
49 int getDefaultHeight()
const override;
52 void textureInvalidate(
ITexture* _texture)
override;
56 std::vector<std::pair<Char, Char>> getCodePointRanges()
const;
60 Char getSubstituteCodePoint()
const;
65 void setSource(std::string_view _value);
66 void setShader(std::string_view _value);
67 void setSize(
float _value);
68 void setResolution(
unsigned int _value);
69 void setHinting(std::string_view _value);
70 void setAntialias(
bool _value);
71 void setTabWidth(
float _value);
72 void setOffsetHeight(
int _value);
73 void setSubstituteCode(
int _value);
74 void setDistance(
int _value);
75 void setMsdfMode(
bool _value);
76 void setMsdfRange(
int _value);
78 void addCodePointRange(
Char _first,
Char _second);
79 void removeCodePointRange(
Char _first,
Char _second);
81#ifdef MYGUI_USE_FREETYPE
91 void addCodePoint(
Char _codePoint);
92 void removeCodePoint(
Char _codePoint);
94 void clearCodePoints();
100 unsigned int mResolution{96};
101 Hinting mHinting{HintingUseNative};
104 float mSpaceWidth{0.0f};
105 int mGlyphSpacing{-1};
106 float mTabWidth{0.0f};
109 Char mSubstituteCodePoint{
static_cast<Char>(
117 int mDefaultHeight{0};
118 GlyphInfo* mSubstituteGlyphInfo{
124 mDefaultGlyphSpacing;
125 static const float mDefaultTabWidth;
128 static const float mCursorWidth;
132 using CharMap = std::map<Char, FT_UInt>;
135 using GlyphMap = std::unordered_map<Char, GlyphInfo>;
138 using GlyphHeightMap = std::map<int, std::map<FT_UInt, GlyphInfo*>>;
140 template<
bool LAMode,
bool Antialias>
141 void initialiseFreeType();
148 FT_Face loadFace(
const FT_Library& _ftLibrary, uint8*& _fontBuffer);
152 void autoWrapGlyphPos(
int _glyphWidth,
int _texWidth,
int _lineHeight,
int& _texX,
int& _texY)
const;
155 GlyphInfo createFaceGlyphInfo(Char _codePoint,
int _fontAscent, FT_GlyphSlot _glyph)
const;
159 int createGlyph(FT_UInt _glyphIndex,
const GlyphInfo& _glyphInfo, GlyphHeightMap& _glyphHeightMap);
167 const FT_Face& _ftFace,
168 FT_Int32 _ftLoadFlags,
169 GlyphHeightMap& _glyphHeightMap);
172 template<
bool LAMode,
bool Antialias>
174 const GlyphHeightMap& _glyphHeightMap,
175 const FT_Library& _ftLibrary,
176 const FT_Face& _ftFace,
177 FT_Int32 _ftLoadFlags,
185 template<
bool LAMode,
bool UseBuffer,
bool Antialias>
197 uint8* _glyphBuffer =
nullptr);
202 #ifdef MYGUI_MSDF_FONTS
203 GlyphInfo createMsdfFaceGlyphInfo(
205 const msdfgen::Shape& _shape,
208 int createMsdfGlyph(
const GlyphInfo& _glyphInfo, GlyphHeightMap& _glyphHeightMap);
209 int createMsdfFaceGlyph(
212 msdfgen::FontHandle* _fontHandle,
213 GlyphHeightMap& _glyphHeightMap);
215 void renderMsdfGlyphs(
216 const GlyphHeightMap& _glyphHeightMap,
217 msdfgen::FontHandle* _fontHandle,