From 1b55c6501cdeb3f1a2ce22539850b233cfe39109 Mon Sep 17 00:00:00 2001 From: Dav999 Date: Sun, 7 Jan 2024 04:42:53 +0100 Subject: [PATCH] Swap definitions of left and right textbox padding Spaces on the left and right would end up on the other side in RTL, which made the "You have rescued a crewmate!" text overlap with the crewmate sprite, and makes the [C[C[C[C[Captain!] dialogs have spaces on the left instead of on the right. So, best thing is to just swap the directions so that they match. --- desktop_version/src/Textbox.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/desktop_version/src/Textbox.cpp b/desktop_version/src/Textbox.cpp index 3d6d1abf..d717767e 100644 --- a/desktop_version/src/Textbox.cpp +++ b/desktop_version/src/Textbox.cpp @@ -148,6 +148,14 @@ void textboxclass::addline(const std::string& t) void textboxclass::pad(size_t left_pad, size_t right_pad) { // Pad the current text with a certain number of spaces on the left and right + if (font::is_rtl(print_flags)) + { + // Swap left and right, because left will end up on the right and vice versa... + size_t old_left_pad = left_pad; + left_pad = right_pad; + right_pad = old_left_pad; + } + for (size_t iter = 0; iter < lines.size(); iter++) { lines[iter] = std::string(left_pad, ' ') + lines[iter] + std::string(right_pad, ' ');