From 972aa885dcf282544cea406d526bb3659df8f7a6 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Fri, 17 May 2024 17:09:18 +0100 Subject: [PATCH] Fix: Force console to use LTR layouting. In-game console is not translatable and uses English strings, but becomes a mess when the game language is RTL. Force console rendering to use LTR regardless of language direction. Individual RTL runs within the text will still be processed as RTL. --- src/console_gui.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/console_gui.cpp b/src/console_gui.cpp index 3fbf93faf5..f7f7326e39 100644 --- a/src/console_gui.cpp +++ b/src/console_gui.cpp @@ -8,6 +8,7 @@ /** @file console_gui.cpp Handling the GUI of the in-game console. */ #include "stdafx.h" +#include "core/backup_type.hpp" #include "textbuf_type.h" #include "window_gui.h" #include "autocompletion.h" @@ -163,6 +164,7 @@ struct IConsoleWindow : Window void OnInit() override { + AutoRestoreBackup textdir(_current_text_dir, TD_LTR); this->line_height = GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.hsep_normal; this->line_offset = GetStringBoundingBox("] ").width + WidgetDimensions::scaled.frametext.left; this->cursor_width = GetCharacterWidth(FS_NORMAL, '_'); @@ -195,6 +197,7 @@ struct IConsoleWindow : Window void OnPaint() override { + AutoRestoreBackup textdir(_current_text_dir, TD_LTR); const int right = this->width - WidgetDimensions::scaled.frametext.right; GfxFillRect(0, 0, this->width - 1, this->height - 1, PC_BLACK);