[Scummvm-git-logs] scummvm master -> aabaca0d1333f4e23bebfc03ab577ac51d271f0b

SupSuper noreply at scummvm.org
Tue May 14 19:37:58 UTC 2024


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
aabaca0d13 BAGEL: Fix rendering of unicode text


Commit: aabaca0d1333f4e23bebfc03ab577ac51d271f0b
    https://github.com/scummvm/scummvm/commit/aabaca0d1333f4e23bebfc03ab577ac51d271f0b
Author: SupSuper (supsuper at gmail.com)
Date: 2024-05-14T20:37:44+01:00

Commit Message:
BAGEL: Fix rendering of unicode text

Changed paths:
    engines/bagel/boflib/gfx/text.cpp
    engines/bagel/boflib/gfx/text.h


diff --git a/engines/bagel/boflib/gfx/text.cpp b/engines/bagel/boflib/gfx/text.cpp
index 4c78271f7d8..7022fc5cba0 100644
--- a/engines/bagel/boflib/gfx/text.cpp
+++ b/engines/bagel/boflib/gfx/text.cpp
@@ -404,29 +404,29 @@ ErrorCode CBofText::displayTextEx(CBofBitmap *pBmp, const char *pszText, CBofRec
 }
 
 void CBofText::displayLine(Graphics::Font *font, Graphics::ManagedSurface &surface,
-		const Common::String &line, int left, int top, int width, int color, Graphics::TextAlign align) {
+		const Common::U32String &line, int left, int top, int width, int color, Graphics::TextAlign align) {
 	if (!line.contains('\t')) {
 		font->drawString(&surface, line, left, top, width, color, align);
 
 	} else {
 		// Special rendering of tabbed text
-		Common::String str = line;
+		Common::U32String str = line;
 
 		while (!str.empty()) {
-			if (str.hasPrefix("\t")) {
+			if (str[0] == '\t') {
 				// Move to next tab stop
 				left = (left + TAB_SIZE) / TAB_SIZE * TAB_SIZE;
 				str.deleteChar(0);
 
 			} else {
-				Common::String fragment;
+				Common::U32String fragment;
 				size_t tab = str.findFirstOf('\t');
-				if (tab == Common::String::npos) {
+				if (tab == Common::U32String::npos) {
 					fragment = str;
 					str.clear();
 				} else {
-					fragment = Common::String(str.c_str(), str.c_str() + tab);
-					str = Common::String(str.c_str() + tab);
+					fragment = Common::U32String(str.c_str(), str.c_str() + tab);
+					str = Common::U32String(str.c_str() + tab);
 				}
 
 				int fragmentWidth = font->getStringWidth(fragment);
diff --git a/engines/bagel/boflib/gfx/text.h b/engines/bagel/boflib/gfx/text.h
index d753a385b9e..7aeb128f016 100644
--- a/engines/bagel/boflib/gfx/text.h
+++ b/engines/bagel/boflib/gfx/text.h
@@ -289,7 +289,7 @@ private:
 	ErrorCode displayText(CBofWindow *pWnd, const char *pszText, CBofRect *pRect, const int nSize, const int nWeight, const bool bShadowed, int nFont = FONT_DEFAULT);
 	ErrorCode displayText(CBofBitmap *pBmp, const char *pszText, CBofRect *pRect, const int nSize, const int nWeight, const bool bShadowed, int nFont = FONT_DEFAULT);
 
-	void displayLine(Graphics::Font *font, Graphics::ManagedSurface &surface, const Common::String &line,
+	void displayLine(Graphics::Font *font, Graphics::ManagedSurface &surface, const Common::U32String &line,
 		int left, int top, int width, int color, Graphics::TextAlign align);
 
 protected:




More information about the Scummvm-git-logs mailing list