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

sev- noreply at scummvm.org
Sat Sep 24 09:41:55 UTC 2022


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:
aea6f5348a VIDEO: Support BiDi text in subtitles


Commit: aea6f5348a1f7a28ac9cb6c7b16d2612c13d9120
    https://github.com/scummvm/scummvm/commit/aea6f5348a1f7a28ac9cb6c7b16d2612c13d9120
Author: BLooperZ (blooperz at users.noreply.github.com)
Date: 2022-09-24T11:41:50+02:00

Commit Message:
VIDEO: Support BiDi text in subtitles

Changed paths:
    video/subtitles.cpp


diff --git a/video/subtitles.cpp b/video/subtitles.cpp
index 467d7b5a120..f5d97f8a576 100644
--- a/video/subtitles.cpp
+++ b/video/subtitles.cpp
@@ -23,6 +23,7 @@
 #include "common/file.h"
 #include "common/system.h"
 #include "common/ustr.h"
+#include "common/unicode-bidi.h"
 
 #include "graphics/fonts/ttf.h"
 #include "graphics/font.h"
@@ -312,12 +313,14 @@ void Subtitles::drawSubtitle(uint32 timestamp, bool force) {
 	width = MIN(width + 2 * _hPad, (int)_bbox.width());
 
 	for (uint i = 0; i < lines.size(); i++) {
-		_font->drawString(_surface, lines[i], 0, height, width, _blackColor, Graphics::kTextAlignCenter);
-		_font->drawString(_surface, lines[i], SHADOW * 2, height, width, _blackColor, Graphics::kTextAlignCenter);
-		_font->drawString(_surface, lines[i], 0, height + SHADOW * 2, width, _blackColor, Graphics::kTextAlignCenter);
-		_font->drawString(_surface, lines[i], SHADOW * 2, height + SHADOW * 2, width, _blackColor, Graphics::kTextAlignCenter);
+		Common::U32String line = convertBiDiU32String(lines[i]).visual;
 
-		_font->drawString(_surface, lines[i], SHADOW, height + SHADOW, width, _color, Graphics::kTextAlignCenter);
+		_font->drawString(_surface, line, 0, height, width, _blackColor, Graphics::kTextAlignCenter);
+		_font->drawString(_surface, line, SHADOW * 2, height, width, _blackColor, Graphics::kTextAlignCenter);
+		_font->drawString(_surface, line, 0, height + SHADOW * 2, width, _blackColor, Graphics::kTextAlignCenter);
+		_font->drawString(_surface, line, SHADOW * 2, height + SHADOW * 2, width, _blackColor, Graphics::kTextAlignCenter);
+
+		_font->drawString(_surface, line, SHADOW, height + SHADOW, width, _color, Graphics::kTextAlignCenter);
 
 		height += _font->getFontHeight();
 




More information about the Scummvm-git-logs mailing list