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

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Sat Apr 17 17:16:40 CEST 2010


Revision: 48689
          http://scummvm.svn.sourceforge.net/scummvm/?rev=48689&view=rev
Author:   m_kiewitz
Date:     2010-04-17 15:16:40 +0000 (Sat, 17 Apr 2010)

Log Message:
-----------
SCI: change textedit control to cast to unsigned char to fix cursor position when multilingual chars are used. Also make getFontHeight() private inside GfxFontFromResource class, remove it in all the other classes

Modified Paths:
--------------
    scummvm/trunk/engines/sci/graphics/controls.cpp
    scummvm/trunk/engines/sci/graphics/font.h
    scummvm/trunk/engines/sci/graphics/fontsjis.cpp
    scummvm/trunk/engines/sci/graphics/fontsjis.h
    scummvm/trunk/engines/sci/graphics/frameout.cpp

Modified: scummvm/trunk/engines/sci/graphics/controls.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/controls.cpp	2010-04-17 15:03:16 UTC (rev 48688)
+++ scummvm/trunk/engines/sci/graphics/controls.cpp	2010-04-17 15:16:40 UTC (rev 48689)
@@ -116,12 +116,12 @@
 	if (!_texteditCursorVisible) {
 		textWidth = 0;
 		for (i = 0; i < curPos; i++) {
-			textWidth += _text16->_font->getCharWidth(text[i]);
+			textWidth += _text16->_font->getCharWidth((unsigned char)text[i]);
 		}
 		_texteditCursorRect.left = rect.left + textWidth;
 		_texteditCursorRect.top = rect.top;
 		_texteditCursorRect.bottom = _texteditCursorRect.top + _text16->_font->getHeight();
-		_texteditCursorRect.right = _texteditCursorRect.left + (text[curPos] == 0 ? 1 : _text16->_font->getCharWidth(text[curPos]));
+		_texteditCursorRect.right = _texteditCursorRect.left + (text[curPos] == 0 ? 1 : _text16->_font->getCharWidth((unsigned char)text[curPos]));
 		_paint16->invertRect(_texteditCursorRect);
 		_paint16->bitsShow(_texteditCursorRect);
 		_texteditCursorVisible = true;

Modified: scummvm/trunk/engines/sci/graphics/font.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/font.h	2010-04-17 15:03:16 UTC (rev 48688)
+++ scummvm/trunk/engines/sci/graphics/font.h	2010-04-17 15:16:40 UTC (rev 48689)
@@ -39,7 +39,6 @@
 	virtual byte getHeight() { return 0; };
 	virtual bool isDoubleByte(uint16 chr) { return false; };
 	virtual byte getCharWidth(uint16 chr) { return 0; };
-	virtual byte getCharHeight(uint16 chr) { return 0; };
 	virtual void draw(uint16 chr, int16 top, int16 left, byte color, bool greyedOutput) {};
 };
 
@@ -56,10 +55,10 @@
 	GuiResourceId getResourceId();
 	byte getHeight();
 	byte getCharWidth(uint16 chr);
-	byte getCharHeight(uint16 chr);
 	void draw(uint16 chr, int16 top, int16 left, byte color, bool greyedOutput);
 
 private:
+	byte getCharHeight(uint16 chr);
 	byte *getCharData(uint16 chr);
 
 	ResourceManager *_resMan;

Modified: scummvm/trunk/engines/sci/graphics/fontsjis.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/fontsjis.cpp	2010-04-17 15:03:16 UTC (rev 48688)
+++ scummvm/trunk/engines/sci/graphics/fontsjis.cpp	2010-04-17 15:16:40 UTC (rev 48689)
@@ -67,10 +67,6 @@
 	return _commonFont->getCharWidth(chr) >> 1;
 
 }
-byte GfxFontSjis::getCharHeight(uint16 chr) {
-	return _commonFont->getFontHeight() >> 1;
-}
-
 void GfxFontSjis::draw(uint16 chr, int16 top, int16 left, byte color, bool greyedOutput) {
 	// TODO: Check, if character fits on screen - if it doesn't we need to skip it
 	//  Normally SCI cuts the character and draws the part that fits, but the common SJIS doesn't support that

Modified: scummvm/trunk/engines/sci/graphics/fontsjis.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/fontsjis.h	2010-04-17 15:03:16 UTC (rev 48688)
+++ scummvm/trunk/engines/sci/graphics/fontsjis.h	2010-04-17 15:16:40 UTC (rev 48689)
@@ -44,7 +44,6 @@
 	byte getHeight();
 	bool isDoubleByte(uint16 chr);
 	byte getCharWidth(uint16 chr);
-	byte getCharHeight(uint16 chr);
 	void draw(uint16 chr, int16 top, int16 left, byte color, bool greyedOutput);
 
 private:

Modified: scummvm/trunk/engines/sci/graphics/frameout.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/frameout.cpp	2010-04-17 15:03:16 UTC (rev 48688)
+++ scummvm/trunk/engines/sci/graphics/frameout.cpp	2010-04-17 15:16:40 UTC (rev 48689)
@@ -252,7 +252,7 @@
 							// TODO: proper text splitting... this is a hack
 							if ((text[i] == ' ' && i > 0 && text[i - i] == ' ') || text[i] == '\n' || 
 								(curX + font->getCharWidth(text[i]) > _screen->getWidth())) {
-								curY += font->getCharHeight('A');
+								curY += font->getHeight();
 								curX = itemEntry->x;
 							}
 							font->draw(text[i], curY, curX, foreColor, dimmed);


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