[Scummvm-git-logs] scummvm master -> 2fde742922ba61fd1ff47ee2c3ed9e73dfaab82e

sev- sev at scummvm.org
Sun Jan 17 20:51:24 UTC 2021


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:
2fde742922 SCI: RTL: right align entries in drawListControl


Commit: 2fde742922ba61fd1ff47ee2c3ed9e73dfaab82e
    https://github.com/scummvm/scummvm/commit/2fde742922ba61fd1ff47ee2c3ed9e73dfaab82e
Author: Zvika Haramaty (haramaty.zvika at gmail.com)
Date: 2021-01-17T21:51:20+01:00

Commit Message:
SCI: RTL: right align entries in drawListControl

Changed paths:
    engines/sci/graphics/controls16.cpp


diff --git a/engines/sci/graphics/controls16.cpp b/engines/sci/graphics/controls16.cpp
index a192556079..a78f95f623 100644
--- a/engines/sci/graphics/controls16.cpp
+++ b/engines/sci/graphics/controls16.cpp
@@ -97,7 +97,16 @@ void GfxControls16::drawListControl(Common::Rect rect, reg_t obj, int16 maxChars
 			if (g_sci->isLanguageRTL())
 				textString = Common::convertBiDiString(textString, g_sci->getLanguage());
 
-			_ports->moveTo(workerRect.left, workerRect.top);
+			if (!g_sci->isLanguageRTL())
+				_ports->moveTo(workerRect.left, workerRect.top);
+			else {
+				// calc width, for right alignment
+				const char *textPtr = textString.c_str();
+				uint16 textWidth = 0;
+				while (*textPtr)
+					textWidth += _text16->_font->getCharWidth((byte)*textPtr++);
+				_ports->moveTo(workerRect.right - textWidth - 1, workerRect.top);
+			}
 			_text16->Draw(textString.c_str(), 0, MIN<int16>(maxChars, listEntry.size()), oldFontId, oldPenColor);
 			if ((!isAlias) && (i == cursorPos)) {
 				_paint16->invertRect(workerRect);




More information about the Scummvm-git-logs mailing list