From 749d63cfec7f7e3a2f52a9efe673d68aecaa038d Mon Sep 17 00:00:00 2001 From: auria Date: Sun, 20 Feb 2011 20:44:46 +0000 Subject: [PATCH] Fix bubbles when used with RTL language git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@7742 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/guiengine/widgets/bubble_widget.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/guiengine/widgets/bubble_widget.cpp b/src/guiengine/widgets/bubble_widget.cpp index 02d7a91df..5879dfb51 100644 --- a/src/guiengine/widgets/bubble_widget.cpp +++ b/src/guiengine/widgets/bubble_widget.cpp @@ -72,11 +72,23 @@ void BubbleWidget::add() m_expanded_size.LowerRightCorner.Y += additionalNeededSize/2 + 10; // reduce text to fit in the available space if it's too long - while (text_height > m_shrinked_size.getHeight()) + if (translations->isRTLLanguage()) { - message = message.subString(0, message.size() - 10) + "..."; - irrwidget->setText(message.c_str()); - text_height = irrwidget->getTextHeight(); + while (text_height > m_shrinked_size.getHeight() && message.size() > 10) + { + message = core::stringw(L"...") + message.subString(10, message.size() - 10); + irrwidget->setText(message.c_str()); + text_height = irrwidget->getTextHeight(); + } + } + else + { + while (text_height > m_shrinked_size.getHeight() && message.size() > 10) + { + message = message.subString(0, message.size() - 10) + "..."; + irrwidget->setText(message.c_str()); + text_height = irrwidget->getTextHeight(); + } } } m_shrinked_text = message;