[Scummvm-git-logs] scummvm master -> d39404c8e8144af504f8a4dfef69f2009c05582e

sev- sev at scummvm.org
Wed Feb 1 19:05:05 CET 2017


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

Summary:
6fbb82f85b GRAPHICS: Add more debug output to MacText
6e3e8911c1 GRAPHICS: MacText fixes for in-the middle style change splitting
d39404c8e8 GRAPHICS: Fix rendering of MacText with font change in the middle of the string


Commit: 6fbb82f85be523c6433bdffca86b73544d108422
    https://github.com/scummvm/scummvm/commit/6fbb82f85be523c6433bdffca86b73544d108422
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-02-01T18:36:25+01:00

Commit Message:
GRAPHICS: Add more debug output to MacText

Changed paths:
    engines/director/frame.cpp
    graphics/macgui/mactext.cpp


diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp
index d1a55fd..693e477 100644
--- a/engines/director/frame.cpp
+++ b/engines/director/frame.cpp
@@ -863,8 +863,12 @@ void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteId, Commo
 				ftext += '\001';
 
 			prevPos++;
+
+			debugCN(4, kDebugText, "%c", f);
 		}
 
+		debugCN(4, kDebugText, "*");
+
 		ftext += Common::String::format("\001\015%c%c%c%c%c%c%c%c%c%c%c%c",
 						(textCast->fontId >> 8) & 0xff, textCast->fontId & 0xff,
 						textCast->textSlant & 0xff, unk3f & 0xff,
@@ -878,6 +882,8 @@ void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteId, Commo
 
 	ftext += text;
 
+	debugC(4, kDebugText, "%s", text.c_str());
+
 	uint16 boxShadow = (uint16)textCast->boxShadow;
 	uint16 borderSize = (uint16)textCast->borderSize;
 	uint16 padding = (uint16)textCast->gutterSize;
diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index 8644bb9..c1704c1 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -79,6 +79,15 @@ void MacText::splitString(Common::String &str) {
 	bool nextChunk = false;
 
 	while (*s) {
+		for (uint i = 0; i < _textLines.size(); i++) {
+			debugN(7, "%2d ", i);
+
+			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);
+		}
+
 		if (*s == '\001') {
 			s++;
 			if (*s == '\001') {


Commit: 6e3e8911c1a065867d4d6000f42f5d05ca5fec4a
    https://github.com/scummvm/scummvm/commit/6e3e8911c1a065867d4d6000f42f5d05ca5fec4a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-02-01T18:58:35+01:00

Commit Message:
GRAPHICS: MacText fixes for in-the middle style change splitting

Changed paths:
    graphics/macgui/mactext.cpp


diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index c1704c1..11dd7d2 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -109,9 +109,8 @@ void MacText::splitString(Common::String &str) {
 
 				_currentFormatting.setValues(_wm, fontId, textSlant, unk3f, fontSize, palinfo1, palinfo2, palinfo3);
 
-				if (_textLines[curLine].chunks[curChunk].text.empty()) {
+				if (curLine == 0 && curChunk == 0 && _textLines[curLine].chunks[curChunk].text.empty()) {
 					_textLines[curLine].chunks[curChunk] = _currentFormatting;
-					continue;
 				} else {
 					_textLines[curLine].chunks.push_back(_currentFormatting);
 				}
@@ -138,7 +137,12 @@ void MacText::splitString(Common::String &str) {
 					_textLines[curLine].chunks[curChunk].text += text[0];
 					curChunk++;
 
-					_text[curLine] += text[0];
+					_textLines[curLine].chunks.push_back(_currentFormatting);
+
+					if (_text.size() == curLine)
+						_text.push_back(text[0]);
+					else
+						_text[curLine] += text[0];
 
 					nextChunk = false;
 
@@ -156,7 +160,7 @@ void MacText::splitString(Common::String &str) {
 					curChunk = 0;
 				}
 			} else {
-				if (nextChunk) { // No text, replacing formatting
+				if (nextChunk && 0) { // No text, replacing formatting
 					_textLines[curLine].chunks[curChunk] = _currentFormatting;
 				}
 			}


Commit: d39404c8e8144af504f8a4dfef69f2009c05582e
    https://github.com/scummvm/scummvm/commit/d39404c8e8144af504f8a4dfef69f2009c05582e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-02-01T19:06:36+01:00

Commit Message:
GRAPHICS: Fix rendering of MacText with font change in the middle of the string

Changed paths:
    graphics/macgui/mactext.cpp
    graphics/macgui/mactext.h


diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index 11dd7d2..84db1c2 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -129,7 +129,9 @@ void MacText::splitString(Common::String &str) {
 		if (*s == '\r' || *s == '\n' || nextChunk) {
 			Common::Array<Common::String> text;
 
-			_font->wordWrapText(tmp, _maxWidth, text);
+			int w = getLineWidth(curLine, true);
+
+			_font->wordWrapText(tmp, _maxWidth, text, w);
 			tmp.clear();
 
 			if (text.size()) {
@@ -178,8 +180,9 @@ void MacText::splitString(Common::String &str) {
 
 	if (tmp.size()) {
 		Common::Array<Common::String> text;
+		int w = getLineWidth(curLine, true);
 
-		_font->wordWrapText(tmp, _maxWidth, text);
+		_font->wordWrapText(tmp, _maxWidth, text, w);
 
 		_textLines[curLine].chunks[curChunk].text = text[0];
 
@@ -260,11 +263,11 @@ void MacText::render(int from, int to) {
 	}
 }
 
-int MacText::getLineWidth(int line) {
+int MacText::getLineWidth(int line, bool enforce) {
 	if ((uint)line >= _textLines.size())
 		return 0;
 
-	if (_textLines[line].width != -1)
+	if (_textLines[line].width != -1 && !enforce)
 		return _textLines[line].width;
 
 	int width = 0;
diff --git a/graphics/macgui/mactext.h b/graphics/macgui/mactext.h
index 90f85e6..2ce0c30 100644
--- a/graphics/macgui/mactext.h
+++ b/graphics/macgui/mactext.h
@@ -105,7 +105,7 @@ private:
 	void render(int from, int to);
 	void recalcDims();
 	void reallocSurface();
-	int getLineWidth(int line);
+	int getLineWidth(int line, bool enforce = false);
 	int getLineHeight(int line);
 
 private:





More information about the Scummvm-git-logs mailing list