[Scummvm-git-logs] scummvm master -> 606eeae46f9742e4947d5bea5e198ba3f822a1fe

criezy criezy at scummvm.org
Wed Nov 4 22:27:28 UTC 2020


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

Summary:
542a3378d3 I18N: Always call BiDi algorithm for U32String
606eeae46f COMMON: move convertBiDiString out of TranslationManager


Commit: 542a3378d39e7b6c2b79c1278b2cd7bca2251020
    https://github.com/scummvm/scummvm/commit/542a3378d39e7b6c2b79c1278b2cd7bca2251020
Author: Zvika Haramaty (haramaty.zvika at gmail.com)
Date: 2020-11-04T22:27:24Z

Commit Message:
I18N: Always call BiDi algorithm for U32String

U32String can contain characters from all languages, without relation
to the GUI's language. Therefore, we need to always call it.

Use case:
In Hebrew SQ3, when using the game's original save/restore dialogs, it's
possible to give save games Hebrew names.
What happens when we then use ScummVM's load dialog?
- If ScummVM's GUI language is Hebrew, it's calling BiDI algo, and
  the text direction is OK.
- However, if ScummVM's GUI language is English, before this commit it
  didn't call the BiDI algo, and the text was reversed.

Changed paths:
    common/translation.cpp


diff --git a/common/translation.cpp b/common/translation.cpp
index fe5d1e9397..336e26f940 100644
--- a/common/translation.cpp
+++ b/common/translation.cpp
@@ -412,9 +412,6 @@ bool TranslationManager::checkHeader(File &in) {
 }
 
 U32String TranslationManager::convertBiDiString(const U32String &input) {
-	if (getCurrentLanguage() != "he")		//TODO: modify when we'll support other RTL languages, such as Arabic and Farsi
-		return input;
-
 	return Common::convertBiDiU32String(input).visual;
 }
 


Commit: 606eeae46f9742e4947d5bea5e198ba3f822a1fe
    https://github.com/scummvm/scummvm/commit/606eeae46f9742e4947d5bea5e198ba3f822a1fe
Author: Zvika Haramaty (haramaty.zvika at gmail.com)
Date: 2020-11-04T22:27:24Z

Commit Message:
COMMON: move convertBiDiString out of TranslationManager

Changed paths:
    common/translation.cpp
    common/translation.h
    gui/ThemeEngine.cpp


diff --git a/common/translation.cpp b/common/translation.cpp
index 336e26f940..99b1fdbc7b 100644
--- a/common/translation.cpp
+++ b/common/translation.cpp
@@ -411,10 +411,6 @@ bool TranslationManager::checkHeader(File &in) {
 	return true;
 }
 
-U32String TranslationManager::convertBiDiString(const U32String &input) {
-	return Common::convertBiDiU32String(input).visual;
-}
-
 } // End of namespace Common
 
 #endif // USE_TRANSLATION
diff --git a/common/translation.h b/common/translation.h
index b4cce47386..fdac736369 100644
--- a/common/translation.h
+++ b/common/translation.h
@@ -169,13 +169,6 @@ public:
 	 */
 	String getCurrentLanguage() const;
 
-	/*
-	 * Wrapper for GNU FriBidi implementation of the Unicode Bidirectional Algorithm
-	 * For LTR (Left To Right) languages, returns the original input
-	 * For RTL (Right To Left) languages, returns visual representation of a logical single-line input
-	 */
-	U32String convertBiDiString(const U32String &input);
-
 private:
 	/**
 	 * Tries to find the given language or a derivate of it.
diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index 739b3870d8..14a62eb7ef 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -27,6 +27,7 @@
 #include "common/unzip.h"
 #include "common/tokenizer.h"
 #include "common/translation.h"
+#include "common/unicode-bidi.h"
 
 #include "graphics/conversion.h"
 #include "graphics/cursorman.h"
@@ -1017,8 +1018,8 @@ void ThemeEngine::drawDDText(TextData type, TextColor color, const Common::Rect
 		restoreBackground(dirty);
 
 	_vectorRenderer->setFgColor(_textColors[color]->r, _textColors[color]->g, _textColors[color]->b);
-#ifdef USE_TRANSLATION
-	_vectorRenderer->drawString(_texts[type]->_fontPtr, TransMan.convertBiDiString(text), area, alignH, alignV, deltax, ellipsis, dirty);
+#ifdef USE_FRIBIDI
+	_vectorRenderer->drawString(_texts[type]->_fontPtr, Common::convertBiDiU32String(text), area, alignH, alignV, deltax, ellipsis, dirty);
 #else
 	_vectorRenderer->drawString(_texts[type]->_fontPtr, text, area, alignH, alignV, deltax, ellipsis, dirty);
 #endif




More information about the Scummvm-git-logs mailing list