[Scummvm-cvs-logs] SF.net SVN: scummvm:[48376] scummvm/trunk/engines/m4/font.cpp

dreammaster at users.sourceforge.net dreammaster at users.sourceforge.net
Wed Mar 24 12:46:10 CET 2010


Revision: 48376
          http://scummvm.svn.sourceforge.net/scummvm/?rev=48376&view=rev
Author:   dreammaster
Date:     2010-03-24 11:46:09 +0000 (Wed, 24 Mar 2010)

Log Message:
-----------
Bugfixes for correctly getting string lengths and cropping drawn text

Modified Paths:
--------------
    scummvm/trunk/engines/m4/font.cpp

Modified: scummvm/trunk/engines/m4/font.cpp
===================================================================
--- scummvm/trunk/engines/m4/font.cpp	2010-03-23 23:09:12 UTC (rev 48375)
+++ scummvm/trunk/engines/m4/font.cpp	2010-03-24 11:46:09 UTC (rev 48376)
@@ -159,10 +159,11 @@
 	}
 	*/
 
+	int right;
 	if (width > 0)
-		width = MIN(surface->width(), x + width);
+		right = MIN(surface->width(), x + width + 1);
 	else
-		width = surface->width();
+		right = surface->width();
 
 	x++;
 	y++;
@@ -197,7 +198,7 @@
 
 		if (charWidth > 0) {
 
-			if (xPos + charWidth >= width)
+			if (xPos + charWidth > right)
 				return xPos;
 
 			uint8 *charData = &_charData[_charOffs[theChar]];
@@ -258,7 +259,7 @@
 		custom_ascii_converter(out_string);	 // call it with the string
 	}
 	*/
-	int width = 0;
+	int width = -spaceWidth;	// Accomodate final character not needing spacing
 	while (*text)
 		width += _charWidths[*text++ & 0x7F] + spaceWidth;
 	return width;


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