[Scummvm-git-logs] scummvm master -> 74780e65b717ecb68ee036610a3c903c751c9c9b
sev-
noreply at scummvm.org
Fri Sep 29 22:10:40 UTC 2023
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
74780e65b7 GRAPHICS: MACGUI: Made chunk chopping width-agnostic in MacText
Commit: 74780e65b717ecb68ee036610a3c903c751c9c9b
https://github.com/scummvm/scummvm/commit/74780e65b717ecb68ee036610a3c903c751c9c9b
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2023-09-30T00:10:25+02:00
Commit Message:
GRAPHICS: MACGUI: Made chunk chopping width-agnostic in MacText
Changed paths:
graphics/macgui/mactext.cpp
graphics/macgui/mactext.h
diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index 6cb2f61df3c..1b8cea646a7 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -594,7 +594,7 @@ void MacText::setDefaultFormatting(uint16 fontId, byte textSlant, uint16 fontSiz
// Adds the given string to the end of the last line/chunk
// while observing the _maxWidth and keeping this chunk's
// formatting
-void MacText::chopChunk(const Common::U32String &str, int *curLinePtr, int indent) {
+void MacText::chopChunk(const Common::U32String &str, int *curLinePtr, int indent, int maxWidth) {
int curLine = *curLinePtr;
int curChunk;
MacFontRun *chunk;
@@ -621,15 +621,21 @@ void MacText::chopChunk(const Common::U32String &str, int *curLinePtr, int inden
return;
}
+ if (maxWidth == -1) {
+ chunk->text += str;
+
+ return;
+ }
+
Common::Array<Common::U32String> text;
int w = getLineWidth(curLine, true);
D(9, "** chopChunk before wrap \"%s\"", Common::toPrintable(str.encode()).c_str());
- chunk->getFont()->wordWrapText(str, _maxWidth, text, w);
+ chunk->getFont()->wordWrapText(str, maxWidth, text, w);
if (text.size() == 0) {
- warning("chopChunk: too narrow width, >%d", _maxWidth);
+ warning("chopChunk: too narrow width, >%d", maxWidth);
chunk->text += str;
getLineCharWidth(curLine, true);
@@ -644,7 +650,7 @@ void MacText::chopChunk(const Common::U32String &str, int *curLinePtr, int inden
// Recalc dims
getLineWidth(curLine, true);
- D(9, "** chopChunk, subchunk: \"%s\" (%d lines, maxW: %d)", toPrintable(text[0].encode()).c_str(), text.size(), _maxWidth);
+ D(9, "** chopChunk, subchunk: \"%s\" (%d lines, maxW: %d)", toPrintable(text[0].encode()).c_str(), text.size(), maxWidth);
// We do not overlap, so we're done
if (text.size() == 1)
@@ -753,7 +759,7 @@ void MacText::splitString(const Common::U32String &str, int curLine) {
// Okay, now we are either at the end of the line, or in the next
// chunk definition. That means, that we have to store the previous chunk
- chopChunk(tmp, &curLine, indentSize);
+ chopChunk(tmp, &curLine, indentSize, _inTable ? -1 : _maxWidth);
curTextLine = &_textLines[curLine];
diff --git a/graphics/macgui/mactext.h b/graphics/macgui/mactext.h
index e247a4cebf2..50073f3ae35 100644
--- a/graphics/macgui/mactext.h
+++ b/graphics/macgui/mactext.h
@@ -349,7 +349,7 @@ private:
*/
void reshuffleParagraph(int *row, int *col);
- void chopChunk(const Common::U32String &str, int *curLine, int indent);
+ void chopChunk(const Common::U32String &str, int *curLine, int indent, int maxWidth);
void splitString(const Common::U32String &str, int curLine = -1);
void render(int from, int to, int shadow);
void render(int from, int to);
More information about the Scummvm-git-logs
mailing list