aboutsummaryrefslogtreecommitdiff
path: root/graphics/font.cpp
diff options
context:
space:
mode:
authorEugene Sandulenko2017-01-29 18:40:36 +0100
committerEugene Sandulenko2017-01-29 18:41:07 +0100
commitdc640ab50a63b0383c6aec6df4e0427df1824c3e (patch)
tree69a1176c00f2d206c0d022848a1ec859e7d74976 /graphics/font.cpp
parent1c6b31397a382e4adb315456a321caf144766826 (diff)
downloadscummvm-rg350-dc640ab50a63b0383c6aec6df4e0427df1824c3e.tar.gz
scummvm-rg350-dc640ab50a63b0383c6aec6df4e0427df1824c3e.tar.bz2
scummvm-rg350-dc640ab50a63b0383c6aec6df4e0427df1824c3e.zip
GRAPHICS: Added optional initial line width ot text wrapper
Diffstat (limited to 'graphics/font.cpp')
-rw-r--r--graphics/font.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/graphics/font.cpp b/graphics/font.cpp
index 7768b7362d..3446619299 100644
--- a/graphics/font.cpp
+++ b/graphics/font.cpp
@@ -142,11 +142,11 @@ struct WordWrapper {
};
template<class StringType>
-int wordWrapTextImpl(const Font &font, const StringType &str, int maxWidth, Common::Array<StringType> &lines) {
+int wordWrapTextImpl(const Font &font, const StringType &str, int maxWidth, Common::Array<StringType> &lines, int initWidth) {
WordWrapper<StringType> wrapper(lines);
StringType line;
StringType tmpStr;
- int lineWidth = 0;
+ int lineWidth = initWidth;
int tmpWidth = 0;
// The rough idea behind this algorithm is as follows:
@@ -305,12 +305,12 @@ void Font::drawString(ManagedSurface *dst, const Common::U32String &str, int x,
}
}
-int Font::wordWrapText(const Common::String &str, int maxWidth, Common::Array<Common::String> &lines) const {
- return wordWrapTextImpl(*this, str, maxWidth, lines);
+int Font::wordWrapText(const Common::String &str, int maxWidth, Common::Array<Common::String> &lines, int initWidth) const {
+ return wordWrapTextImpl(*this, str, maxWidth, lines, initWidth);
}
-int Font::wordWrapText(const Common::U32String &str, int maxWidth, Common::Array<Common::U32String> &lines) const {
- return wordWrapTextImpl(*this, str, maxWidth, lines);
+int Font::wordWrapText(const Common::U32String &str, int maxWidth, Common::Array<Common::U32String> &lines, int initWidth) const {
+ return wordWrapTextImpl(*this, str, maxWidth, lines, initWidth);
}
Common::String Font::handleEllipsis(const Common::String &input, int w) const {