[Scummvm-git-logs] scummvm master -> 278b467f602d8dbddcd4953cd3cde720ff0c13de

sev- noreply at scummvm.org
Tue Oct 18 15:38:09 UTC 2022


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

Summary:
20821f96ed SWORD25: Add hebrew support
c7b17f36be SWORD25: Apply code review suggestion
278b467f60 SWORD25: Apply code review suggestion


Commit: 20821f96ed22e40a94edd2a1dde35231f937327b
    https://github.com/scummvm/scummvm/commit/20821f96ed22e40a94edd2a1dde35231f937327b
Author: Shahar Ariel (sariel at ravtech.co.il)
Date: 2022-10-18T17:37:55+02:00

Commit Message:
SWORD25: Add hebrew support

changes:

* use unicode-bidi for hebrew text
* add detection of hebrew patch to detection table

Changed paths:
    common/lua/scummvm_file.cpp
    engines/sword25/detection_tables.h
    engines/sword25/gfx/graphicengine.cpp
    engines/sword25/gfx/graphicengine.h
    engines/sword25/gfx/text.cpp


diff --git a/common/lua/scummvm_file.cpp b/common/lua/scummvm_file.cpp
index 79b85ea09d4..1c651c85ab7 100644
--- a/common/lua/scummvm_file.cpp
+++ b/common/lua/scummvm_file.cpp
@@ -196,6 +196,8 @@ Common::String LuaFileConfig::getLanguage() {
 		return "pt";
 	case Common::RU_RUS:
 		return "ru";
+	case Common::HE_ISR:
+		return "he";
 	default:
 		error("Unknown language '%s' encountered", ConfMan.get("language").c_str());
 		break;
@@ -226,6 +228,8 @@ void LuaFileConfig::setLanguage(const Common::String &lang) {
 		ConfMan.set("language", Common::getLanguageCode(Common::PT_BRA));
 	else if (lang == "ru")
 		ConfMan.set("language", Common::getLanguageCode(Common::RU_RUS));
+	else if (lang == "he")
+		ConfMan.set("language", Common::getLanguageCode(Common::HE_ISR));
 	else
 		error("Unknown language encountered: %s", lang.c_str());
 }
diff --git a/engines/sword25/detection_tables.h b/engines/sword25/detection_tables.h
index 60cfe4edbce..f315d588b93 100644
--- a/engines/sword25/detection_tables.h
+++ b/engines/sword25/detection_tables.h
@@ -105,6 +105,15 @@ static const ADGameDescription gameDescriptions[] = {
 		ADGF_NO_FLAGS,
 		GUIO1(GUIO_NOASPECT)
 	},
+	{
+			"sword25",
+			"",
+			AD_ENTRY1s("lang_he.b25c", "7b0e58798793e0dd87023ef112a11d0f", 461034),
+			Common::HE_ISR,
+			Common::kPlatformUnknown,
+			ADGF_NO_FLAGS,
+			GUIO1(GUIO_NOASPECT)
+	},
 	// Hungarian "psylog" version.
 	// Submitted by goodoldgeorg in bug report #5888.
 	{
diff --git a/engines/sword25/gfx/graphicengine.cpp b/engines/sword25/gfx/graphicengine.cpp
index 8a44905fbfb..e0b604a4c10 100644
--- a/engines/sword25/gfx/graphicengine.cpp
+++ b/engines/sword25/gfx/graphicengine.cpp
@@ -51,6 +51,8 @@
 
 #include "common/lua/lua.h"
 #include "common/lua/lauxlib.h"
+#include "common/config-manager.h"
+
 enum {
 	BIT_DEPTH = 32,
 	BACKBUFFER_COUNT = 1
@@ -105,6 +107,7 @@ bool GraphicEngine::init(int width, int height, int bitDepth, int backbufferCoun
 	_screenRect.top = 0;
 	_screenRect.right = _width;
 	_screenRect.bottom = _height;
+    _isRTL = Common::parseLanguage(ConfMan.get("language")) == Common::HE_ISR;
 
 	const Graphics::PixelFormat format = g_system->getScreenFormat();
 
@@ -453,4 +456,8 @@ bool GraphicEngine::unpersist(InputPersistenceBlock &reader) {
 	return reader.isGood();
 }
 
+bool GraphicEngine::isRTL(){
+    return _isRTL;
+}
+
 } // End of namespace Sword25
diff --git a/engines/sword25/gfx/graphicengine.h b/engines/sword25/gfx/graphicengine.h
index 8738dcde3a8..ab0c4fac987 100644
--- a/engines/sword25/gfx/graphicengine.h
+++ b/engines/sword25/gfx/graphicengine.h
@@ -231,8 +231,8 @@ public:
 	// -------------------
 	bool persist(OutputPersistenceBlock &writer) override;
 	bool unpersist(InputPersistenceBlock &reader) override;
-
-	static void ARGBColorToLuaColor(lua_State *L, uint color);
+    bool isRTL();
+    static void ARGBColorToLuaColor(lua_State *L, uint color);
 	static uint luaColorToARGBColor(lua_State *L, int stackIndex);
 
 protected:
@@ -266,6 +266,8 @@ private:
 
 	Common::ScopedPtr<RenderObjectManager> _renderObjectManagerPtr;
 
+    bool _isRTL;
+
 	struct DebugLine {
 		DebugLine(const Vertex &start, const Vertex &end, uint color) :
 			_start(start),
@@ -277,6 +279,7 @@ private:
 		Vertex _end;
 		uint _color;
 	};
+
 };
 
 } // End of namespace Sword25
diff --git a/engines/sword25/gfx/text.cpp b/engines/sword25/gfx/text.cpp
index 5023c958a06..b16706c4c24 100644
--- a/engines/sword25/gfx/text.cpp
+++ b/engines/sword25/gfx/text.cpp
@@ -27,6 +27,7 @@
  * Licensed under GNU GPL v2
  *
  */
+#include "common/unicode-bidi.h"
 
 #include "sword25/kernel/kernel.h"
 #include "sword25/kernel/outputpersistenceblock.h"
@@ -217,6 +218,7 @@ void Text::updateFormat() {
 	FontResource *fontPtr = lockFontResource();
 	assert(fontPtr);
 
+	bool isRTL = Kernel::getInstance()->getGfx()->isRTL();
 	updateMetrics(*fontPtr);
 
 	_lines.resize(1);
@@ -259,6 +261,10 @@ void Text::updateFormat() {
 					curLineHeight = curCharRect.height();
 			}
 
+            if (isRTL) {
+                _lines[curLine].text = Common::convertBiDiString(_lines[curLine].text, Common::kWindows1255);
+            }
+
 			_lines[curLine].bbox.right = curLineWidth;
 			_lines[curLine].bbox.bottom = curLineHeight;
 			if ((uint)_width < curLineWidth)
@@ -286,10 +292,14 @@ void Text::updateFormat() {
 			_height += bbox.height();
 		}
 	} else {
-		// No auto format, so all the text is copied to a single line.
-		_lines[0].text = _text;
-		_lines[0].bbox = Common::Rect(0, 0, _width, _height);
-	}
+        if (isRTL) {
+            _lines[0].text = Common::convertBiDiString(_text, Common::kWindows1255);
+        }else {
+            // No auto format, so all the text is copied to a single line.
+            _lines[0].text = _text;
+        }
+        _lines[0].bbox = Common::Rect(0, 0, _width, _height);
+    }
 
 	fontPtr->release();
 }


Commit: c7b17f36be5632c1c4f331e7a3965691b04353f0
    https://github.com/scummvm/scummvm/commit/c7b17f36be5632c1c4f331e7a3965691b04353f0
Author: Shahar Ariel (sariel at ravtech.co.il)
Date: 2022-10-18T17:37:55+02:00

Commit Message:
SWORD25: Apply code review suggestion

Changed paths:
    engines/sword25/gfx/graphicengine.cpp
    engines/sword25/gfx/graphicengine.h


diff --git a/engines/sword25/gfx/graphicengine.cpp b/engines/sword25/gfx/graphicengine.cpp
index e0b604a4c10..1ecfe3c24d5 100644
--- a/engines/sword25/gfx/graphicengine.cpp
+++ b/engines/sword25/gfx/graphicengine.cpp
@@ -456,7 +456,7 @@ bool GraphicEngine::unpersist(InputPersistenceBlock &reader) {
 	return reader.isGood();
 }
 
-bool GraphicEngine::isRTL(){
+bool GraphicEngine::isRTL() {
     return _isRTL;
 }
 
diff --git a/engines/sword25/gfx/graphicengine.h b/engines/sword25/gfx/graphicengine.h
index ab0c4fac987..9e237e326af 100644
--- a/engines/sword25/gfx/graphicengine.h
+++ b/engines/sword25/gfx/graphicengine.h
@@ -231,8 +231,8 @@ public:
 	// -------------------
 	bool persist(OutputPersistenceBlock &writer) override;
 	bool unpersist(InputPersistenceBlock &reader) override;
-    bool isRTL();
-    static void ARGBColorToLuaColor(lua_State *L, uint color);
+	bool isRTL();
+	static void ARGBColorToLuaColor(lua_State *L, uint color);
 	static uint luaColorToARGBColor(lua_State *L, int stackIndex);
 
 protected:


Commit: 278b467f602d8dbddcd4953cd3cde720ff0c13de
    https://github.com/scummvm/scummvm/commit/278b467f602d8dbddcd4953cd3cde720ff0c13de
Author: ShaharAriel (ShaharAriel at users.noreply.github.com)
Date: 2022-10-18T17:37:55+02:00

Commit Message:
SWORD25: Apply code review suggestion

Changed paths:
    engines/sword25/gfx/text.cpp


diff --git a/engines/sword25/gfx/text.cpp b/engines/sword25/gfx/text.cpp
index b16706c4c24..9ff955a7ac8 100644
--- a/engines/sword25/gfx/text.cpp
+++ b/engines/sword25/gfx/text.cpp
@@ -294,7 +294,7 @@ void Text::updateFormat() {
 	} else {
         if (isRTL) {
             _lines[0].text = Common::convertBiDiString(_text, Common::kWindows1255);
-        }else {
+        } else {
             // No auto format, so all the text is copied to a single line.
             _lines[0].text = _text;
         }




More information about the Scummvm-git-logs mailing list