diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/speechbubble.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/textbox.cpp | 11 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/gui/speechbubble.cpp b/src/gui/speechbubble.cpp index 0cfa543c..959e47ee 100644 --- a/src/gui/speechbubble.cpp +++ b/src/gui/speechbubble.cpp @@ -69,8 +69,8 @@ void SpeechBubble::setText(const std::string &text, bool showName) mSpeechBox->setTextColor(&guiPalette->getColor(Palette::TEXT)); int width = mCaption->getWidth() + 2 * getPadding(); - const int speechWidth = mSpeechBox->getMinWidth() + 2 * getPadding(); mSpeechBox->setTextWrapped(text, 130 > width ? 130 : width); + const int speechWidth = mSpeechBox->getMinWidth() + 2 * getPadding(); const int fontHeight = getFont()->getHeight(); const int nameHeight = showName ? mCaption->getHeight() + diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp index 4c463078..3c05ef84 100644 --- a/src/gui/widgets/textbox.cpp +++ b/src/gui/widgets/textbox.cpp @@ -85,9 +85,16 @@ void TextBox::setTextWrapped(const std::string &text, int minDimension) int width = getFont()->getWidth(word); - if (xpos != 0 && xpos + width + getFont()->getWidth(" ") <= mMinWidth) + if (xpos == 0 && width > mMinWidth) { - xpos += width + getFont()->getWidth(" "); + mMinWidth = width; + xpos = width; + wrappedStream << word; + } + else if (xpos != 0 && xpos + getFont()->getWidth(" ") + width <= + mMinWidth) + { + xpos += getFont()->getWidth(" ") + width; wrappedStream << " " << word; } else if (lastSpacePos == 0) |