From 8509761d67c63ab5b26be684c0d533e2d281ccc6 Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Tue, 18 Jun 2024 17:37:54 -0500 Subject: [PATCH] Only wrap text on underscores and not other special characters --- Source/Engine/Render2D/Font.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/Engine/Render2D/Font.cpp b/Source/Engine/Render2D/Font.cpp index c27accb97..5424660fc 100644 --- a/Source/Engine/Render2D/Font.cpp +++ b/Source/Engine/Render2D/Font.cpp @@ -140,6 +140,7 @@ void Font::ProcessText(const StringView& text, Array& outputLines int32 lastWrapCharIndex = INVALID_INDEX; float lastWrapCharX = 0; bool lastMoveLine = false; + const Char compChar = TEXT('_'); // Process each character to split text into single lines for (int32 currentIndex = 0; currentIndex < textLength;) @@ -153,7 +154,7 @@ void Font::ProcessText(const StringView& text, Array& outputLines const bool isWhitespace = StringUtils::IsWhitespace(currentChar); // Check if character can wrap words - const bool isWrapChar = !StringUtils::IsAlnum(currentChar) || isWhitespace || StringUtils::IsUpper(currentChar); + const bool isWrapChar = (!StringUtils::IsAlnum(currentChar) && StringUtils::Compare(¤tChar, &compChar) == 0) || isWhitespace || StringUtils::IsUpper(currentChar); if (isWrapChar && currentIndex != 0) { lastWrapCharIndex = currentIndex;