[Scummvm-git-logs] scummvm master -> 9dac440d3be105911c0fc197e760db96aa729b16

sev- sev at scummvm.org
Sun Jan 29 00:54:44 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:
e9bd946043 GRAPHICS: Initial code for MacText formatting
9dac440d3b DIRECTOR: Pass font formatting info to MacText


Commit: e9bd946043a4ba8ef65fb712d5d05c18cd71d6d9
    https://github.com/scummvm/scummvm/commit/e9bd946043a4ba8ef65fb712d5d05c18cd71d6d9
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-01-29T00:54:31+01:00

Commit Message:
GRAPHICS: Initial code for MacText formatting

Changed paths:
    graphics/macgui/mactext.cpp


diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index 1b58872..208307e 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -48,6 +48,29 @@ void MacText::splitString(Common::String &str) {
 	bool prevCR = false;
 
 	while (*s) {
+		if (*s == '\001') {
+			s++;
+			if (*s == '\001') {
+				// Copy it verbatim
+			} else {
+				if (*s++ != '\015')
+					error("MacText: formatting error");
+
+				uint16 fontId = *s++; fontId = (fontId << 8) | *s++;
+				byte textSlant = *s++;
+				byte unk3f = *s++;
+				uint16 fontSize = *s++; fontSize = (fontSize << 8) | *s++;
+				uint16 palinfo1 = *s++; palinfo1 = (palinfo1 << 8) | *s++;
+				uint16 palinfo2 = *s++; palinfo2 = (palinfo2 << 8) | *s++;
+				uint16 palinfo3 = *s++; palinfo3 = (palinfo3 << 8) | *s++;
+
+				debug(8, "******** splitString: fontId: %d, textSlant: %d, unk3: %d, fontSize: %d, p0: %x p1: %x p2: %x",
+						fontId, textSlant, unk3f, fontSize, palinfo1, palinfo2, palinfo3);
+
+				continue;
+			}
+		}
+
 		if (*s == '\n' && prevCR) {	// trean \r\n as one
 			prevCR = false;
 


Commit: 9dac440d3be105911c0fc197e760db96aa729b16
    https://github.com/scummvm/scummvm/commit/9dac440d3be105911c0fc197e760db96aa729b16
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-01-29T00:54:31+01:00

Commit Message:
DIRECTOR: Pass font formatting info to MacText

Changed paths:
    engines/director/frame.cpp


diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp
index 402056a..e47214d 100644
--- a/engines/director/frame.cpp
+++ b/engines/director/frame.cpp
@@ -823,11 +823,15 @@ void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteId, Commo
 		text += ch;
 	}
 
+	Common::String ftext;
+
 	debugC(3, kDebugText, "renderText: unk1: %d strLen: %d dataLen: %d textlen: %u", unk1, strLen, dataLen, text.size());
 	if (strLen < 200)
 		debugC(3, kDebugText, "text: '%s'", text.c_str());
 
 	uint16 formattingCount = textStream->readUint16();
+	uint32 prevPos = 0;
+
 	while (formattingCount) {
 		uint32 formatStartOffset = textStream->readUint32();
 		uint16 unk1f = textStream->readUint16();
@@ -848,9 +852,32 @@ void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteId, Commo
 		debugC(3, kDebugText, "        unk3: %d, fontSize: %d, p0: %x p1: %x p2: %x", unk3f, textCast->fontSize,
 				textCast->palinfo1, textCast->palinfo2, textCast->palinfo3);
 
+		assert (prevPos <= formatStartOffset); // If this is triggered, we have to implement sorting
+
+		while (prevPos != formatStartOffset) {
+			char f = text.firstChar();
+			ftext += text.firstChar();
+			text.deleteChar(0);
+
+			if (f == '\001')	// Insert two \001s as a replacement
+				ftext += '\001';
+
+			prevPos++;
+		}
+
+		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,
+						(textCast->fontSize >> 8) & 0xff, textCast->fontSize & 0xff,
+						(textCast->palinfo1 >> 8) & 0xff, textCast->palinfo1 & 0xff,
+						(textCast->palinfo2 >> 8) & 0xff, textCast->palinfo2 & 0xff,
+						(textCast->palinfo3 >> 8) & 0xff, textCast->palinfo3 & 0xff);
+
 		formattingCount--;
 	}
 
+	ftext += text;
+
 	uint16 boxShadow = (uint16)textCast->boxShadow;
 	uint16 borderSize = (uint16)textCast->borderSize;
 	uint16 padding = (uint16)textCast->gutterSize;
@@ -887,7 +914,7 @@ void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteId, Commo
 	else
 		alignment++;
 
-	Graphics::MacText mt(text, font, 0x00, 0xff, width, (Graphics::TextAlign)alignment);
+	Graphics::MacText mt(ftext, font, 0x00, 0xff, width, (Graphics::TextAlign)alignment);
 	mt.setInterLinear(1);
 	mt.render();
 	const Graphics::ManagedSurface *textSurface = mt.getSurface();





More information about the Scummvm-git-logs mailing list