[Scummvm-cvs-logs] SF.net SVN: scummvm:[48781] scummvm/trunk/engines/sci/graphics/text16.cpp

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Sat Apr 24 14:49:23 CEST 2010


Revision: 48781
          http://scummvm.svn.sourceforge.net/scummvm/?rev=48781&view=rev
Author:   m_kiewitz
Date:     2010-04-24 12:49:22 +0000 (Sat, 24 Apr 2010)

Log Message:
-----------
SCI: change the way we handle breaking spaces based on how sierra sci does it, revert r48778/r48779

Modified Paths:
--------------
    scummvm/trunk/engines/sci/graphics/text16.cpp

Modified: scummvm/trunk/engines/sci/graphics/text16.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/text16.cpp	2010-04-24 11:59:19 UTC (rev 48780)
+++ scummvm/trunk/engines/sci/graphics/text16.cpp	2010-04-24 12:49:22 UTC (rev 48781)
@@ -157,7 +157,7 @@
 	0x4083, 0x4283, 0x4483, 0x4683, 0x4883, 0x6283, 0x8383, 0x8583, 0x8783, 0x8E83, 0x9583, 0x9683,
 	0x5B81, 0x4181, 0x4281, 0x7681, 0x7881, 0x4981, 0x4881, 0 };
 
-// return max # of chars to fit maxwidth with full words
+// return max # of chars to fit maxwidth with full words, does not include breaking space
 int16 GfxText16::GetLongest(const char *text, int16 maxWidth, GuiResourceId orgFontId) {
 	uint16 curChar;
 	int16 maxChars = 0, curCharCount = 0;
@@ -205,7 +205,7 @@
 			return curCharCount;
 
 		case ' ':
-			maxChars = curCharCount + 1;
+			maxChars = curCharCount; // return count up to (but not including) breaking space
 			break;
 		}
 		width += _font->getCharWidth(curChar);
@@ -267,9 +267,6 @@
 					break;
 				}
 			default:
-				// if last character is a space and the text is not ending afterwards, don't add it to textWidth
-				if ((curChar == ' ') && (!len) && (*text != 0))
-					break;
 				textHeight = MAX<int16> (textHeight, _ports->_curPort->fontHeight);
 				textWidth += _font->getCharWidth(curChar);
 			}
@@ -323,6 +320,8 @@
 			maxTextWidth = MAX(textWidth, maxTextWidth);
 			totalHeight += textHeight;
 			curPos += charCount;
+			if (*curPos == ' ')
+				curPos++;
 		}
 		rect.bottom = totalHeight;
 		rect.right = maxWidth ? maxWidth : MIN(rect.right, maxTextWidth);
@@ -436,6 +435,8 @@
 
 		hline += textHeight;
 		text += charCount;
+		if (*text == ' ')
+			text++;
 	}
 	SetFont(orgFontId);
 	_ports->penColor(orgPenColor);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list