aboutsummaryrefslogtreecommitdiff
path: root/engines/xeen/font.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2014-12-31 16:38:17 -1000
committerPaul Gilbert2014-12-31 16:38:17 -1000
commit6e587578c64a7439c330dff09ee1205a97c5b24a (patch)
treee6ac13cdde5ce611c679cef088ce1a946b536b0b /engines/xeen/font.cpp
parentc6a2f539d428ea580274a3ac5605e00fad7b8570 (diff)
downloadscummvm-rg350-6e587578c64a7439c330dff09ee1205a97c5b24a.tar.gz
scummvm-rg350-6e587578c64a7439c330dff09ee1205a97c5b24a.tar.bz2
scummvm-rg350-6e587578c64a7439c330dff09ee1205a97c5b24a.zip
XEEN: Implemented writeChar
Diffstat (limited to 'engines/xeen/font.cpp')
-rw-r--r--engines/xeen/font.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/engines/xeen/font.cpp b/engines/xeen/font.cpp
index 2894bce7d8..dd1b4dc321 100644
--- a/engines/xeen/font.cpp
+++ b/engines/xeen/font.cpp
@@ -20,6 +20,7 @@
*
*/
+#include "common/endian.h"
#include "xeen/font.h"
#include "xeen/resdata.h"
@@ -307,7 +308,29 @@ void FontSurface::setTextColor(int idx) {
* Wrie a character to the surface
*/
void FontSurface::writeChar(char c) {
- error("TODO");
+ // Get y position, handling kerning
+ int y = _writePos.y;
+ if (c == 'g' || c == 'p' || c == 'q' || c == 'y')
+ ++y;
+
+ // Get pointers into font data and surface to write pixels to
+ int charIndex = (int)c + (_fontReduced ? 0x80 : 0);
+ const byte *srcP = &_fontData[charIndex * 16];
+
+ for (int yp = 0; yp < FONT_HEIGHT; ++yp, ++y) {
+ uint16 lineData = READ_LE_UINT16(srcP); srcP += 2;
+ byte *destP = (byte *)getBasePtr(_writePos.x, y);
+
+ for (int xp = 0; xp < FONT_WIDTH; ++xp, ++destP) {
+ int colIndex = lineData & 3;
+ lineData >>= 2;
+
+ if (colIndex)
+ *destP = _textColors[colIndex];
+ }
+ }
+
+ _writePos.x += _fontData[0x1000 + charIndex];
}
} // End of namespace Xeen