3636#include " 2d/SpriteBatchNode.h"
3737#include " 2d/DrawNode.h"
3838#include " 2d/Camera.h"
39- #include " base/UTF8 .h"
39+ #include " base/text_utils .h"
4040#include " base/Macros.h"
4141#include " platform/FileUtils.h"
4242#include " renderer/Renderer.h"
@@ -925,7 +925,7 @@ void Label::setString(std::string_view text)
925925 _contentDirty = true ;
926926
927927 std::u32string utf32String;
928- if (StringUtils ::UTF8ToUTF32 (_utf8Text, utf32String))
928+ if (text_utils ::UTF8ToUTF32 (_utf8Text, utf32String))
929929 {
930930 _utf32Text = utf32String;
931931 }
@@ -1701,7 +1701,7 @@ void Label::clearTextures()
17011701 if (_fontAtlas)
17021702 {
17031703 std::u32string utf32String;
1704- if (StringUtils ::UTF8ToUTF32 (_utf8Text, utf32String))
1704+ if (text_utils ::UTF8ToUTF32 (_utf8Text, utf32String))
17051705 {
17061706 _utf32Text = utf32String;
17071707 }
@@ -2347,7 +2347,7 @@ void Label::computeStringNumLines()
23472347 size_t stringLen = _utf32Text.length ();
23482348 for (size_t i = 0 ; i < stringLen - 1 ; ++i)
23492349 {
2350- if (_utf32Text[i] == StringUtils ::UnicodeCharacters::NewLine)
2350+ if (_utf32Text[i] == text_utils ::UnicodeCharacters::NewLine)
23512351 {
23522352 quantityOfLines++;
23532353 }
@@ -2765,9 +2765,9 @@ int Label::getFirstWordLen(const std::u32string& utf32Text, int startIndex, int
27652765 {
27662766 char32_t character = utf32Text[index];
27672767
2768- if (character == StringUtils ::UnicodeCharacters::NewLine ||
2769- (!StringUtils ::isUnicodeNonBreaking (character) &&
2770- (StringUtils ::isUnicodeSpace (character) || StringUtils ::isCJKUnicode (character))))
2768+ if (character == text_utils ::UnicodeCharacters::NewLine ||
2769+ (!text_utils ::isUnicodeNonBreaking (character) &&
2770+ (text_utils ::isUnicodeSpace (character) || text_utils ::isCJKUnicode (character))))
27712771 {
27722772 break ;
27732773 }
@@ -2798,13 +2798,13 @@ int Label::getFirstWordLen(const std::u32string& utf32Text, int startIndex, int
27982798
27992799bool Label::getFontLetterDef (char32_t character, FontLetterDefinition& letterDef) const
28002800{
2801- if (character == StringUtils ::UnicodeCharacters::NoBreakSpace)
2801+ if (character == text_utils ::UnicodeCharacters::NoBreakSpace)
28022802 {
28032803 // change no-break space to regular space
28042804 // reason: some fonts have issue with no-break space:
28052805 // * no letter definition
28062806 // * not normal big width
2807- character = StringUtils ::UnicodeCharacters::Space;
2807+ character = text_utils ::UnicodeCharacters::Space;
28082808 }
28092809
28102810 return _fontAtlas->getLetterDefinitionForChar (character, letterDef);
@@ -2859,7 +2859,7 @@ bool Label::multilineTextWrap(bool breakOnChar, bool ignoreOverflow)
28592859 for (int index = 0 ; index < textLen;)
28602860 {
28612861 char32_t character = _utf32Text[index];
2862- if (character == StringUtils ::UnicodeCharacters::NewLine)
2862+ if (character == text_utils ::UnicodeCharacters::NewLine)
28632863 {
28642864 _linesWidth.emplace_back (letterRight);
28652865 letterRight = 0 .f ;
@@ -2883,11 +2883,11 @@ bool Label::multilineTextWrap(bool breakOnChar, bool ignoreOverflow)
28832883 (index + tokenLen) < textLen)
28842884 {
28852885 auto tokenLastChar = _utf32Text[index + tokenLen - 1 ];
2886- if (!StringUtils ::isCJKUnicode (tokenLastChar) && !StringUtils ::isUnicodeSpace (tokenLastChar))
2886+ if (!text_utils ::isCJKUnicode (tokenLastChar) && !text_utils ::isUnicodeSpace (tokenLastChar))
28872887 {
28882888 // Work out if this token is valid based on the desired output
28892889 auto nextChar = _utf32Text[index + tokenLen];
2890- if (!StringUtils ::isUnicodeSpace (nextChar) && !StringUtils ::isCJKUnicode (nextChar))
2890+ if (!text_utils ::isUnicodeSpace (nextChar) && !text_utils ::isCJKUnicode (nextChar))
28912891 {
28922892 // No point continuing here
28932893 return false ;
@@ -2906,14 +2906,14 @@ bool Label::multilineTextWrap(bool breakOnChar, bool ignoreOverflow)
29062906 {
29072907 int letterIndex = index + tmp;
29082908 character = _utf32Text[letterIndex];
2909- if (character == StringUtils ::UnicodeCharacters::CarriageReturn)
2909+ if (character == text_utils ::UnicodeCharacters::CarriageReturn)
29102910 {
29112911 recordPlaceholderInfo (letterIndex, character);
29122912 continue ;
29132913 }
29142914
29152915 // \b - Next char not change x position
2916- if (character == StringUtils ::UnicodeCharacters::NextCharNoChangeX)
2916+ if (character == text_utils ::UnicodeCharacters::NextCharNoChangeX)
29172917 {
29182918 nextChangeSize = false ;
29192919 recordPlaceholderInfo (letterIndex, character);
@@ -2930,7 +2930,7 @@ bool Label::multilineTextWrap(bool breakOnChar, bool ignoreOverflow)
29302930
29312931 auto letterX = (nextLetterX + letterDef.offsetX * _fontScale) / contentScaleFactor;
29322932 if (_enableWrap && _maxLineWidth > 0 .f && nextTokenX > 0 .f &&
2933- letterX + letterDef.width * _fontScale > _maxLineWidth && !StringUtils ::isUnicodeSpace (character) &&
2933+ letterX + letterDef.width * _fontScale > _maxLineWidth && !text_utils ::isUnicodeSpace (character) &&
29342934 nextChangeSize)
29352935 {
29362936 _linesWidth.emplace_back (letterRight - whitespaceWidth);
@@ -2959,7 +2959,7 @@ bool Label::multilineTextWrap(bool breakOnChar, bool ignoreOverflow)
29592959 nextLetterX += newLetterWidth;
29602960 tokenRight = nextLetterX / contentScaleFactor;
29612961
2962- if (StringUtils ::isUnicodeSpace (character))
2962+ if (text_utils ::isUnicodeSpace (character))
29632963 {
29642964 nextWhitespaceWidth += newLetterWidth / contentScaleFactor;
29652965 }
0 commit comments