[Scummvm-cvs-logs] scummvm master -> 228785eda231837098b750076dea87348e050764

somaen einarjohan at somadalen.com
Tue Oct 23 03:06:09 CEST 2012


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:
228785eda2 WINTERMUTE: Convert ' correctly from CP1252


Commit: 228785eda231837098b750076dea87348e050764
    https://github.com/scummvm/scummvm/commit/228785eda231837098b750076dea87348e050764
Author: Einar Johan Trøan Sømåen (einarjohants at gmail.com)
Date: 2012-10-22T18:05:17-07:00

Commit Message:
WINTERMUTE: Convert ' correctly from CP1252

Changed paths:
    engines/wintermute/base/font/base_font_truetype.cpp
    engines/wintermute/utils/string_util.cpp



diff --git a/engines/wintermute/base/font/base_font_truetype.cpp b/engines/wintermute/base/font/base_font_truetype.cpp
index 3219918..f236329 100644
--- a/engines/wintermute/base/font/base_font_truetype.cpp
+++ b/engines/wintermute/base/font/base_font_truetype.cpp
@@ -159,6 +159,11 @@ void BaseFontTT::drawText(const byte *text, int x, int y, int width, TTextAlign
 	// TODO: Why do we still insist on Widestrings everywhere?
 	/*  if (_gameRef->_textEncoding == TEXT_UTF8) text = StringUtil::Utf8ToWide((char *)Text);
 	        else text = StringUtil::AnsiToWide((char *)Text);*/
+	// HACK: J.U.L.I.A. uses CP1252, we need to fix that,
+	// And we still don't have any UTF8-support.
+	if (_gameRef->_textEncoding != TEXT_UTF8) {
+		textStr = StringUtil::ansiToWide((char *)text);
+	}
 
 	if (maxLength >= 0 && textStr.size() > (uint32)maxLength) {
 		textStr = Common::String(textStr.c_str(), (uint32)maxLength);
diff --git a/engines/wintermute/utils/string_util.cpp b/engines/wintermute/utils/string_util.cpp
index 2c3be8c..7b3b0e1 100644
--- a/engines/wintermute/utils/string_util.cpp
+++ b/engines/wintermute/utils/string_util.cpp
@@ -148,11 +148,11 @@ Utf8String StringUtil::wideToUtf8(const WideString &WideStr) {
 
 // Currently this only does Ansi->ISO 8859, and only for carets.
 char simpleAnsiToWide(const AnsiString &str, uint32 &offset) {
-	char c = str[offset];
+	byte c = str[offset];
 
-	if (c == 92) {
+	if (c == 146) {
 		offset++;
-		return '\'';
+		return 39; // Replace right-quote with apostrophe
 	} else {
 		offset++;
 		return c;
@@ -162,11 +162,11 @@ char simpleAnsiToWide(const AnsiString &str, uint32 &offset) {
 //////////////////////////////////////////////////////////////////////////
 WideString StringUtil::ansiToWide(const AnsiString &str) {
 	// TODO: This function gets called a lot, so warnings like these drown out the usefull information
-	/*Common::String converted = "";
+	Common::String converted = "";
 	uint32 index = 0;
 	while (index != str.size()) {
 	    converted += simpleAnsiToWide(str, index);
-	}*/
+	}
 	// using default os locale!
 
 	/*  setlocale(LC_CTYPE, "");
@@ -176,7 +176,7 @@ WideString StringUtil::ansiToWide(const AnsiString &str) {
 	    WideString ResultString(wstr);
 	    delete[] wstr;
 	    return ResultString;*/
-	return WideString(str);
+	return WideString(converted);
 }
 
 //////////////////////////////////////////////////////////////////////////






More information about the Scummvm-git-logs mailing list