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
This commit is contained in:
Martin Kiewitz
2010-04-17 15:16:40 +00:00
parent 09c0e55306
commit da2027da36
5 changed files with 4 additions and 10 deletions
+2 -2
View File
@@ -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;
+1 -2
View File
@@ -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;
-4
View File
@@ -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
-1
View File
@@ -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:
+1 -1
View File
@@ -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);