From 8b9a9677fef7bc3a351eba995d93926336fdfe12 Mon Sep 17 00:00:00 2001 From: auria Date: Sun, 6 Feb 2011 02:11:57 +0000 Subject: [PATCH] Fixed some font centering issues during live switch between RTL and LTR languages git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@7631 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/guiengine/scalable_font.cpp | 5 +++++ src/guiengine/scalable_font.hpp | 2 ++ src/states_screens/main_menu_screen.cpp | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/src/guiengine/scalable_font.cpp b/src/guiengine/scalable_font.cpp index 6b0ea6f16..9e760f80e 100644 --- a/src/guiengine/scalable_font.cpp +++ b/src/guiengine/scalable_font.cpp @@ -71,6 +71,11 @@ ScalableFont::~ScalableFont() if (SpriteBank) SpriteBank->drop(); } } + +void ScalableFont::updateRTL() +{ + m_rtl = translations->isRTLLanguage(); +} void ScalableFont::setShadow(irr::video::SColor col) { diff --git a/src/guiengine/scalable_font.hpp b/src/guiengine/scalable_font.hpp index 678528500..7eb051f6d 100644 --- a/src/guiengine/scalable_font.hpp +++ b/src/guiengine/scalable_font.hpp @@ -134,6 +134,8 @@ public: void setScale(const float scale); float getScale() const { return m_scale; } + void updateRTL(); + private: struct SFontArea diff --git a/src/states_screens/main_menu_screen.cpp b/src/states_screens/main_menu_screen.cpp index 313e36d13..48d81eb7d 100644 --- a/src/states_screens/main_menu_screen.cpp +++ b/src/states_screens/main_menu_screen.cpp @@ -237,6 +237,10 @@ void MainMenuScreen::eventCallback(Widget* widget, const std::string& name, cons translations = new Translations(); GUIEngine::getStateManager()->hardResetAndGoToScreen(); + GUIEngine::getFont()->updateRTL(); + GUIEngine::getTitleFont()->updateRTL(); + GUIEngine::getSmallFont()->updateRTL(); + UserConfigParams::m_language = selection.c_str(); user_config->saveConfig(); }