[Scummvm-git-logs] scummvm master -> 74696f6c9267282bf14147dd54a98f63697bd9f0

sev- sev at scummvm.org
Fri Feb 3 18:33:01 CET 2017


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
c832865875 GRAPHICS: Fix MacText wrapping when formatting starts in the middle of a line
74696f6c92 GRAPHICS: Fix MacText rendering when 3 fonts meet on one line


Commit: c8328658753bacfb7c23497ee49e4059d59f7a8b
    https://github.com/scummvm/scummvm/commit/c8328658753bacfb7c23497ee49e4059d59f7a8b
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-02-03T10:05:36+01:00

Commit Message:
GRAPHICS: Fix MacText wrapping when formatting starts in the middle of a line

Changed paths:
    graphics/macgui/mactext.cpp


diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index 050de56..bdcb9ac 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -85,7 +85,7 @@ void MacText::splitString(Common::String &str) {
 			for (uint j = 0; j < _textLines[i].chunks.size(); j++)
 				debugN(7, "[%d] \"%s\"", _textLines[i].chunks[j].fontId, _textLines[i].chunks[j].text.c_str());
 
-			debug(7, " --> %c %d", (*s > 0x20 ? *s : ' '), (byte)*s);
+			debug(7, " --> %c %d, '%s'", (*s > 0x20 ? *s : ' '), (byte)*s, tmp.c_str());
 		}
 
 		if (*s == '\001') {
@@ -109,13 +109,6 @@ void MacText::splitString(Common::String &str) {
 
 				_currentFormatting.setValues(_wm, fontId, textSlant, unk3f, fontSize, palinfo1, palinfo2, palinfo3);
 
-				if (curLine == 0 && curChunk == 0 && _textLines[curLine].chunks[curChunk].text.empty()) {
-					_textLines[curLine].chunks[curChunk] = _currentFormatting;
-				} else {
-					_textLines[curLine].chunks.push_back(_currentFormatting);
-					curChunk++;
-				}
-
 				nextChunk = true;
 			}
 		} else if (*s == '\n' && prevCR) {	// trean \r\n as one


Commit: 74696f6c9267282bf14147dd54a98f63697bd9f0
    https://github.com/scummvm/scummvm/commit/74696f6c9267282bf14147dd54a98f63697bd9f0
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-02-03T18:32:44+01:00

Commit Message:
GRAPHICS: Fix MacText rendering when 3 fonts meet on one line

Changed paths:
    graphics/macgui/mactext.cpp


diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index bdcb9ac..7c22c81 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -77,6 +77,7 @@ void MacText::splitString(Common::String &str) {
 	int curLine = _textLines.size() - 1;
 	int curChunk = _textLines[curLine].chunks.size() - 1;
 	bool nextChunk = false;
+	MacFontRun previousFormatting;
 
 	while (*s) {
 		for (uint i = 0; i < _textLines.size(); i++) {
@@ -107,8 +108,12 @@ void MacText::splitString(Common::String &str) {
 				debug(8, "******** splitString: fontId: %d, textSlant: %d, unk3: %d, fontSize: %d, p0: %x p1: %x p2: %x",
 						fontId, textSlant, unk3f, fontSize, palinfo1, palinfo2, palinfo3);
 
+				previousFormatting = _currentFormatting;
 				_currentFormatting.setValues(_wm, fontId, textSlant, unk3f, fontSize, palinfo1, palinfo2, palinfo3);
 
+				if (curLine == 0 && curChunk == 0 && tmp.empty())
+					previousFormatting = _currentFormatting;
+
 				nextChunk = true;
 			}
 		} else if (*s == '\n' && prevCR) {	// trean \r\n as one
@@ -123,37 +128,34 @@ void MacText::splitString(Common::String &str) {
 		if (*s == '\r' || *s == '\n' || nextChunk) {
 			Common::Array<Common::String> text;
 
+			if (!nextChunk)
+				previousFormatting = _currentFormatting;
+
 			int w = getLineWidth(curLine, true);
 
-			_font->wordWrapText(tmp, _maxWidth, text, w);
+			previousFormatting.getFont()->wordWrapText(tmp, _maxWidth, text, w);
 			tmp.clear();
 
 			if (text.size()) {
-				if (nextChunk) {
-					_textLines[curLine].chunks[curChunk].text += text[0];
-					curChunk++;
-
-					_textLines[curLine].chunks.push_back(_currentFormatting);
-
-					if (_text.size() == curLine)
-						_text.push_back(text[0]);
-					else
-						_text[curLine] += text[0];
-
-					nextChunk = false;
-
-					continue;
-				}
-
 				for (uint i = 0; i < text.size(); i++) {
 					_text.push_back(text[i]);
 
 					_textLines[curLine].chunks[curChunk].text = text[i];
 
-					curLine++;
-					_textLines.resize(curLine + 1);
+					if ((text.size() > 1 || !nextChunk) && !(i == text.size() - 1 && nextChunk)) {
+						curLine++;
+						_textLines.resize(curLine + 1);
+						_textLines[curLine].chunks.push_back(previousFormatting);
+						curChunk = 0;
+					}
+				}
+
+				if (nextChunk) {
+					curChunk++;
+
 					_textLines[curLine].chunks.push_back(_currentFormatting);
-					curChunk = 0;
+				} else {
+					_textLines[curLine].chunks[0] = _currentFormatting;
 				}
 			} else {
 				if (nextChunk) { // No text, replacing formatting
@@ -176,7 +178,7 @@ void MacText::splitString(Common::String &str) {
 		Common::Array<Common::String> text;
 		int w = getLineWidth(curLine, true);
 
-		_font->wordWrapText(tmp, _maxWidth, text, w);
+		_currentFormatting.getFont()->wordWrapText(tmp, _maxWidth, text, w);
 
 		_textLines[curLine].chunks[curChunk].text = text[0];
 





More information about the Scummvm-git-logs mailing list