From a9789acfc61a057c82c6cc42386afc9b23813c24 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sun, 21 Mar 2004 21:20:25 +0000 Subject: Moved Surface/Font code into new 'graphics' module svn-id: r13357 --- graphics/animation.cpp | 23 + graphics/animation.h | 56 ++ graphics/font.cpp | 156 +++ graphics/font.h | 107 ++ graphics/module.mk | 13 + graphics/newfont.cpp | 2600 ++++++++++++++++++++++++++++++++++++++++++++++++ graphics/scummfont.cpp | 112 +++ graphics/surface.h | 46 + 8 files changed, 3113 insertions(+) create mode 100644 graphics/animation.cpp create mode 100644 graphics/animation.h create mode 100644 graphics/font.cpp create mode 100644 graphics/font.h create mode 100644 graphics/module.mk create mode 100644 graphics/newfont.cpp create mode 100644 graphics/scummfont.cpp create mode 100644 graphics/surface.h (limited to 'graphics') diff --git a/graphics/animation.cpp b/graphics/animation.cpp new file mode 100644 index 0000000000..44d0d854eb --- /dev/null +++ b/graphics/animation.cpp @@ -0,0 +1,23 @@ +/* ScummVM - Scumm Interpreter + * Copyright (C) 2002-2004 The ScummVM project + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Header$ + * + */ + +#include "common/stdafx.h" +#include "graphics/animation.h" diff --git a/graphics/animation.h b/graphics/animation.h new file mode 100644 index 0000000000..ce3ff6620f --- /dev/null +++ b/graphics/animation.h @@ -0,0 +1,56 @@ +/* ScummVM - Scumm Interpreter + * Copyright (C) 2002-2004 The ScummVM project + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Header$ + * + */ + +#ifndef GRAPHICS_ANIMATION_H +#define GRAPHICS_ANIMATION_H + +// Uncomment this if you are using libmpeg2 0.3.1. +// #define USE_MPEG2_0_3_1 + +#ifdef _MSC_VER +typedef int8 int8_t; +typedef int16 int16_t; +typedef int32 int32_t; + +typedef uint8 uint8_t; +typedef uint16 uint16_t; +typedef uint32 uint32_t; +#else +#include +#endif + +#ifdef USE_MPEG2 +extern "C" { + #include +} + +#ifdef USE_MPEG2_0_3_1 +typedef int mpeg2_state_t; +typedef sequence_t mpeg2_sequence_t; +#define STATE_BUFFER -1 +#endif + +#endif + + + + +#endif \ No newline at end of file diff --git a/graphics/font.cpp b/graphics/font.cpp new file mode 100644 index 0000000000..e57cb3aae1 --- /dev/null +++ b/graphics/font.cpp @@ -0,0 +1,156 @@ +/* ScummVM - Scumm Interpreter + * Copyright (C) 2002-2004 The ScummVM project + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Header$ + */ + +#include "common/stdafx.h" +#include "graphics/font.h" + +namespace Graphics { + +int NewFont::getCharWidth(byte chr) const { + // If no width table is specified, return the maximum width + if (!width) + return maxwidth; + // If this character is not included in the font, use the default char. + if (chr < firstchar || firstchar + size < chr) { + if (chr == ' ') + return maxwidth / 2; + chr = defaultchar; + } + return width[chr - firstchar]; +} + +void NewFont::drawChar(const Surface *dst, byte chr, int x, int y, uint32 color) const { + assert(dst != 0); + byte *ptr = (byte *)dst->pixels + x * dst->bytesPerPixel + y * dst->pitch; + + assert(bits != 0 && maxwidth <= 16); + assert(dst->bytesPerPixel == 1 || dst->bytesPerPixel == 2); + + // If this character is not included in the font, use the default char. + if (chr < firstchar || chr >= firstchar + size) { + if (chr == ' ') + return; + chr = defaultchar; + } + + const int w = getCharWidth(chr); + chr -= firstchar; + const bitmap_t *tmp = bits + (offset ? offset[chr] : (chr * height)); + + for (y = 0; y < height; y++) { + const bitmap_t buffer = *tmp++; + bitmap_t mask = 0x8000; + for (x = 0; x < w; x++) { + if ((buffer & mask) != 0) { + if (dst->bytesPerPixel == 1) + ptr[x] = color; + else if (dst->bytesPerPixel == 2) + ((uint16 *)ptr)[x] = color; + } + mask >>= 1; + } + ptr += dst->pitch; + } +} + + +#pragma mark - + + +int Font::getStringWidth(const Common::String &str) const { + int space = 0; + + for (uint i = 0; i < str.size(); ++i) + space += getCharWidth(str[i]); + return space; +} + +void Font::drawString(const Surface *dst, const Common::String &s, int x, int y, int w, uint32 color, TextAlignment align, int deltax, bool useEllipsis) const { + assert(dst != 0); + const int leftX = x, rightX = x + w; + uint i; + int width = getStringWidth(s); + Common::String str; + + if (useEllipsis && width > w) { + // String is too wide. So we shorten it "intellegently", by replacing + // parts of it by an ellipsis ("..."). There are three possibilities + // for this: replace the start, the end, or the middle of the string. + // What is best really depends on the context; but unless we want to + // make this configurable, replacing the middle probably is a good + // compromise. + const int ellipsisWidth = getStringWidth("..."); + + // SLOW algorithm to remove enough of the middle. But it is good enough + // for now. + const int halfWidth = (w - ellipsisWidth) / 2; + int w2 = 0; + + for (i = 0; i < s.size(); ++i) { + int charWidth = getCharWidth(s[i]); + if (w2 + charWidth > halfWidth) + break; + w2 += charWidth; + str += s[i]; + } + // At this point we know that the first 'i' chars are together 'w2' + // pixels wide. We took the first i-1, and add "..." to them. + str += "..."; + + // The original string is width wide. Of those we already skipped past + // w2 pixels, which means (width - w2) remain. + // The new str is (w2+ellipsisWidth) wide, so we can accomodate about + // (w - (w2+ellipsisWidth)) more pixels. + // Thus we skip ((width - w2) - (w - (w2+ellipsisWidth))) = + // (width + ellipsisWidth - w) + int skip = width + ellipsisWidth - w; + for (; i < s.size() && skip > 0; ++i) { + skip -= getCharWidth(s[i]); + } + + // Append the remaining chars, if any + for (; i < s.size(); ++i) { + str += s[i]; + } + + width = getStringWidth(str); + + } else { + str = s; + } + + if (align == kTextAlignCenter) + x = x + (w - width - 1)/2; + else if (align == kTextAlignRight) + x = x + w - width; + x += deltax; + + for (i = 0; i < str.size(); ++i) { + w = getCharWidth(str[i]); + if (x+w > rightX) + break; + if (x >= leftX) + drawChar(dst, str[i], x, y, color); + x += w; + } +} + + +} // End of namespace Graphics diff --git a/graphics/font.h b/graphics/font.h new file mode 100644 index 0000000000..2d5d6c9bd4 --- /dev/null +++ b/graphics/font.h @@ -0,0 +1,107 @@ +/* ScummVM - Scumm Interpreter + * Copyright (C) 2002-2004 The ScummVM project + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Header$ + */ + +#ifndef FONT_H +#define FONT_H + +#include "common/str.h" +#include "graphics/surface.h" + +namespace Graphics { + +// Text alignment modes for drawString() +enum TextAlignment { + kTextAlignLeft, + kTextAlignCenter, + kTextAlignRight +}; + +/** + * Instances of this class represent a distinct font, with a built-in renderer. + * @todo Maybe move the high-level methods (drawString etc.) to a separate + * FontRenderer class? That way, we could have different variants... ? + * @todo Add more parameters to drawString, or additional similar methods, + * featuring abilities like + * - rendering with wrap-around instead of inserting an ellipsis or + * cutting them; needs a 'height' parameter + * - rendering multi-line strings (essentially, invoke the regular + * drawString for each line, and advance one line) + * - combinations of the two above: honor line feeds, and also wrap + * overlong lines + */ +class Font { +public: + virtual int getFontHeight() const = 0; + virtual int getMaxCharWidth() const = 0; + + virtual int getCharWidth(byte chr) const = 0; + virtual void drawChar(const Surface *dst, byte chr, int x, int y, uint32 color) const = 0; + + void drawString(const Surface *dst, const Common::String &str, int x, int y, int w, uint32 color, TextAlignment align = kTextAlignLeft, int deltax = 0, bool useEllipsis = true) const; + int getStringWidth(const Common::String &str) const; +}; + + +class ScummFont : public Font { +public: + virtual int getFontHeight() const { return 8; } + virtual int getMaxCharWidth() const { return 8; }; + + virtual int getCharWidth(byte chr) const; + virtual void drawChar(const Surface *dst, byte chr, int x, int y, uint32 color) const; +}; + +extern const ScummFont g_scummfont; + + + +typedef unsigned short bitmap_t; /* bitmap image unit size*/ + +/* builtin C-based proportional/fixed font structure */ +/* based on The Microwindows Project http://microwindows.org */ +class NewFont : public Font { +protected: + const char * name; /* font name*/ + int maxwidth; /* max width in pixels*/ + int height; /* height in pixels*/ + int ascent; /* ascent (baseline) height*/ + int firstchar; /* first character in bitmap*/ + int size; /* font size in glyphs*/ + const bitmap_t* bits; /* 16-bit right-padded bitmap data*/ + const unsigned long* offset; /* offsets into bitmap data*/ + const unsigned char* width; /* character widths or NULL if fixed*/ + int defaultchar; /* default char (not glyph index)*/ + long bits_size; /* # words of bitmap_t bits*/ + +public: + NewFont(); + + virtual int getFontHeight() const { return height; } + virtual int getMaxCharWidth() const { return maxwidth; }; + + virtual int getCharWidth(byte chr) const; + virtual void drawChar(const Surface *dst, byte chr, int x, int y, uint32 color) const; +}; + +extern const NewFont g_sysfont; + +} // End of namespace Graphics + +#endif diff --git a/graphics/module.mk b/graphics/module.mk new file mode 100644 index 0000000000..1eb103267a --- /dev/null +++ b/graphics/module.mk @@ -0,0 +1,13 @@ +MODULE := graphics + +MODULE_OBJS := \ + graphics/animation.o \ + graphics/font.o \ + graphics/scummfont.o \ + graphics/newfont.o + +MODULE_DIRS += \ + graphics + +# Include common rules +include $(srcdir)/common.rules diff --git a/graphics/newfont.cpp b/graphics/newfont.cpp new file mode 100644 index 0000000000..a308bb6656 --- /dev/null +++ b/graphics/newfont.cpp @@ -0,0 +1,2600 @@ +/* Generated by convbdf on Thu Nov 20 00:15:51 2003. */ +#include "common/stdafx.h" +#include "graphics/font.h" + +/* Font information: + name: 04b-16b-10 + facename: 04b-16b-10 + w x h: 9x10 + size: 94 + ascent: 8 + descent: 2 + first char: 33 (0x21) + last char: 126 (0x7e) + default char: 33 (0x21) + proportional: yes + +*/ + +namespace Graphics { + +/* Font character bitmap data. */ +static const bitmap_t _font_bits[] = { + +/* Character 33 (0x21): + width 3 + +---+ + | | + | * | + | * | + | * | + | * | + | * | + | | + | * | + | | + | | + +---+ +*/ +0x0000, +0x4000, +0x4000, +0x4000, +0x4000, +0x4000, +0x0000, +0x4000, +0x0000, +0x0000, + +/* Character 34 (0x22): + width 4 + +----+ + | | + |* * | + |* * | + | | + | | + | | + | | + | | + | | + | | + +----+ +*/ +0x0000, +0xa000, +0xa000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +/* Character 35 (0x23): + width 6 + +------+ + | | + | | + | * * | + |***** | + | * * | + |***** | + | * * | + | | + | | + | | + +------+ +*/ +0x0000, +0x0000, +0x5000, +0xf800, +0x5000, +0xf800, +0x5000, +0x0000, +0x0000, +0x0000, + +/* Character 36 (0x24): + width 6 + +------+ + | * | + | *** | + |* * * | + |* * | + | *** | + | * * | + |* * * | + | *** | + | * | + | | + +------+ +*/ +0x2000, +0x7000, +0xa800, +0xa000, +0x7000, +0x2800, +0xa800, +0x7000, +0x2000, +0x0000, + +/* Character 37 (0x25): + width 9 + +---------+ + | | + | * * | + |* * * | + |* * * | + | * * | + | * * | + | * * * | + | * * * | + | * * | + | | + +---------+ +*/ +0x0000, +0x4400, +0xa400, +0xa800, +0x4800, +0x1200, +0x1500, +0x2500, +0x2200, +0x0000, + +/* Character 38 (0x26): + width 5 + +-----+ + | | + | ** | + |* | + |* * | + | *** | + |* * | + |* * | + | * * | + | | + | | + +-----+ +*/ +0x0000, +0x6000, +0x8000, +0xa000, +0x7000, +0xa000, +0xa000, +0x5000, +0x0000, +0x0000, + +/* Character 39 (0x27): + width 2 + +--+ + | | + |* | + |* | + | | + | | + | | + | | + | | + | | + | | + +--+ +*/ +0x0000, +0x8000, +0x8000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +/* Character 40 (0x28): + width 5 + +-----+ + | | + | * | + | * | + | * | + | * | + | * | + | * | + | * | + | | + | | + +-----+ +*/ +0x0000, +0x1000, +0x2000, +0x4000, +0x4000, +0x4000, +0x2000, +0x1000, +0x0000, +0x0000, + +/* Character 41 (0x29): + width 5 + +-----+ + | | + |* | + | * | + | * | + | * | + | * | + | * | + |* | + | | + | | + +-----+ +*/ +0x0000, +0x8000, +0x4000, +0x2000, +0x2000, +0x2000, +0x4000, +0x8000, +0x0000, +0x0000, + +/* Character 42 (0x2a): + width 6 + +------+ + | | + | | + | * | + |* * * | + | *** | + |* * * | + | * | + | | + | | + | | + +------+ +*/ +0x0000, +0x0000, +0x2000, +0xa800, +0x7000, +0xa800, +0x2000, +0x0000, +0x0000, +0x0000, + +/* Character 43 (0x2b): + width 6 + +------+ + | | + | | + | * | + | * | + |***** | + | * | + | * | + | | + | | + | | + +------+ +*/ +0x0000, +0x0000, +0x2000, +0x2000, +0xf800, +0x2000, +0x2000, +0x0000, +0x0000, +0x0000, + +/* Character 44 (0x2c): + width 3 + +---+ + | | + | | + | | + | | + | | + | * | + | | + | * | + |* | + | | + +---+ +*/ +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x4000, +0x0000, +0x4000, +0x8000, +0x0000, + +/* Character 45 (0x2d): + width 5 + +-----+ + | | + | | + | | + | | + |**** | + | | + | | + | | + | | + | | + +-----+ +*/ +0x0000, +0x0000, +0x0000, +0x0000, +0xf000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +/* Character 46 (0x2e): + width 2 + +--+ + | | + | | + | | + | | + | | + | | + | | + |* | + | | + | | + +--+ +*/ +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x8000, +0x0000, +0x0000, + +/* Character 47 (0x2f): + width 5 + +-----+ + | | + | * | + | * | + | * | + | * | + | * | + | * | + |* | + |* | + | | + +-----+ +*/ +0x0000, +0x1000, +0x1000, +0x2000, +0x2000, +0x4000, +0x4000, +0x8000, +0x8000, +0x0000, + +/* Character 48 (0x30): + width 5 + +-----+ + | | + | ** | + |* * | + |* * | + |* * | + |* * | + |* * | + | ** | + | | + | | + +-----+ +*/ +0x0000, +0x6000, +0x9000, +0x9000, +0x9000, +0x9000, +0x9000, +0x6000, +0x0000, +0x0000, + +/* Character 49 (0x31): + width 3 + +---+ + | | + | * | + |** | + | * | + | * | + | * | + | * | + | * | + | | + | | + +---+ +*/ +0x0000, +0x4000, +0xc000, +0x4000, +0x4000, +0x4000, +0x4000, +0x4000, +0x0000, +0x0000, + +/* Character 50 (0x32): + width 5 + +-----+ + | | + |*** | + | * | + | * | + | * | + | * | + |* | + |**** | + | | + | | + +-----+ +*/ +0x0000, +0xe000, +0x1000, +0x1000, +0x2000, +0x4000, +0x8000, +0xf000, +0x0000, +0x0000, + +/* Character 51 (0x33): + width 5 + +-----+ + | | + |*** | + | * | + | * | + | ** | + | * | + | * | + |*** | + | | + | | + +-----+ +*/ +0x0000, +0xe000, +0x1000, +0x1000, +0x6000, +0x1000, +0x1000, +0xe000, +0x0000, +0x0000, + +/* Character 52 (0x34): + width 5 + +-----+ + | | + | * | + | ** | + |* * | + |* * | + |**** | + | * | + | * | + | | + | | + +-----+ +*/ +0x0000, +0x2000, +0x6000, +0xa000, +0xa000, +0xf000, +0x2000, +0x2000, +0x0000, +0x0000, + +/* Character 53 (0x35): + width 5 + +-----+ + | | + |**** | + |* | + |*** | + | * | + | * | + | * | + |*** | + | | + | | + +-----+ +*/ +0x0000, +0xf000, +0x8000, +0xe000, +0x1000, +0x1000, +0x1000, +0xe000, +0x0000, +0x0000, + +/* Character 54 (0x36): + width 5 + +-----+ + | | + | ** | + |* | + |*** | + |* * | + |* * | + |* * | + | ** | + | | + | | + +-----+ +*/ +0x0000, +0x6000, +0x8000, +0xe000, +0x9000, +0x9000, +0x9000, +0x6000, +0x0000, +0x0000, + +/* Character 55 (0x37): + width 5 + +-----+ + | | + |**** | + | * | + | * | + | * | + | * | + | * | + | * | + | | + | | + +-----+ +*/ +0x0000, +0xf000, +0x1000, +0x1000, +0x2000, +0x2000, +0x4000, +0x4000, +0x0000, +0x0000, + +/* Character 56 (0x38): + width 5 + +-----+ + | | + | ** | + |* * | + |* * | + | ** | + |* * | + |* * | + | ** | + | | + | | + +-----+ +*/ +0x0000, +0x6000, +0x9000, +0x9000, +0x6000, +0x9000, +0x9000, +0x6000, +0x0000, +0x0000, + +/* Character 57 (0x39): + width 5 + +-----+ + | | + | ** | + |* * | + |* * | + |* * | + | *** | + | * | + | ** | + | | + | | + +-----+ +*/ +0x0000, +0x6000, +0x9000, +0x9000, +0x9000, +0x7000, +0x1000, +0x6000, +0x0000, +0x0000, + +/* Character 58 (0x3a): + width 2 + +--+ + | | + | | + | | + |* | + | | + |* | + | | + | | + | | + | | + +--+ +*/ +0x0000, +0x0000, +0x0000, +0x8000, +0x0000, +0x8000, +0x0000, +0x0000, +0x0000, +0x0000, + +/* Character 59 (0x3b): + width 2 + +--+ + | | + | | + | | + |* | + | | + |* | + |* | + | | + | | + | | + +--+ +*/ +0x0000, +0x0000, +0x0000, +0x8000, +0x0000, +0x8000, +0x8000, +0x0000, +0x0000, +0x0000, + +/* Character 60 (0x3c): + width 5 + +-----+ + | | + | | + | * | + | * | + | * | + | * | + | * | + | | + | | + | | + +-----+ +*/ +0x0000, +0x0000, +0x1000, +0x2000, +0x4000, +0x2000, +0x1000, +0x0000, +0x0000, +0x0000, + +/* Character 61 (0x3d): + width 5 + +-----+ + | | + | | + | | + |**** | + | | + |**** | + | | + | | + | | + | | + +-----+ +*/ +0x0000, +0x0000, +0x0000, +0xf000, +0x0000, +0xf000, +0x0000, +0x0000, +0x0000, +0x0000, + +/* Character 62 (0x3e): + width 5 + +-----+ + | | + | | + |* | + | * | + | * | + | * | + |* | + | | + | | + | | + +-----+ +*/ +0x0000, +0x0000, +0x8000, +0x4000, +0x2000, +0x4000, +0x8000, +0x0000, +0x0000, +0x0000, + +/* Character 63 (0x3f): + width 5 + +-----+ + | | + |*** | + | * | + | * | + | * | + | * | + | | + | * | + | | + | | + +-----+ +*/ +0x0000, +0xe000, +0x1000, +0x1000, +0x2000, +0x4000, +0x0000, +0x4000, +0x0000, +0x0000, + +/* Character 64 (0x40): + width 7 + +-------+ + | | + | *** | + | * * | + |* *** | + |* * * | + |* *** | + | * | + | **** | + | | + | | + +-------+ +*/ +0x0000, +0x3800, +0x4400, +0x9c00, +0xa400, +0x9c00, +0x4000, +0x3c00, +0x0000, +0x0000, + +/* Character 65 (0x41): + width 5 + +-----+ + | | + | ** | + |* * | + |**** | + |* * | + |* * | + |* * | + |* * | + | | + | | + +-----+ +*/ +0x0000, +0x6000, +0x9000, +0xf000, +0x9000, +0x9000, +0x9000, +0x9000, +0x0000, +0x0000, + +/* Character 66 (0x42): + width 5 + +-----+ + | | + |*** | + |* * | + |*** | + |* * | + |* * | + |* * | + |*** | + | | + | | + +-----+ +*/ +0x0000, +0xe000, +0x9000, +0xe000, +0x9000, +0x9000, +0x9000, +0xe000, +0x0000, +0x0000, + +/* Character 67 (0x43): + width 5 + +-----+ + | | + | ** | + |* * | + |* | + |* | + |* | + |* * | + | ** | + | | + | | + +-----+ +*/ +0x0000, +0x6000, +0x9000, +0x8000, +0x8000, +0x8000, +0x9000, +0x6000, +0x0000, +0x0000, + +/* Character 68 (0x44): + width 5 + +-----+ + | | + |*** | + |* * | + |* * | + |* * | + |* * | + |* * | + |*** | + | | + | | + +-----+ +*/ +0x0000, +0xe000, +0x9000, +0x9000, +0x9000, +0x9000, +0x9000, +0xe000, +0x0000, +0x0000, + +/* Character 69 (0x45): + width 5 + +-----+ + | | + |**** | + |* | + |**** | + |* | + |* | + |* | + |**** | + | | + | | + +-----+ +*/ +0x0000, +0xf000, +0x8000, +0xf000, +0x8000, +0x8000, +0x8000, +0xf000, +0x0000, +0x0000, + +/* Character 70 (0x46): + width 5 + +-----+ + | | + |**** | + |* | + |**** | + |* | + |* | + |* | + |* | + | | + | | + +-----+ +*/ +0x0000, +0xf000, +0x8000, +0xf000, +0x8000, +0x8000, +0x8000, +0x8000, +0x0000, +0x0000, + +/* Character 71 (0x47): + width 5 + +-----+ + | | + | ** | + |* * | + |* | + |* ** | + |* * | + |* * | + | ** | + | | + | | + +-----+ +*/ +0x0000, +0x6000, +0x9000, +0x8000, +0xb000, +0x9000, +0x9000, +0x6000, +0x0000, +0x0000, + +/* Character 72 (0x48): + width 5 + +-----+ + | | + |* * | + |* * | + |**** | + |* * | + |* * | + |* * | + |* * | + | | + | | + +-----+ +*/ +0x0000, +0x9000, +0x9000, +0xf000, +0x9000, +0x9000, +0x9000, +0x9000, +0x0000, +0x0000, + +/* Character 73 (0x49): + width 2 + +--+ + | | + |* | + |* | + |* | + |* | + |* | + |* | + |* | + | | + | | + +--+ +*/ +0x0000, +0x8000, +0x8000, +0x8000, +0x8000, +0x8000, +0x8000, +0x8000, +0x0000, +0x0000, + +/* Character 74 (0x4a): + width 5 + +-----+ + | | + | ** | + | * | + | * | + |* * | + |* * | + |* * | + | ** | + | | + | | + +-----+ +*/ +0x0000, +0x3000, +0x1000, +0x1000, +0x9000, +0x9000, +0x9000, +0x6000, +0x0000, +0x0000, + +/* Character 75 (0x4b): + width 5 + +-----+ + | | + |* * | + |* * | + |* * | + |** | + |* * | + |* * | + |* * | + | | + | | + +-----+ +*/ +0x0000, +0x9000, +0x9000, +0xa000, +0xc000, +0xa000, +0x9000, +0x9000, +0x0000, +0x0000, + +/* Character 76 (0x4c): + width 5 + +-----+ + | | + |* | + |* | + |* | + |* | + |* | + |* | + | *** | + | | + | | + +-----+ +*/ +0x0000, +0x8000, +0x8000, +0x8000, +0x8000, +0x8000, +0x8000, +0x7000, +0x0000, +0x0000, + +/* Character 77 (0x4d): + width 6 + +------+ + | | + |* * | + |** ** | + |* * * | + |* * | + |* * | + |* * | + |* * | + | | + | | + +------+ +*/ +0x0000, +0x8800, +0xd800, +0xa800, +0x8800, +0x8800, +0x8800, +0x8800, +0x0000, +0x0000, + +/* Character 78 (0x4e): + width 5 + +-----+ + | | + |* * | + |** * | + |* ** | + |* * | + |* * | + |* * | + |* * | + | | + | | + +-----+ +*/ +0x0000, +0x9000, +0xd000, +0xb000, +0x9000, +0x9000, +0x9000, +0x9000, +0x0000, +0x0000, + +/* Character 79 (0x4f): + width 5 + +-----+ + | | + | ** | + |* * | + |* * | + |* * | + |* * | + |* * | + | ** | + | | + | | + +-----+ +*/ +0x0000, +0x6000, +0x9000, +0x9000, +0x9000, +0x9000, +0x9000, +0x6000, +0x0000, +0x0000, + +/* Character 80 (0x50): + width 5 + +-----+ + | | + |*** | + |* * | + |* * | + |*** | + |* | + |* | + |* | + | | + | | + +-----+ +*/ +0x0000, +0xe000, +0x9000, +0x9000, +0xe000, +0x8000, +0x8000, +0x8000, +0x0000, +0x0000, + +/* Character 81 (0x51): + width 5 + +-----+ + | | + | ** | + |* * | + |* * | + |* * | + |* * | + |* * | + | ** | + | * | + | | + +-----+ +*/ +0x0000, +0x6000, +0x9000, +0x9000, +0x9000, +0x9000, +0x9000, +0x6000, +0x1000, +0x0000, + +/* Character 82 (0x52): + width 5 + +-----+ + | | + |*** | + |* * | + |* * | + |*** | + |* * | + |* * | + |* * | + | | + | | + +-----+ +*/ +0x0000, +0xe000, +0x9000, +0x9000, +0xe000, +0x9000, +0x9000, +0x9000, +0x0000, +0x0000, + +/* Character 83 (0x53): + width 5 + +-----+ + | | + | ** | + |* * | + |* | + | ** | + | * | + |* * | + | ** | + | | + | | + +-----+ +*/ +0x0000, +0x6000, +0x9000, +0x8000, +0x6000, +0x1000, +0x9000, +0x6000, +0x0000, +0x0000, + +/* Character 84 (0x54): + width 6 + +------+ + | | + |***** | + | * | + | * | + | * | + | * | + | * | + | * | + | | + | | + +------+ +*/ +0x0000, +0xf800, +0x2000, +0x2000, +0x2000, +0x2000, +0x2000, +0x2000, +0x0000, +0x0000, + +/* Character 85 (0x55): + width 5 + +-----+ + | | + |* * | + |* * | + |* * | + |* * | + |* * | + |* * | + | ** | + | | + | | + +-----+ +*/ +0x0000, +0x9000, +0x9000, +0x9000, +0x9000, +0x9000, +0x9000, +0x6000, +0x0000, +0x0000, + +/* Character 86 (0x56): + width 6 + +------+ + | | + |* * | + |* * | + |* * | + | * * | + | * * | + | * | + | * | + | | + | | + +------+ +*/ +0x0000, +0x8800, +0x8800, +0x8800, +0x5000, +0x5000, +0x2000, +0x2000, +0x0000, +0x0000, + +/* Character 87 (0x57): + width 6 + +------+ + | | + |* * | + |* * | + |* * | + |* * * | + |* * * | + | * * | + | * * | + | | + | | + +------+ +*/ +0x0000, +0x8800, +0x8800, +0x8800, +0xa800, +0xa800, +0x5000, +0x5000, +0x0000, +0x0000, + +/* Character 88 (0x58): + width 5 + +-----+ + | | + |* * | + |* * | + | ** | + |* * | + |* * | + |* * | + |* * | + | | + | | + +-----+ +*/ +0x0000, +0x9000, +0x9000, +0x6000, +0x9000, +0x9000, +0x9000, +0x9000, +0x0000, +0x0000, + +/* Character 89 (0x59): + width 6 + +------+ + | | + |* * | + |* * | + | * * | + | * | + | * | + | * | + | * | + | | + | | + +------+ +*/ +0x0000, +0x8800, +0x8800, +0x5000, +0x2000, +0x2000, +0x2000, +0x2000, +0x0000, +0x0000, + +/* Character 90 (0x5a): + width 5 + +-----+ + | | + |**** | + | * | + | * | + | * | + |* | + |* | + |**** | + | | + | | + +-----+ +*/ +0x0000, +0xf000, +0x1000, +0x2000, +0x4000, +0x8000, +0x8000, +0xf000, +0x0000, +0x0000, + +/* Character 91 (0x5b): + width 4 + +----+ + | | + | ** | + | * | + | * | + | * | + | * | + | * | + | ** | + | | + | | + +----+ +*/ +0x0000, +0x6000, +0x4000, +0x4000, +0x4000, +0x4000, +0x4000, +0x6000, +0x0000, +0x0000, + +/* Character 92 (0x5c): + width 5 + +-----+ + | | + |* | + |* | + | * | + | * | + | * | + | * | + | * | + | * | + | | + +-----+ +*/ +0x0000, +0x8000, +0x8000, +0x4000, +0x4000, +0x2000, +0x2000, +0x1000, +0x1000, +0x0000, + +/* Character 93 (0x5d): + width 4 + +----+ + | | + |** | + | * | + | * | + | * | + | * | + | * | + |** | + | | + | | + +----+ +*/ +0x0000, +0xc000, +0x4000, +0x4000, +0x4000, +0x4000, +0x4000, +0xc000, +0x0000, +0x0000, + +/* Character 94 (0x5e): + width 4 + +----+ + | | + | * | + |* * | + | | + | | + | | + | | + | | + | | + | | + +----+ +*/ +0x0000, +0x4000, +0xa000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +/* Character 95 (0x5f): + width 5 + +-----+ + | | + | | + | | + | | + | | + | | + | | + |**** | + | | + | | + +-----+ +*/ +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0xf000, +0x0000, +0x0000, + +/* Character 96 (0x60): + width 3 + +---+ + | | + |* | + | * | + | | + | | + | | + | | + | | + | | + | | + +---+ +*/ +0x0000, +0x8000, +0x4000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, + +/* Character 97 (0x61): + width 5 + +-----+ + | | + | | + | | + | *** | + |* * | + |* * | + |* * | + | *** | + | | + | | + +-----+ +*/ +0x0000, +0x0000, +0x0000, +0x7000, +0x9000, +0x9000, +0x9000, +0x7000, +0x0000, +0x0000, + +/* Character 98 (0x62): + width 5 + +-----+ + | | + |* | + |* | + |*** | + |* * | + |* * | + |* * | + |*** | + | | + | | + +-----+ +*/ +0x0000, +0x8000, +0x8000, +0xe000, +0x9000, +0x9000, +0x9000, +0xe000, +0x0000, +0x0000, + +/* Character 99 (0x63): + width 4 + +----+ + | | + | | + | | + | ** | + |* | + |* | + |* | + | ** | + | | + | | + +----+ +*/ +0x0000, +0x0000, +0x0000, +0x6000, +0x8000, +0x8000, +0x8000, +0x6000, +0x0000, +0x0000, + +/* Character 100 (0x64): + width 5 + +-----+ + | | + | * | + | * | + | *** | + |* * | + |* * | + |* * | + | *** | + | | + | | + +-----+ +*/ +0x0000, +0x1000, +0x1000, +0x7000, +0x9000, +0x9000, +0x9000, +0x7000, +0x0000, +0x0000, + +/* Character 101 (0x65): + width 5 + +-----+ + | | + | | + | | + | ** | + |* * | + |**** | + |* | + | ** | + | | + | | + +-----+ +*/ +0x0000, +0x0000, +0x0000, +0x6000, +0x9000, +0xf000, +0x8000, +0x6000, +0x0000, +0x0000, + +/* Character 102 (0x66): + width 5 + +-----+ + | | + | ** | + | * | + |**** | + | * | + | * | + | * | + | * | + | | + | | + +-----+ +*/ +0x0000, +0x3000, +0x4000, +0xf000, +0x4000, +0x4000, +0x4000, +0x4000, +0x0000, +0x0000, + +/* Character 103 (0x67): + width 5 + +-----+ + | | + | | + | | + | *** | + |* * | + |* * | + |* * | + | *** | + | * | + | ** | + +-----+ +*/ +0x0000, +0x0000, +0x0000, +0x7000, +0x9000, +0x9000, +0x9000, +0x7000, +0x1000, +0x6000, + +/* Character 104 (0x68): + width 5 + +-----+ + | | + |* | + |* | + |*** | + |* * | + |* * | + |* * | + |* * | + | | + | | + +-----+ +*/ +0x0000, +0x8000, +0x8000, +0xe000, +0x9000, +0x9000, +0x9000, +0x9000, +0x0000, +0x0000, + +/* Character 105 (0x69): + width 2 + +--+ + | | + |* | + | | + |* | + |* | + |* | + |* | + |* | + | | + | | + +--+ +*/ +0x0000, +0x8000, +0x0000, +0x8000, +0x8000, +0x8000, +0x8000, +0x8000, +0x0000, +0x0000, + +/* Character 106 (0x6a): + width 4 + +----+ + | | + | * | + | | + | * | + | * | + | * | + | * | + | * | + | * | + |** | + +----+ +*/ +0x0000, +0x2000, +0x0000, +0x2000, +0x2000, +0x2000, +0x2000, +0x2000, +0x2000, +0xc000, + +/* Character 107 (0x6b): + width 5 + +-----+ + | | + |* | + |* | + |* * | + |* * | + |** | + |* * | + |* * | + | | + | | + +-----+ +*/ +0x0000, +0x8000, +0x8000, +0x9000, +0xa000, +0xc000, +0xa000, +0x9000, +0x0000, +0x0000, + +/* Character 108 (0x6c): + width 2 + +--+ + | | + |* | + |* | + |* | + |* | + |* | + |* | + |* | + | | + | | + +--+ +*/ +0x0000, +0x8000, +0x8000, +0x8000, +0x8000, +0x8000, +0x8000, +0x8000, +0x0000, +0x0000, + +/* Character 109 (0x6d): + width 6 + +------+ + | | + | | + | | + |**** | + |* * * | + |* * * | + |* * * | + |* * * | + | | + | | + +------+ +*/ +0x0000, +0x0000, +0x0000, +0xf000, +0xa800, +0xa800, +0xa800, +0xa800, +0x0000, +0x0000, + +/* Character 110 (0x6e): + width 5 + +-----+ + | | + | | + | | + |*** | + |* * | + |* * | + |* * | + |* * | + | | + | | + +-----+ +*/ +0x0000, +0x0000, +0x0000, +0xe000, +0x9000, +0x9000, +0x9000, +0x9000, +0x0000, +0x0000, + +/* Character 111 (0x6f): + width 5 + +-----+ + | | + | | + | | + | ** | + |* * | + |* * | + |* * | + | ** | + | | + | | + +-----+ +*/ +0x0000, +0x0000, +0x0000, +0x6000, +0x9000, +0x9000, +0x9000, +0x6000, +0x0000, +0x0000, + +/* Character 112 (0x70): + width 5 + +-----+ + | | + | | + | | + |*** | + |* * | + |* * | + |* * | + |*** | + |* | + |* | + +-----+ +*/ +0x0000, +0x0000, +0x0000, +0xe000, +0x9000, +0x9000, +0x9000, +0xe000, +0x8000, +0x8000, + +/* Character 113 (0x71): + width 5 + +-----+ + | | + | | + | | + | *** | + |* * | + |* * | + |* * | + | *** | + | * | + | * | + +-----+ +*/ +0x0000, +0x0000, +0x0000, +0x7000, +0x9000, +0x9000, +0x9000, +0x7000, +0x1000, +0x1000, + +/* Character 114 (0x72): + width 5 + +-----+ + | | + | | + | | + |* ** | + |** | + |* | + |* | + |* | + | | + | | + +-----+ +*/ +0x0000, +0x0000, +0x0000, +0xb000, +0xc000, +0x8000, +0x8000, +0x8000, +0x0000, +0x0000, + +/* Character 115 (0x73): + width 5 + +-----+ + | | + | | + | | + | *** | + |* | + | ** | + | * | + |*** | + | | + | | + +-----+ +*/ +0x0000, +0x0000, +0x0000, +0x7000, +0x8000, +0x6000, +0x1000, +0xe000, +0x0000, +0x0000, + +/* Character 116 (0x74): + width 4 + +----+ + | | + | * | + | * | + |*** | + | * | + | * | + | * | + | * | + | | + | | + +----+ +*/ +0x0000, +0x4000, +0x4000, +0xe000, +0x4000, +0x4000, +0x4000, +0x2000, +0x0000, +0x0000, + +/* Character 117 (0x75): + width 5 + +-----+ + | | + | | + | | + |* * | + |* * | + |* * | + |* * | + | *** | + | | + | | + +-----+ +*/ +0x0000, +0x0000, +0x0000, +0x9000, +0x9000, +0x9000, +0x9000, +0x7000, +0x0000, +0x0000, + +/* Character 118 (0x76): + width 6 + +------+ + | | + | | + | | + |* * | + |* * | + | * * | + | * * | + | * | + | | + | | + +------+ +*/ +0x0000, +0x0000, +0x0000, +0x8800, +0x8800, +0x5000, +0x5000, +0x2000, +0x0000, +0x0000, + +/* Character 119 (0x77): + width 6 + +------+ + | | + | | + | | + |* * * | + |* * * | + |* * * | + | * * | + | * * | + | | + | | + +------+ +*/ +0x0000, +0x0000, +0x0000, +0xa800, +0xa800, +0xa800, +0x5000, +0x5000, +0x0000, +0x0000, + +/* Character 120 (0x78): + width 5 + +-----+ + | | + | | + | | + |* * | + |* * | + | ** | + |* * | + |* * | + | | + | | + +-----+ +*/ +0x0000, +0x0000, +0x0000, +0x9000, +0x9000, +0x6000, +0x9000, +0x9000, +0x0000, +0x0000, + +/* Character 121 (0x79): + width 5 + +-----+ + | | + | | + | | + |* * | + |* * | + |* * | + |* * | + | *** | + | * | + | ** | + +-----+ +*/ +0x0000, +0x0000, +0x0000, +0x9000, +0x9000, +0x9000, +0x9000, +0x7000, +0x1000, +0x6000, + +/* Character 122 (0x7a): + width 5 + +-----+ + | | + | | + | | + |**** | + | * | + | ** | + |* | + |**** | + | | + | | + +-----+ +*/ +0x0000, +0x0000, +0x0000, +0xf000, +0x1000, +0x6000, +0x8000, +0xf000, +0x0000, +0x0000, + +/* Character 123 (0x7b): + width 5 + +-----+ + | * | + | * | + | * | + | * | + | * | + | * | + | * | + | * | + | * | + | | + +-----+ +*/ +0x1000, +0x2000, +0x2000, +0x2000, +0x4000, +0x2000, +0x2000, +0x2000, +0x1000, +0x0000, + +/* Character 124 (0x7c): + width 4 + +----+ + | | + | * | + | * | + | * | + | * | + | * | + | * | + | * | + | * | + | | + +----+ +*/ +0x0000, +0x4000, +0x4000, +0x4000, +0x4000, +0x4000, +0x4000, +0x4000, +0x4000, +0x0000, + +/* Character 125 (0x7d): + width 5 + +-----+ + |* | + | * | + | * | + | * | + | * | + | * | + | * | + | * | + |* | + | | + +-----+ +*/ +0x8000, +0x4000, +0x4000, +0x4000, +0x2000, +0x4000, +0x4000, +0x4000, +0x8000, +0x0000, + +/* Character 126 (0x7e): + width 5 + +-----+ + | | + | * * | + |* * | + | | + | | + | | + | | + | | + | | + | | + +-----+ +*/ +0x0000, +0x5000, +0xa000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +0x0000, +}; + +/* Character width data. */ +static const unsigned char _sysfont_width[] = { + 3, /* (0x21) */ + 4, /* (0x22) */ + 6, /* (0x23) */ + 6, /* (0x24) */ + 9, /* (0x25) */ + 5, /* (0x26) */ + 2, /* (0x27) */ + 5, /* (0x28) */ + 5, /* (0x29) */ + 6, /* (0x2a) */ + 6, /* (0x2b) */ + 3, /* (0x2c) */ + 5, /* (0x2d) */ + 2, /* (0x2e) */ + 5, /* (0x2f) */ + 5, /* (0x30) */ + 3, /* (0x31) */ + 5, /* (0x32) */ + 5, /* (0x33) */ + 5, /* (0x34) */ + 5, /* (0x35) */ + 5, /* (0x36) */ + 5, /* (0x37) */ + 5, /* (0x38) */ + 5, /* (0x39) */ + 2, /* (0x3a) */ + 2, /* (0x3b) */ + 5, /* (0x3c) */ + 5, /* (0x3d) */ + 5, /* (0x3e) */ + 5, /* (0x3f) */ + 7, /* (0x40) */ + 5, /* (0x41) */ + 5, /* (0x42) */ + 5, /* (0x43) */ + 5, /* (0x44) */ + 5, /* (0x45) */ + 5, /* (0x46) */ + 5, /* (0x47) */ + 5, /* (0x48) */ + 2, /* (0x49) */ + 5, /* (0x4a) */ + 5, /* (0x4b) */ + 5, /* (0x4c) */ + 6, /* (0x4d) */ + 5, /* (0x4e) */ + 5, /* (0x4f) */ + 5, /* (0x50) */ + 5, /* (0x51) */ + 5, /* (0x52) */ + 5, /* (0x53) */ + 6, /* (0x54) */ + 5, /* (0x55) */ + 6, /* (0x56) */ + 6, /* (0x57) */ + 5, /* (0x58) */ + 6, /* (0x59) */ + 5, /* (0x5a) */ + 4, /* (0x5b) */ + 5, /* (0x5c) */ + 4, /* (0x5d) */ + 4, /* (0x5e) */ + 5, /* (0x5f) */ + 3, /* (0x60) */ + 5, /* (0x61) */ + 5, /* (0x62) */ + 4, /* (0x63) */ + 5, /* (0x64) */ + 5, /* (0x65) */ + 5, /* (0x66) */ + 5, /* (0x67) */ + 5, /* (0x68) */ + 2, /* (0x69) */ + 4, /* (0x6a) */ + 5, /* (0x6b) */ + 2, /* (0x6c) */ + 6, /* (0x6d) */ + 5, /* (0x6e) */ + 5, /* (0x6f) */ + 5, /* (0x70) */ + 5, /* (0x71) */ + 5, /* (0x72) */ + 5, /* (0x73) */ + 4, /* (0x74) */ + 5, /* (0x75) */ + 6, /* (0x76) */ + 6, /* (0x77) */ + 5, /* (0x78) */ + 5, /* (0x79) */ + 5, /* (0x7a) */ + 5, /* (0x7b) */ + 4, /* (0x7c) */ + 5, /* (0x7d) */ + 5, /* (0x7e) */ +}; + +/* Exported structure definition. */ +NewFont::NewFont() { + name = "04b-16b-10"; + maxwidth = 9; + height = 10; + ascent = 8; + firstchar = 33; + size = 94; + bits = _font_bits; + offset = 0; /* no encode table*/ + width = _sysfont_width; + defaultchar = 33; + bits_size = sizeof(_font_bits)/sizeof(bitmap_t); +} + +const NewFont g_sysfont; + +#if 0 +const Font g_sysfont = { + "04b-16b-10", + 9, + 10, + 8, + 33, + 94, + _font_bits, + 0, /* no encode table*/ + _sysfont_width, + 33, + sizeof(_font_bits)/sizeof(bitmap_t), +}; +#endif + +} // End of namespace Graphics diff --git a/graphics/scummfont.cpp b/graphics/scummfont.cpp new file mode 100644 index 0000000000..e6df7e68ba --- /dev/null +++ b/graphics/scummfont.cpp @@ -0,0 +1,112 @@ +/* ScummVM - Scumm Interpreter + * Copyright (C) 2002-2004 The ScummVM project + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Header$ + */ + +#include "stdafx.h" +#include "graphics/font.h" + +namespace Graphics { + +#ifdef __PALM_OS__ +static const byte *guifont; +#else +// Built-in font +static const byte guifont[] = { +0,0,99,1,226,8,4,8,6,8,6,0,0,0,0,0,0,0,0,0,0,0,8,2,1,8,0,0,0,0,0,0,0,0,0,0,0,0,4,3,7,8,7,7,8,4,5,5,8,7,4,7,3,8,7,7,7,7,8,7,7,7,7,7,3,4,7,5,7,7,8,7,7,7,7,7,7,7,7,5,7,7, +7,8,7,7,7,7,7,7,7,7,7,8,7,7,7,5,8,5,8,8,7,7,7,6,7,7,7,7,7,5,6,7,5,8,7,7,7,7,7,7,7,7,7,8,7,7,7,5,3,5,7,8,7,7,7,7,7,7,0,6,7,7,7,5,5,5,7,0,6,8,8,7,7,7,7,7,0,7,7,0,0, +0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,1,3,6,12, +24,62,3,0,128,192,96,48,24,124,192,0,0,3,62,24,12,6,3,1,0,192,124,24,48,96,192,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,237,74,72,0,0,0,0,0,128,128,128,0,0,0,0,0,0,0,0,0,0,0,0,0,60,66,153,161,161,153,66,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,96,96,96,96,0,0,96,0,102,102,102,0,0,0,0,0,102,102,255,102,255,102,102,0,24,62,96,60,6,124,24,0,98,102,12,24,48,102,70,0,60,102,60,56,103,102,63,0,96,48,16,0,0,0,0,0,24,48,96,96,96,48,24,0,96,48,24,24,24,48,96,0, +0,102,60,255,60,102,0,0,0,24,24,126,24,24,0,0,0,0,0,0,0,48,48,96,0,0,0,126,0,0,0,0,0,0,0,0,0,96,96,0,0,3,6,12,24,48,96,0,60,102,102,102,102,102,60,0,24,24,56,24,24,24,126,0,60,102,6,12,48,96,126,0,60,102,6,28,6,102,60,0,6, +14,30,102,127,6,6,0,126,96,124,6,6,102,60,0,60,102,96,124,102,102,60,0,126,102,12,24,24,24,24,0,60,102,102,60,102,102,60,0,60,102,102,62,6,102,60,0,0,0,96,0,0,96,0,0,0,0,48,0,0,48,48,96,14,24,48,96,48,24,14,0,0,0,120,0,120,0,0,0,112,24, +12,6,12,24,112,0,60,102,6,12,24,0,24,0,0,0,0,255,255,0,0,0,24,60,102,126,102,102,102,0,124,102,102,124,102,102,124,0,60,102,96,96,96,102,60,0,120,108,102,102,102,108,120,0,126,96,96,120,96,96,126,0,126,96,96,120,96,96,96,0,60,102,96,110,102,102,60,0,102,102,102, +126,102,102,102,0,120,48,48,48,48,48,120,0,30,12,12,12,12,108,56,0,102,108,120,112,120,108,102,0,96,96,96,96,96,96,126,0,99,119,127,107,99,99,99,0,102,118,126,126,110,102,102,0,60,102,102,102,102,102,60,0,124,102,102,124,96,96,96,0,60,102,102,102,102,60,14,0,124,102,102,124, +120,108,102,0,60,102,96,60,6,102,60,0,126,24,24,24,24,24,24,0,102,102,102,102,102,102,60,0,102,102,102,102,102,60,24,0,99,99,99,107,127,119,99,0,102,102,60,24,60,102,102,0,102,102,102,60,24,24,24,0,126,6,12,24,48,96,126,0,120,96,96,96,96,96,120,0,3,6,12,24,48, +96,192,0,120,24,24,24,24,24,120,0,0,0,0,0,0,219,219,0,0,0,0,0,0,0,0,255,102,102,102,0,0,0,0,0,0,0,60,6,62,102,62,0,0,96,96,124,102,102,124,0,0,0,60,96,96,96,60,0,0,6,6,62,102,102,62,0,0,0,60,102,126,96,60,0,0,14,24,62,24,24, +24,0,0,0,62,102,102,62,6,124,0,96,96,124,102,102,102,0,0,48,0,112,48,48,120,0,0,12,0,12,12,12,12,120,0,96,96,108,120,108,102,0,0,112,48,48,48,48,120,0,0,0,102,127,127,107,99,0,0,0,124,102,102,102,102,0,0,0,60,102,102,102,60,0,0,0,124,102,102,124,96, +96,0,0,62,102,102,62,6,6,0,0,124,102,96,96,96,0,0,0,62,96,60,6,124,0,0,24,126,24,24,24,14,0,0,0,102,102,102,102,62,0,0,0,102,102,102,60,24,0,0,0,99,107,127,62,54,0,0,0,102,60,24,60,102,0,0,0,102,102,102,62,12,120,0,0,126,12,24,48,126,0, +24,48,48,96,48,48,24,0,96,96,96,0,96,96,96,0,96,48,48,24,48,48,96,0,0,0,97,153,134,0,0,0,8,12,14,255,255,14,12,8,60,102,96,96,102,60,24,56,102,0,102,102,102,102,62,0,12,24,60,102,126,96,60,0,24,36,60,6,62,102,62,0,102,0,60,6,62,102,62,0,48, +24,60,6,62,102,62,0,0,0,0,0,0,0,0,0,0,60,96,96,96,60,24,56,24,36,60,102,126,96,60,0,102,0,60,102,126,96,60,0,48,24,60,102,126,96,60,0,0,216,0,112,48,48,120,0,48,72,0,112,48,48,120,0,96,48,0,112,48,48,120,0,102,24,60,102,126,102,102,0,0,0, +0,0,0,0,0,0,24,48,124,96,120,96,124,0,0,0,108,26,126,216,110,0,30,40,40,126,72,136,142,0,24,36,60,102,102,102,60,0,102,0,60,102,102,102,60,0,48,24,60,102,102,102,60,0,24,36,0,102,102,102,62,0,48,24,102,102,102,102,62,0,0,0,0,0,0,0,0,0,102,60,102, +102,102,102,60,0,102,0,102,102,102,102,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,24,60,6,62,102,62,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,28,54,54,124,102,102,124,64,0,0,0 +}; +#endif + +int ScummFont::getCharWidth(byte chr) const { + return guifont[chr+6]; +} + +//void ScummFont::drawChar(byte chr, int xx, int yy, OverlayColor color) { +void ScummFont::drawChar(const Surface *dst, byte chr, int x, int y, uint32 color) const { + assert(dst != 0); + byte *ptr = (byte *)dst->pixels + x * dst->bytesPerPixel + y * dst->pitch; + + const byte *tmp = guifont + 6 + guifont[4] + chr * 8; + uint buffer = 0; + uint mask = 0; + + for (y = 0; y < 8; y++) { + for (x = 0; x < 8; x++) { + unsigned char c; + mask >>= 1; + if (mask == 0) { + buffer = *tmp++; + mask = 0x80; + } + c = ((buffer & mask) != 0); + if (c) { + if (dst->bytesPerPixel == 1) + ptr[x] = color; + else if (dst->bytesPerPixel == 2) + ((uint16 *)ptr)[x] = color; + } + } + ptr += dst->pitch; + } +} + +const ScummFont g_scummfont; + +} // End of namespace Graphics + +#ifdef __PALM_OS__ +#include "scumm_globals.h" + +_GINIT(NewGui) +#ifndef NEW_FONT_CODE +_GSETPTR(Graphics::guifont, GBVARS_GUIFONT_INDEX, byte, GBVARS_SCUMM) +#endif +_GEND + +_GRELEASE(NewGui) +#ifndef NEW_FONT_CODE +_GRELEASEPTR(GBVARS_GUIFONT_INDEX, GBVARS_SCUMM) +#endif +_GEND + +#endif diff --git a/graphics/surface.h b/graphics/surface.h new file mode 100644 index 0000000000..a45df31748 --- /dev/null +++ b/graphics/surface.h @@ -0,0 +1,46 @@ +/* ScummVM - Scumm Interpreter + * Copyright (C) 2002-2004 The ScummVM project + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Header$ + */ + +#ifndef GRAPHICS_SURFACE_H +#define GRAPHICS_SURFACE_H + +#include "common/scummsys.h" + +namespace Graphics { + + +/** + * An arbitrary graphics surface, which can be the target (or source) of blit + * operations, font rendering, etc. + */ +struct Surface { + void *pixels; + uint16 w; + uint16 h; + uint16 pitch; + uint8 bytesPerPixel; + Surface() : pixels(0), w(0), h(0), pitch(0), bytesPerPixel(0) {} +}; + + +} // End of namespace Graphics + + +#endif -- cgit v1.2.3