[Scummvm-cvs-logs] scummvm master -> c06c05a7696a4145afc74ffe679c9048bfc02246

athrxx athrxx at scummvm.org
Sun Jul 10 00:49:25 CEST 2011


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

Summary:
c06c05a769 GRAPHICS: remove char/line spacing handling from sjis code


Commit: c06c05a7696a4145afc74ffe679c9048bfc02246
    https://github.com/scummvm/scummvm/commit/c06c05a7696a4145afc74ffe679c9048bfc02246
Author: athrxx (athrxx at scummvm.org)
Date: 2011-07-09T15:45:00-07:00

Commit Message:
GRAPHICS: remove char/line spacing handling from sjis code

(as discussed with LordHoto this should rather be handled in the engine)

Changed paths:
    engines/scumm/charset.cpp
    graphics/sjis.cpp
    graphics/sjis.h



diff --git a/engines/scumm/charset.cpp b/engines/scumm/charset.cpp
index 33010af..b38bd3b 100644
--- a/engines/scumm/charset.cpp
+++ b/engines/scumm/charset.cpp
@@ -68,10 +68,7 @@ void ScummEngine::loadCJKFont() {
 			error("SCUMM::Font: Could not open file 'pce.cdbios'");
 
 		_cjkFont->setDrawingMode(Graphics::FontSJIS::kShadowMode);
-		_cjkFont->setCharSpacing(-1);
-		_cjkFont->setLineSpacing(-1);
-		_2byteWidth = _cjkFont->getMaxFontWidth();
-		_2byteHeight = _cjkFont->getFontHeight();
+		_2byteWidth = _2byteHeight = 12;
 		_useCJKMode = true;		
 #endif
 	} else if (_game.id == GID_MONKEY && _game.platform == Common::kPlatformSegaCD && _language == Common::JA_JPN) {
@@ -1127,18 +1124,14 @@ void CharsetRendererPCE::drawBits1(const Graphics::Surface &s, byte *dst, const
 }
 
 int CharsetRendererPCE::getDrawWidthIntern(uint16 chr) {
-	if (_vm->_useCJKMode && chr > 127) {
-		assert(_vm->_cjkFont);
-		return _vm->_cjkFont->getCharWidth(chr);
-	}
+	if (_vm->_useCJKMode && chr > 127)
+		return _vm->_2byteWidth;
 	return CharsetRendererV3::getDrawWidthIntern(chr);
 }
 
 int CharsetRendererPCE::getDrawHeightIntern(uint16 chr) {
-	if (_vm->_useCJKMode && chr > 127) {
-		assert(_vm->_cjkFont);
-		return _vm->_cjkFont->getFontHeight();
-	}
+	if (_vm->_useCJKMode && chr > 127)
+		return _vm->_2byteHeight;
 	return CharsetRendererV3::getDrawHeightIntern(chr);
 }
 
diff --git a/graphics/sjis.cpp b/graphics/sjis.cpp
index 03c3ced..be078a4 100644
--- a/graphics/sjis.cpp
+++ b/graphics/sjis.cpp
@@ -76,7 +76,7 @@ void FontSJIS::drawChar(Graphics::Surface &dst, uint16 ch, int x, int y, uint32
 }
 
 FontSJISBase::FontSJISBase()
-	: _drawMode(kDefaultMode), _flippedMode(false), _fontWidth(16), _fontHeight(16), _charSpacing(0), _lineSpacing(0), _bitPosNewLineMask(0) {
+	: _drawMode(kDefaultMode), _flippedMode(false), _fontWidth(16), _fontHeight(16), _bitPosNewLineMask(0) {
 }
 
 void FontSJISBase::setDrawingMode(DrawingMode mode) {
@@ -93,43 +93,35 @@ void FontSJISBase::toggleFlippedMode(bool enable) {
 		warning("Flipped mode unsupported by this font");	
 }
 
-void FontSJISBase::setCharSpacing(int spacing) {
-	_charSpacing = spacing;
-}
-
-void FontSJISBase::setLineSpacing(int spacing) {
-	_lineSpacing = spacing;
-}
-
 uint FontSJISBase::getFontHeight() const {
 	switch (_drawMode) {
 	case kOutlineMode:
-		return _fontHeight + _lineSpacing + 2;
+		return _fontHeight + 2;
 
 	case kDefaultMode:
-		return _fontHeight + _lineSpacing;
+		return _fontHeight;
 
 	default:
-		return _fontHeight + _lineSpacing + 1;
+		return _fontHeight + 1;
 	}
 }
 
 uint FontSJISBase::getMaxFontWidth() const {
 	switch (_drawMode) {
 	case kOutlineMode:
-		return _fontWidth + _charSpacing + 2;
+		return _fontWidth + 2;
 
 	case kDefaultMode:
-		return _fontWidth + _charSpacing;
+		return _fontWidth;
 
 	default:
-		return _fontWidth + _charSpacing + 1;
+		return _fontWidth + 1;
 	}
 }
 
 uint FontSJISBase::getCharWidth(uint16 ch) const {
 	if (isASCII(ch))
-		return ((_drawMode == kOutlineMode) ? 10 : (_drawMode == kDefaultMode ? 8 : 9)) + _charSpacing;
+		return ((_drawMode == kOutlineMode) ? 10 : (_drawMode == kDefaultMode ? 8 : 9));
 	else
 		return getMaxFontWidth();
 }
diff --git a/graphics/sjis.h b/graphics/sjis.h
index de2d4b3..4b54da5 100644
--- a/graphics/sjis.h
+++ b/graphics/sjis.h
@@ -146,10 +146,6 @@ public:
 
 	virtual void toggleFlippedMode(bool enable);
 
-	virtual void setCharSpacing(int spacing);
-
-	virtual void setLineSpacing(int spacing);
-
 	virtual uint getFontHeight() const;
 
 	virtual uint getMaxFontWidth() const;
@@ -172,7 +168,6 @@ protected:
 	DrawingMode _drawMode;
 	bool _flippedMode;
 	int _fontWidth, _fontHeight;
-	int _charSpacing, _lineSpacing;
 	uint8 _bitPosNewLineMask;
 	
 	bool isASCII(uint16 ch) const;






More information about the Scummvm-git-logs mailing list