From cdc299d8abdb45de35328716df00af72da5a8019 Mon Sep 17 00:00:00 2001 From: Pawel Kolodziejski Date: Sun, 20 Mar 2005 11:49:21 +0000 Subject: [PATCH] fixed drawing 'spaces' in textobjects --- font.h | 2 +- textobject.cpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/font.h b/font.h index e19ca34923f..9c7b35c839f 100644 --- a/font.h +++ b/font.h @@ -30,7 +30,7 @@ public: uint32 getCharWidth(char c) { return _charHeaders[_charIndex[c]].width; } uint32 getCharHeight(char c) { return _charHeaders[_charIndex[c]].height; } - uint32 getCharLogicalWidth(char c) { return _charHeaders[_charIndex[c]].startingCol; } + uint32 getCharLogicalWidth(char c) { return _charHeaders[_charIndex[c]].logicalWidth; } uint32 getCharStartingCol(char c) { return _charHeaders[_charIndex[c]].startingCol; } uint32 getCharStartingLine(char c) { return _charHeaders[_charIndex[c]].startingLine; } const byte *getCharData(char c) { return _fontData + (_charHeaders[_charIndex[c]].offset); } diff --git a/textobject.cpp b/textobject.cpp index 2b402c25e1c..0fa8b6d966e 100644 --- a/textobject.cpp +++ b/textobject.cpp @@ -34,7 +34,7 @@ TextObject::TextObject(const char *text, const int x, const int y, /*const*/ Fon _bitmapHeight = _bitmapWidth = 0; for (int i = 0; msg[i] != '\0'; ++i) { - _bitmapWidth += font->getCharWidth(msg[i]) + font->getCharStartingCol(msg[i]); + _bitmapWidth += font->getCharLogicalWidth(msg[i]) + font->getCharStartingCol(msg[i]); int h = font->getCharHeight(msg[i]) + font->getCharStartingLine(msg[i]); if (h > _bitmapHeight) @@ -51,6 +51,7 @@ TextObject::TextObject(const char *text, const int x, const int y, /*const*/ Fon for (int line = 0; line < _bitmapHeight; ++line) { for (int c = 0; msg[c] != '\0'; ++c) { uint32 charWidth = font->getCharWidth(msg[c]); + uint32 charLogicalWidth = font->getCharLogicalWidth(msg[c]); uint8 startingCol = font->getCharStartingCol(msg[c]); uint8 startingLine = font->getCharStartingLine(msg[c]); @@ -59,7 +60,7 @@ TextObject::TextObject(const char *text, const int x, const int y, /*const*/ Fon font->getCharData(msg[c]) + charWidth * (line - startingLine), charWidth); } - offset += charWidth + startingCol; + offset += charLogicalWidth + startingCol; } }