7#ifndef MYGUI_RESOURCE_TRUE_TYPE_FONT_H_
8#define MYGUI_RESOURCE_TRUE_TYPE_FONT_H_
14#ifdef MYGUI_USE_FREETYPE
16 #include FT_FREETYPE_H
18 #ifdef MYGUI_MSDF_FONTS
28#include <unordered_map>
81#ifdef MYGUI_USE_FREETYPE
91 void addCodePoint(
Char _codePoint);
97 unsigned int mResolution{96};
98 Hinting mHinting{HintingUseNative};
101 float mSpaceWidth{0.0f};
102 int mGlyphSpacing{-1};
103 float mTabWidth{0.0f};
106 Char mSubstituteCodePoint{
static_cast<Char>(
114 int mDefaultHeight{0};
115 GlyphInfo* mSubstituteGlyphInfo{
117 MyGUI::ITexture* mTexture{
nullptr};
121 mDefaultGlyphSpacing;
122 static const float mDefaultTabWidth;
125 static const float mCursorWidth;
129 using CharMap = std::map<Char, FT_UInt>;
132 using GlyphMap = std::unordered_map<Char, GlyphInfo>;
135 using GlyphHeightMap = std::map<int, std::map<FT_UInt, GlyphInfo*>>;
137 template<
bool LAMode,
bool Antialias>
138 void initialiseFreeType();
145 FT_Face loadFace(
const FT_Library& _ftLibrary, uint8*& _fontBuffer);
149 void autoWrapGlyphPos(
int _glyphWidth,
int _texWidth,
int _lineHeight,
int& _texX,
int& _texY)
const;
152 GlyphInfo createFaceGlyphInfo(Char _codePoint,
int _fontAscent, FT_GlyphSlot _glyph)
const;
156 int createGlyph(FT_UInt _glyphIndex,
const GlyphInfo& _glyphInfo, GlyphHeightMap& _glyphHeightMap);
164 const FT_Face& _ftFace,
165 FT_Int32 _ftLoadFlags,
166 GlyphHeightMap& _glyphHeightMap);
169 template<
bool LAMode,
bool Antialias>
171 const GlyphHeightMap& _glyphHeightMap,
172 const FT_Library& _ftLibrary,
173 const FT_Face& _ftFace,
174 FT_Int32 _ftLoadFlags,
182 template<
bool LAMode,
bool UseBuffer,
bool Antialias>
194 uint8* _glyphBuffer =
nullptr);
199 #ifdef MYGUI_MSDF_FONTS
200 GlyphInfo createMsdfFaceGlyphInfo(
202 const msdfgen::Shape& _shape,
205 int createMsdfGlyph(
const GlyphInfo& _glyphInfo, GlyphHeightMap& _glyphHeightMap);
206 int createMsdfFaceGlyph(
209 msdfgen::FontHandle* _fontHandle,
210 GlyphHeightMap& _glyphHeightMap);
212 void renderMsdfGlyphs(
213 const GlyphHeightMap& _glyphHeightMap,
214 msdfgen::FontHandle* _fontHandle,
#define MYGUI_RTTI_DERIVED(DerivedType)
void setAntialias(bool _value)
void setMsdfMode(bool _value)
void setMsdfRange(int _value)
void setShader(std::string_view _value)
void setResolution(unsigned int _value)
void setSource(std::string_view _value)
void textureInvalidate(ITexture *_texture) override
void setOffsetHeight(int _value)
const GlyphInfo * getGlyphInfo(Char _id) const override
void removeCodePointRange(Char _first, Char _second)
void setSubstituteCode(int _value)
void addCodePointRange(Char _first, Char _second)
void setHinting(std::string_view _value)
~ResourceTrueTypeFont() override
ITexture * getTextureFont() const override
std::vector< std::pair< Char, Char > > getCodePointRanges() const
void deserialization(xml::ElementPtr _node, Version _version) override
void setSize(float _value)
int getDefaultHeight() const override
Char getSubstituteCodePoint() const
void setDistance(int _value)
void setTabWidth(float _value)