14#ifdef MYGUI_USE_FREETYPE
17 #include FT_TRUETYPE_TABLES_H
19 #include FT_WINFONTS_H
21 #ifdef MYGUI_MSDF_FONTS
22 #include "msdfgen/msdfgen.h"
23 #include "msdfgen/msdfgen-ext.h"
31#ifndef MYGUI_USE_FREETYPE
39 "ResourceTrueTypeFont: TrueType font '"
40 <<
getResourceName() <<
"' disabled. Define MYGUI_USE_FREETYE if you need TrueType fonts.");
64 return std::vector<std::pair<Char, Char>>();
137 void setMax(T& _var,
const T& _newValue)
139 if (_var < _newValue)
143 const std::map<const Char, const uint8> charMask{
148 const uint8 charMaskBlack = 0x00;
149 const uint8 charMaskWhite = 0xFF;
151 template<
bool LAMode>
154 static PixelFormat::Enum getFormat()
156 if constexpr (LAMode)
157 return PixelFormat::L8A8;
159 return PixelFormat::R8G8B8A8;
162 static size_t getNumBytes()
164 if constexpr (LAMode)
173 static void set(uint8*& _dest, uint8 _luminance, uint8 _alpha)
175 if constexpr (LAMode)
177 *_dest++ = _luminance;
182 *_dest++ = _luminance;
183 *_dest++ = _luminance;
184 *_dest++ = _luminance;
190 template<
bool LAMode,
bool FromSource = false,
bool Antialias = false>
191 struct Pixel : PixelBase<LAMode>
198 static void set(uint8*& _dest, uint8 _luminance, uint8 _alpha, uint8*& _source)
200 if constexpr (FromSource)
203 if constexpr (Antialias)
207 PixelBase<LAMode>::set(_dest, *_source, *_source);
212 PixelBase<LAMode>::set(_dest, _luminance, *_source);
220 PixelBase<LAMode>::set(_dest, _luminance, _alpha);
226 const int ResourceTrueTypeFont::mDefaultGlyphSpacing = 1;
227 const float ResourceTrueTypeFont::mDefaultTabWidth = 8.0f;
228 const float ResourceTrueTypeFont::mSelectedWidth = 1.0f;
229 const float ResourceTrueTypeFont::mCursorWidth = 2.0f;
233 if (mTexture !=
nullptr)
244 xml::ElementEnumerator node = _node->getElementEnumerator();
247 if (node->getName() ==
"Property")
249 std::string_view key = node->findAttribute(
"key");
250 std::string_view value = node->findAttribute(
"value");
253 else if (key ==
"Shader")
255 else if (key ==
"Size")
257 else if (key ==
"Resolution")
259 else if (key ==
"Antialias")
261 else if (key ==
"TabWidth")
263 else if (key ==
"OffsetHeight")
265 else if (key ==
"SubstituteCode")
267 else if (key ==
"Distance")
269 else if (key ==
"Hinting")
271 else if (key ==
"SpaceWidth")
276 _node->findAttribute(
"type")
277 <<
": Property '" << key <<
"' in font '" << _node->findAttribute(
"name")
278 <<
"' is deprecated; remove it to use automatic calculation.");
280 else if (key ==
"CursorWidth")
284 _node->findAttribute(
"type")
285 <<
": Property '" << key <<
"' in font '" << _node->findAttribute(
"name")
286 <<
"' is deprecated; value ignored.");
288 else if (key ==
"MsdfMode")
292 else if (key ==
"MsdfRange")
297 else if (node->getName() ==
"Codes")
300 xml::ElementEnumerator range = node->getElementEnumerator();
301 while (range.next(
"Code"))
303 std::string range_value;
304 if (range->findAttribute(
"range", range_value))
306 std::vector<std::string> parse_range =
utility::split(range_value);
307 if (!parse_range.empty())
318 if (mCharMap.empty())
322 range = node->getElementEnumerator();
323 while (range.next(
"Code"))
325 std::string range_value;
326 if (range->findAttribute(
"hide", range_value))
328 std::vector<std::string> parse_range =
utility::split(range_value);
329 if (!parse_range.empty())
345 GlyphMap::const_iterator glyphIter = mGlyphMap.find(_id);
347 if (glyphIter != mGlyphMap.end())
349 return &glyphIter->second;
352 return mSubstituteGlyphInfo;
362 return mDefaultHeight;
373 std::vector<std::pair<Char, Char>> result;
375 if (!mCharMap.empty())
377 CharMap::const_iterator iter = mCharMap.begin();
378 CharMap::const_iterator endIter = mCharMap.end();
381 Char rangeBegin = iter->first;
382 Char rangeEnd = rangeBegin;
385 for (++iter; iter != endIter; ++iter)
387 if (iter->first == rangeEnd + 1)
395 result.emplace_back(rangeBegin, rangeEnd);
398 rangeBegin = rangeEnd = iter->first;
403 result.emplace_back(rangeBegin, rangeEnd);
411 return mSubstituteCodePoint;
414 void ResourceTrueTypeFont::addCodePoint(
Char _codePoint)
416 mCharMap.insert(CharMap::value_type(_codePoint, 0));
421 CharMap::iterator positionHint = mCharMap.lower_bound(_first);
423 if (positionHint != mCharMap.begin())
426 for (
Char i = _first; i <= _second; ++i)
427 positionHint = mCharMap.insert(positionHint, CharMap::value_type(i, 0));
432 mCharMap.erase(mCharMap.lower_bound(_first), mCharMap.upper_bound(_second));
437 if (mGlyphSpacing == -1)
438 mGlyphSpacing = mDefaultGlyphSpacing;
442 Pixel<true>::getFormat(),
453 ResourceTrueTypeFont::initialiseFreeType<true, true>();
455 ResourceTrueTypeFont::initialiseFreeType<true, false>();
460 ResourceTrueTypeFont::initialiseFreeType<false, true>();
462 ResourceTrueTypeFont::initialiseFreeType<false, false>();
466 template<
bool LAMode,
bool Antialias>
467 void ResourceTrueTypeFont::initialiseFreeType()
473 FT_Library ftLibrary;
475 if (FT_Init_FreeType(&ftLibrary) != 0)
476 MYGUI_EXCEPT(
"ResourceTrueTypeFont: Could not init the FreeType library!");
478 uint8* fontBuffer =
nullptr;
480 FT_Face ftFace = loadFace(ftLibrary, fontBuffer);
482 if (ftFace ==
nullptr)
485 FT_Done_FreeType(ftLibrary);
489 #ifdef MYGUI_MSDF_FONTS
490 msdfgen::FontHandle* msdfFont =
nullptr;
494 msdfFont = msdfgen::adoptFreetypeFont(ftFace);
506 int fontAscent = ftFace->size->metrics.ascender >> 6;
507 int fontDescent = -ftFace->size->metrics.descender >> 6;
509 TT_OS2* os2 = (TT_OS2*)FT_Get_Sfnt_Table(ftFace, ft_sfnt_os2);
513 setMax(fontAscent, os2->usWinAscent * ftFace->size->metrics.y_ppem / ftFace->units_per_EM);
514 setMax(fontDescent, os2->usWinDescent * ftFace->size->metrics.y_ppem / ftFace->units_per_EM);
516 setMax(fontAscent, os2->sTypoAscender * ftFace->size->metrics.y_ppem / ftFace->units_per_EM);
517 setMax(fontDescent, -os2->sTypoDescender * ftFace->size->metrics.y_ppem / ftFace->units_per_EM);
524 mDefaultHeight = fontAscent + fontDescent;
527 FT_Int32 ftLoadFlags = FT_LOAD_DEFAULT;
531 case HintingForceAuto: ftLoadFlags = FT_LOAD_FORCE_AUTOHINT;
break;
532 case HintingDisableAuto: ftLoadFlags = FT_LOAD_NO_AUTOHINT;
break;
533 case HintingDisableAll:
536 ftLoadFlags = FT_LOAD_NO_HINTING | FT_LOAD_RENDER;
538 case HintingUseNative: ftLoadFlags = FT_LOAD_DEFAULT;
break;
545 GlyphHeightMap glyphHeightMap;
553 for (CharMap::iterator iter = mCharMap.begin(); iter != mCharMap.end();)
555 const Char& codePoint = iter->first;
556 FT_UInt glyphIndex = FT_Get_Char_Index(ftFace, codePoint);
559 texWidth += createFaceGlyph(glyphIndex, codePoint, fontAscent, ftFace, ftLoadFlags, glyphHeightMap);
560 #ifdef MYGUI_MSDF_FONTS
562 texWidth += createMsdfFaceGlyph(codePoint, fontAscent, msdfFont, glyphHeightMap);
567 if (iter->second != 0)
570 mCharMap.erase(iter++);
576 if (spaceGlyphIter != mGlyphMap.end())
579 if (mSpaceWidth != 0.0f)
581 texWidth += (int)std::ceil(mSpaceWidth) - (int)std::ceil(spaceGlyphIter->second.width);
582 spaceGlyphIter->second.width = mSpaceWidth;
583 spaceGlyphIter->second.advance = mSpaceWidth;
587 if (mTabWidth == 0.0f)
588 mTabWidth = mDefaultTabWidth * spaceGlyphIter->second.advance;
594 FT_UInt nextGlyphIndex = (FT_UInt)ftFace->num_glyphs;
596 float height = (float)mDefaultHeight;
598 texWidth += createGlyph(
602 texWidth += createGlyph(
606 texWidth += createGlyph(
610 texWidth += createGlyph(
625 texWidth += createFaceGlyph(
632 #ifdef MYGUI_MSDF_FONTS
634 texWidth += createMsdfFaceGlyph(
643 mSubstituteGlyphInfo = &mGlyphMap.find(mSubstituteCodePoint)->second;
647 double averageGlyphHeight = 0.0;
649 for (
const auto& heightItem : glyphHeightMap)
650 averageGlyphHeight += heightItem.first * heightItem.second.size();
652 averageGlyphHeight /= mGlyphMap.size();
665 while (texWidth > texHeight)
678 if (texHeight > texWidth * 2)
681 int texX = mGlyphSpacing;
682 int texY = mGlyphSpacing;
684 for (
const auto& heightItem : glyphHeightMap)
686 for (
const auto& [key, info] : heightItem.second)
688 int glyphWidth = (int)std::ceil(info->width);
689 int glyphHeight = (int)std::ceil(info->height);
691 autoWrapGlyphPos(glyphWidth, texWidth, glyphHeight, texX, texY);
694 texX += mGlyphSpacing + glyphWidth;
699 }
while (texHeight > texWidth * 2);
715 mTexture->setInvalidateListener(
this);
717 if (!mShader.empty())
718 mTexture->setShader(mShader);
722 if (texBuffer !=
nullptr)
725 for (
uint8 *dest = texBuffer, *endDest = dest + texWidth * texHeight * Pixel<LAMode>::getNumBytes();
727 Pixel<LAMode, false, false>::set(dest, mMsdfMode ? charMaskBlack : charMaskWhite, charMaskBlack, dest);
730 renderGlyphs<LAMode, Antialias>(
738 #ifdef MYGUI_MSDF_FONTS
740 renderMsdfGlyphs(glyphHeightMap, msdfFont, texBuffer, texWidth, texHeight);
747 "ResourceTrueTypeFont: Font '"
748 <<
getResourceName() <<
"' using texture size " << texWidth <<
" x " << texHeight <<
".");
751 "ResourceTrueTypeFont: Font '"
752 <<
getResourceName() <<
"' using real height " << mDefaultHeight <<
" pixels.");
756 MYGUI_LOG(Error,
"ResourceTrueTypeFont: Error locking texture; pointer is nullptr.");
759 #ifdef MYGUI_MSDF_FONTS
762 msdfgen::destroyFont(msdfFont);
766 FT_Done_Face(ftFace);
767 FT_Done_FreeType(ftLibrary);
772 FT_Face ResourceTrueTypeFont::loadFace(
const FT_Library& _ftLibrary,
uint8*& _fontBuffer)
774 FT_Face result =
nullptr;
779 if (datastream ==
nullptr)
782 size_t fontBufferSize = datastream->
size();
783 _fontBuffer =
new uint8[fontBufferSize];
784 datastream->read(_fontBuffer, fontBufferSize);
787 datastream =
nullptr;
790 if (FT_New_Memory_Face(_ftLibrary, _fontBuffer, (FT_Long)fontBufferSize, -1, &result) != 0)
793 FT_Long numFaces = result->num_faces;
794 FT_Long faceIndex = 0;
797 if (FT_New_Memory_Face(_ftLibrary, _fontBuffer, (FT_Long)fontBufferSize, faceIndex, &result) != 0)
800 if (result->face_flags & FT_FACE_FLAG_SCALABLE)
804 FT_F26Dot6 ftSize = (FT_F26Dot6)(mSize * (1 << 6));
806 if (FT_Set_Char_Size(result, ftSize, 0, mResolution, mResolution) != 0)
810 if (mCharMap.empty())
816 FT_WinFNT_HeaderRec fnt;
820 std::map<float, FT_Long> faceSizes;
824 if (FT_Get_WinFNT_Header(result, &fnt) != 0)
828 std::make_pair((
float)fnt.nominal_point_size * fnt.vertical_resolution / mResolution, faceIndex));
830 FT_Done_Face(result);
832 if (++faceIndex < numFaces)
833 if (FT_New_Memory_Face(_ftLibrary, _fontBuffer, (FT_Long)fontBufferSize, faceIndex, &result) != 0)
835 }
while (faceIndex < numFaces);
837 std::map<float, FT_Long>::const_iterator iter = faceSizes.lower_bound(mSize);
839 faceIndex = (iter != faceSizes.end()) ? iter->second : faceSizes.rbegin()->second;
841 if (FT_New_Memory_Face(_ftLibrary, _fontBuffer, (FT_Long)fontBufferSize, faceIndex, &result) != 0)
846 if (FT_Select_Size(result, 0) != 0)
851 if (mCharMap.empty())
858 if (fnt.charset == FT_WinFNT_ID_CP1252)
870 if (fnt.charset == FT_WinFNT_ID_CP1252)
880 void ResourceTrueTypeFont::autoWrapGlyphPos(
int _glyphWidth,
int _texWidth,
int _lineHeight,
int& _texX,
int& _texY)
883 if (_glyphWidth > 0 && _texX + mGlyphSpacing + _glyphWidth > _texWidth)
885 _texX = mGlyphSpacing;
886 _texY += mGlyphSpacing + _lineHeight;
890 GlyphInfo ResourceTrueTypeFont::createFaceGlyphInfo(
Char _codePoint,
int _fontAscent, FT_GlyphSlot _glyph)
const
892 float bearingX = _glyph->metrics.horiBearingX / 64.0f;
900 std::max((
float)_glyph->bitmap.width, _glyph->metrics.width / 64.0f),
901 std::max((
float)_glyph->bitmap.rows, _glyph->metrics.height / 64.0f),
902 (_glyph->advance.x / 64.0f) - bearingX,
904 std::floor(_fontAscent - (_glyph->metrics.horiBearingY / 64.0f) - mOffsetHeight)};
907 int ResourceTrueTypeFont::createGlyph(
910 GlyphHeightMap& _glyphHeightMap)
912 int width = (int)std::ceil(_glyphInfo.width);
913 int height = (int)std::ceil(_glyphInfo.height);
915 mCharMap[_glyphInfo.codePoint] = _glyphIndex;
916 GlyphInfo& info = mGlyphMap.insert(GlyphMap::value_type(_glyphInfo.codePoint, _glyphInfo)).first->second;
917 _glyphHeightMap[height].insert(std::make_pair(_glyphIndex, &info));
919 return (width > 0) ? mGlyphSpacing + width : 0;
922 int ResourceTrueTypeFont::createFaceGlyph(
926 const FT_Face& _ftFace,
927 FT_Int32 _ftLoadFlags,
928 GlyphHeightMap& _glyphHeightMap)
930 if (mGlyphMap.find(_codePoint) == mGlyphMap.end())
932 if (FT_Load_Glyph(_ftFace, _glyphIndex, _ftLoadFlags) == 0)
935 createFaceGlyphInfo(_codePoint, _fontAscent, _ftFace->glyph),
939 "ResourceTrueTypeFont: Cannot load glyph "
940 << _glyphIndex <<
" for character " << _codePoint <<
" in font '" <<
getResourceName() <<
"'.");
944 mCharMap[_codePoint] = _glyphIndex;
950 template<
bool LAMode,
bool Antialias>
951 void ResourceTrueTypeFont::renderGlyphs(
952 const GlyphHeightMap& _glyphHeightMap,
953 const FT_Library& _ftLibrary,
954 const FT_Face& _ftFace,
955 FT_Int32 _ftLoadFlags,
961 FT_Bitmap_New(&ftBitmap);
963 int texX = mGlyphSpacing;
964 int texY = mGlyphSpacing;
966 for (
const auto& sameHeightGlyphs : _glyphHeightMap)
968 int glyphHeight = sameHeightGlyphs.first;
969 for (
const auto& glyph : sameHeightGlyphs.second)
971 GlyphInfo& info = *glyph.second;
973 switch (info.codePoint)
978 renderGlyph<LAMode, false, false>(
982 charMask.find(info.codePoint)->second,
992 GlyphMap::iterator glyphIter = mGlyphMap.find(info.codePoint);
993 if (glyphIter != mGlyphMap.end())
995 glyphIter->second.width = 0.0f;
996 glyphIter->second.uvRect.right = glyphIter->second.uvRect.left;
1003 renderGlyph<LAMode, false, false>(
1007 charMask.find(info.codePoint)->second,
1017 if (FT_Load_Glyph(_ftFace, glyph.first, _ftLoadFlags | FT_LOAD_RENDER) == 0)
1019 if (_ftFace->glyph->bitmap.buffer !=
nullptr)
1021 uint8* glyphBuffer =
nullptr;
1023 switch (_ftFace->glyph->bitmap.pixel_mode)
1025 case FT_PIXEL_MODE_GRAY: glyphBuffer = _ftFace->glyph->bitmap.buffer;
break;
1027 case FT_PIXEL_MODE_MONO:
1029 if (FT_Bitmap_Convert(_ftLibrary, &_ftFace->glyph->bitmap, &ftBitmap, 1) == 0)
1032 for (
uint8 *p = ftBitmap.buffer, *endP = p + ftBitmap.width * ftBitmap.rows;
1037 glyphBuffer = ftBitmap.buffer;
1042 if (glyphBuffer !=
nullptr)
1043 renderGlyph<LAMode, true, Antialias>(
1061 "ResourceTrueTypeFont: Cannot render glyph "
1062 << glyph.first <<
" for character " << info.codePoint <<
" in font '"
1070 FT_Bitmap_Done(_ftLibrary, &ftBitmap);
1073 template<
bool LAMode,
bool UseBuffer,
bool Antialias>
1074 void ResourceTrueTypeFont::renderGlyph(
1085 uint8* _glyphBuffer)
1087 int width = (int)std::ceil(_info.width);
1088 int height = (int)std::ceil(_info.height);
1090 autoWrapGlyphPos(width, _texWidth, _lineHeight, _texX, _texY);
1092 uint8* dest = _texBuffer + (_texY * _texWidth + _texX) * Pixel<LAMode>::getNumBytes();
1095 ptrdiff_t destNextRow = (_texWidth - width) * Pixel<LAMode>::getNumBytes();
1097 if (!mMsdfMode || !UseBuffer)
1099 for (
int j = height; j > 0; --j)
1102 for (i = width; i > 1; i -= 2)
1104 Pixel<LAMode, UseBuffer, Antialias>::set(dest, _luminance0, _alpha, _glyphBuffer);
1105 Pixel<LAMode, UseBuffer, Antialias>::set(dest, _luminance1, _alpha, _glyphBuffer);
1109 Pixel<LAMode, UseBuffer, Antialias>::set(dest, _luminance0, _alpha, _glyphBuffer);
1111 dest += destNextRow;
1116 for (
int y = 0; y < height; ++y)
1118 for (
int x = 0; x < width; ++x)
1120 for (
int i = 0; i < 3; ++i)
1122 *dest++ = *_glyphBuffer++;
1127 dest += destNextRow;
1132 _info.uvRect.left = (float)_texX / _texWidth;
1133 _info.uvRect.top = (float)_texY / _texHeight;
1134 _info.uvRect.right = (float)(_texX + _info.width) / _texWidth;
1135 _info.uvRect.bottom = (float)(_texY + _info.height) / _texHeight;
1138 _texX += mGlyphSpacing + width;
1141 #ifdef MYGUI_MSDF_FONTS
1142 GlyphInfo ResourceTrueTypeFont::createMsdfFaceGlyphInfo(
1144 const msdfgen::Shape& _shape,
1148 msdfgen::Shape::Bounds bounds = _shape.getBounds();
1149 double range = mMsdfRange / 2.0;
1150 if (_shape.contours.empty())
1152 bounds = {0, 0, 0, 0};
1156 double bearingX = bounds.l;
1160 bounds.r - bounds.l + 2 * range,
1161 bounds.t - bounds.b + 2 * range,
1162 _advance - bearingX + range,
1164 std::floor(_fontAscent - bounds.t - mOffsetHeight - range));
1167 int ResourceTrueTypeFont::createMsdfGlyph(
const GlyphInfo& _glyphInfo, GlyphHeightMap& _glyphHeightMap)
1169 int width = (int)std::ceil(_glyphInfo.width);
1170 int height = (int)std::ceil(_glyphInfo.height);
1172 mCharMap[_glyphInfo.codePoint] = _glyphInfo.codePoint;
1173 GlyphInfo& info = mGlyphMap.insert(GlyphMap::value_type(_glyphInfo.codePoint, _glyphInfo)).first->second;
1174 _glyphHeightMap[height].insert(std::make_pair(_glyphInfo.codePoint, &info));
1176 return (width > 0) ? mGlyphSpacing + width : 0;
1179 int ResourceTrueTypeFont::createMsdfFaceGlyph(
1182 msdfgen::FontHandle* _fontHandle,
1183 GlyphHeightMap& _glyphHeightMap)
1185 if (mGlyphMap.find(_codePoint) == mGlyphMap.end())
1187 msdfgen::Shape shape;
1189 if (msdfgen::loadGlyph(shape, _fontHandle, _codePoint, &advance))
1190 createMsdfGlyph(createMsdfFaceGlyphInfo(_codePoint, shape, advance, _fontAscent), _glyphHeightMap);
1194 "ResourceTrueTypeFont: Cannot load msdf glyph for character "
1199 mCharMap[_codePoint] = _codePoint;
1205 void ResourceTrueTypeFont::renderMsdfGlyphs(
1206 const GlyphHeightMap& _glyphHeightMap,
1207 msdfgen::FontHandle* _fontHandle,
1212 int texX = mGlyphSpacing, texY = mGlyphSpacing;
1214 for (
const auto& sameHeightGlyphs : _glyphHeightMap)
1216 int glyphHeight = sameHeightGlyphs.first;
1217 for (
const auto& glyph : sameHeightGlyphs.second)
1219 GlyphInfo& info = *glyph.second;
1221 switch (info.codePoint)
1226 renderGlyph<false, false, false>(
1230 charMask.find(info.codePoint)->second,
1240 GlyphMap::iterator glyphIter = mGlyphMap.find(info.codePoint);
1241 if (glyphIter != mGlyphMap.end())
1243 glyphIter->second.width = 0.0f;
1244 glyphIter->second.uvRect.right = glyphIter->second.uvRect.left;
1251 renderGlyph<false, false, false>(
1255 charMask.find(info.codePoint)->second,
1265 msdfgen::Shape shape;
1266 if (loadGlyph(shape, _fontHandle, info.codePoint))
1268 msdfgen::Shape::Bounds bounds = shape.getBounds();
1269 double range = mMsdfRange / 2.0;
1270 if (shape.contours.empty())
1272 bounds = {0, 0, 0, 0};
1277 edgeColoringSimple(shape, 3.0);
1279 msdfgen::Bitmap<float, 3> msdf(
1280 std::ceil(bounds.r - bounds.l + 2 * range),
1281 std::ceil(bounds.t - bounds.b + 2 * range));
1282 msdfgen::generateMSDF(
1287 msdfgen::Vector2(-bounds.l + range, -bounds.b + range));
1297 uint8* glyphBuffer =
new uint8[msdf.width() * msdf.height() * 3];
1298 uint8* glyphBufferPointer = glyphBuffer;
1299 for (
int y = 0; y < msdf.height(); ++y)
1301 for (
int x = 0; x < msdf.width(); ++x)
1303 for (
int i = 0; i < 3; ++i)
1306 *glyphBufferPointer++ =
1307 msdfgen::pixelFloatToByte(msdf(x, msdf.height() - y - 1)[2 - i]);
1312 renderGlyph<false, true, false>(
1324 delete[] glyphBuffer;
1330 "ResourceTrueTypeFont: Cannot render glyph for character "
1357 mResolution = _value;
1362 if (_value ==
"use_native")
1363 mHinting = HintingUseNative;
1364 else if (_value ==
"force_auto")
1365 mHinting = HintingForceAuto;
1366 else if (_value ==
"disable_auto")
1367 mHinting = HintingDisableAuto;
1368 else if (_value ==
"disable_all")
1369 mHinting = HintingDisableAll;
1371 mHinting = HintingUseNative;
1376 mAntialias = _value;
1386 mOffsetHeight = _value;
1391 mSubstituteCodePoint = _value;
1396 mGlyphSpacing = _value;
1401 #ifndef MYGUI_MSDF_FONTS
1405 "MsdfMode flag ignored Define MYGUI_MSDF_FONTS if you need msdf fonts, msdf mode ignored.");
1413 mMsdfRange = _value;
#define MYGUI_EXCEPT(dest)
#define MYGUI_LOG(level, text)
virtual void freeData(IDataStream *_data)=0
virtual IDataStream * getData(const std::string &_name) const =0
static DataManager & getInstance()
const std::string & getResourceName() const
virtual void createManual(int _width, int _height, TextureUsage _usage, PixelFormat _format)=0
virtual ITexture * createTexture(const std::string &_name)=0
virtual void destroyTexture(ITexture *_texture)=0
static RenderManager & getInstance()
virtual bool isFormatSupported(PixelFormat _format, TextureUsage _usage)
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)
static Type firstPO2From(Type _value)
unsigned int parseUInt(std::string_view _value)
bool parseBool(std::string_view _value)
float parseFloat(std::string_view _value)
std::vector< std::string > split(std::string_view _source, std::string_view _delims="\t\n ")
std::string toString(T _value)
int parseInt(std::string_view _value)