diff options
author | Martin Kiewitz | 2010-04-17 15:16:40 +0000 |
---|---|---|
committer | Martin Kiewitz | 2010-04-17 15:16:40 +0000 |
commit | da2027da361109b953c0105ab9700aad3bb5e60e (patch) | |
tree | ce7d12d16899e30addd592be0a43e3fedfd9eb56 /engines/sci | |
parent | 09c0e553060fd3f5a84931a9ead0610026f9d3a4 (diff) | |
download | scummvm-rg350-da2027da361109b953c0105ab9700aad3bb5e60e.tar.gz scummvm-rg350-da2027da361109b953c0105ab9700aad3bb5e60e.tar.bz2 scummvm-rg350-da2027da361109b953c0105ab9700aad3bb5e60e.zip |
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
svn-id: r48689
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/graphics/controls.cpp | 4 | ||||
-rw-r--r-- | engines/sci/graphics/font.h | 3 | ||||
-rw-r--r-- | engines/sci/graphics/fontsjis.cpp | 4 | ||||
-rw-r--r-- | engines/sci/graphics/fontsjis.h | 1 | ||||
-rw-r--r-- | engines/sci/graphics/frameout.cpp | 2 |
5 files changed, 4 insertions, 10 deletions
diff --git a/engines/sci/graphics/controls.cpp b/engines/sci/graphics/controls.cpp index 8a2c3275be..b1392cea11 100644 --- a/engines/sci/graphics/controls.cpp +++ b/engines/sci/graphics/controls.cpp @@ -116,12 +116,12 @@ void GfxControls::texteditCursorDraw(Common::Rect rect, const char *text, uint16 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; diff --git a/engines/sci/graphics/font.h b/engines/sci/graphics/font.h index c405f5a0a0..90f18e426d 100644 --- a/engines/sci/graphics/font.h +++ b/engines/sci/graphics/font.h @@ -39,7 +39,6 @@ public: 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 @@ public: 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; diff --git a/engines/sci/graphics/fontsjis.cpp b/engines/sci/graphics/fontsjis.cpp index 8e908c2853..c2e3d12318 100644 --- a/engines/sci/graphics/fontsjis.cpp +++ b/engines/sci/graphics/fontsjis.cpp @@ -67,10 +67,6 @@ byte GfxFontSjis::getCharWidth(uint16 chr) { 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 diff --git a/engines/sci/graphics/fontsjis.h b/engines/sci/graphics/fontsjis.h index 4330342331..24c8423ddb 100644 --- a/engines/sci/graphics/fontsjis.h +++ b/engines/sci/graphics/fontsjis.h @@ -44,7 +44,6 @@ public: 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: diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp index e401798233..78253bd913 100644 --- a/engines/sci/graphics/frameout.cpp +++ b/engines/sci/graphics/frameout.cpp @@ -252,7 +252,7 @@ void GfxFrameout::kernelFrameout() { // 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); |