aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2004-03-13 13:03:25 +0000
committerMax Horn2004-03-13 13:03:25 +0000
commita0bde7a732a121915a63c835d3177a616b85eab0 (patch)
treeb6edc20ded5c555c3890b15655a88710256b70c4
parent7000cb00e4394f10f567b2669fc805af0ea6d55a (diff)
downloadscummvm-rg350-a0bde7a732a121915a63c835d3177a616b85eab0.tar.gz
scummvm-rg350-a0bde7a732a121915a63c835d3177a616b85eab0.tar.bz2
scummvm-rg350-a0bde7a732a121915a63c835d3177a616b85eab0.zip
Revamped the font code: now it's very easy to switch between the 'original' SCUMM font and any new font... or to have multiple different fonts (like, one for 320x240 and and one for 640x480); furthermore, font rendering can now be done w/o using NewGui
svn-id: r13243
-rw-r--r--gui/PopUpWidget.cpp2
-rw-r--r--gui/console.cpp10
-rw-r--r--gui/dialog.h1
-rw-r--r--gui/font.cpp2722
-rw-r--r--gui/font.h62
-rw-r--r--gui/module.mk11
-rw-r--r--gui/newfont.cpp2600
-rw-r--r--gui/newgui.cpp223
-rw-r--r--gui/newgui.h28
-rw-r--r--gui/scummfont.cpp112
-rw-r--r--gui/widget.cpp2
-rw-r--r--gui/widget.h11
12 files changed, 2974 insertions, 2810 deletions
diff --git a/gui/PopUpWidget.cpp b/gui/PopUpWidget.cpp
index 71d861d35c..98fbdfcfde 100644
--- a/gui/PopUpWidget.cpp
+++ b/gui/PopUpWidget.cpp
@@ -345,7 +345,7 @@ void PopUpWidget::drawWidget(bool hilite) {
// Draw the selected entry, if any
if (_selectedItem >= 0) {
- int align = (gui->getStringWidth(_entries[_selectedItem].name) > w-6) ? kTextAlignRight : kTextAlignLeft;
+ TextAlignment align = (gui->getStringWidth(_entries[_selectedItem].name) > w-6) ? kTextAlignRight : kTextAlignLeft;
gui->drawString(_entries[_selectedItem].name, x+2, _y+3, w-6, !isEnabled() ? gui->_color : gui->_textcolor, align);
}
}
diff --git a/gui/console.cpp b/gui/console.cpp
index bf08633bee..08780c17af 100644
--- a/gui/console.cpp
+++ b/gui/console.cpp
@@ -25,14 +25,8 @@
#include "base/engine.h"
#include "base/version.h"
-#ifdef NEW_FONT_CODE
#include "gui/font.h"
-#define kCharWidth g_sysfont.maxwidth
-#else
-enum {
- kCharWidth = 8
-};
-#endif
+#define kCharWidth g_guifont.getMaxCharWidth()
namespace GUI {
@@ -85,7 +79,7 @@ ConsoleDialog::ConsoleDialog(float widthPercent, float heightPercent)
}
void ConsoleDialog::reflowLayout() {
- // Calculate the real width/height (rounded to char/line multiples
+ // Calculate the real width/height (rounded to char/line multiples)
_w = (uint16)(_widthPercent * g_system->get_overlay_width());
// _w = (_widthPercent * g_system->get_overlay_width() - kScrollBarWidth - 2) / kCharWidth;
// _w = _w * kCharWidth + kScrollBarWidth + 2;
diff --git a/gui/dialog.h b/gui/dialog.h
index 80ae07ef78..e3d7f46cfa 100644
--- a/gui/dialog.h
+++ b/gui/dialog.h
@@ -74,6 +74,7 @@ protected:
virtual void handleKeyUp(uint16 ascii, int keycode, int modifiers);
virtual void handleMouseMoved(int x, int y, int button);
virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
+ virtual void handleScreenChanged() {}
Widget *findWidget(int x, int y); // Find the widget at pos x,y if any
diff --git a/gui/font.cpp b/gui/font.cpp
index 020e5c0445..a4031a4144 100644
--- a/gui/font.cpp
+++ b/gui/font.cpp
@@ -1,2581 +1,153 @@
-/* Generated by convbdf on Thu Nov 20 00:15:51 2003. */
-#include "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
-
-*/
+/* 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 "gui/font.h"
namespace GUI {
-/* 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) */
-};
+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;
+ }
+}
+
+
+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;
+ }
+}
-/* Exported structure definition. */
-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),
-};
} // End of namespace GUI
diff --git a/gui/font.h b/gui/font.h
index 72ed03983d..d5bfedbe2d 100644
--- a/gui/font.h
+++ b/gui/font.h
@@ -21,13 +21,62 @@
#ifndef FONT_H
#define FONT_H
+#include "common/str.h"
+
namespace GUI {
+// Text alignment modes for drawString()
+enum TextAlignment {
+ kTextAlignLeft,
+ kTextAlignCenter,
+ kTextAlignRight
+};
+
+/**
+ * An arbitrary graphics surface, which can be the target (or source) of blit
+ * operations, font rendering, etc.
+ * @todo This shouldn't be in font.h, but rather in e.g. graphics/surface.h
+ */
+struct Surface {
+ void *pixels;
+ uint16 w;
+ uint16 h;
+ uint16 pitch;
+ uint8 bytesPerPixel;
+};
+
+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 */
-struct Font {
+class NewFont : public Font {
+protected:
const char * name; /* font name*/
int maxwidth; /* max width in pixels*/
int height; /* height in pixels*/
@@ -39,9 +88,18 @@ struct Font {
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 Font g_sysfont;
+extern const NewFont g_sysfont;
} // End of namespace GUI
diff --git a/gui/module.mk b/gui/module.mk
index 018c0fd651..6a7b6b6805 100644
--- a/gui/module.mk
+++ b/gui/module.mk
@@ -7,7 +7,6 @@ MODULE_OBJS := \
gui/console.o \
gui/dialog.o \
gui/EditTextWidget.o \
- gui/font.o \
gui/launcher.o \
gui/ListWidget.o \
gui/message.o \
@@ -16,7 +15,15 @@ MODULE_OBJS := \
gui/PopUpWidget.o \
gui/ScrollBarWidget.o \
gui/TabWidget.o \
- gui/widget.o \
+ gui/widget.o
+
+# TODO: Move the fonts to a separate dir?
+MODULE_OBJS += \
+ gui/font.o \
+ gui/scummfont.o \
+ gui/newfont.o
+
+
MODULE_DIRS += \
gui
diff --git a/gui/newfont.cpp b/gui/newfont.cpp
new file mode 100644
index 0000000000..1654db6448
--- /dev/null
+++ b/gui/newfont.cpp
@@ -0,0 +1,2600 @@
+/* Generated by convbdf on Thu Nov 20 00:15:51 2003. */
+#include "common/stdafx.h"
+#include "gui/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 GUI {
+
+/* 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 GUI
diff --git a/gui/newgui.cpp b/gui/newgui.cpp
index 37ebdc9b4b..2f2c0e6e5d 100644
--- a/gui/newgui.cpp
+++ b/gui/newgui.cpp
@@ -20,12 +20,8 @@
#include "stdafx.h"
#include "common/util.h"
-#include "newgui.h"
-#include "dialog.h"
-
-#ifdef NEW_FONT_CODE
-#include "gui/font.h"
-#endif
+#include "gui/newgui.h"
+#include "gui/dialog.h"
namespace GUI {
@@ -49,49 +45,6 @@ enum {
kKeyRepeatSustainDelay = 100
};
-#ifdef NEW_FONT_CODE
-/*
- * TODO:
- * - replace kLineHeight by global variable or query method
- * - ....
- */
-#else
-#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
-
-#endif // NEW_FONT_CODE
-
// Constructor
NewGui::NewGui() : _screen(0), _needRedraw(false),
@@ -204,6 +157,7 @@ void NewGui::runLoop() {
return;
case OSystem::EVENT_SCREEN_CHANGED:
updateColors();
+ activeDialog->handleScreenChanged();
break;
}
}
@@ -402,57 +356,16 @@ void NewGui::addDirtyRect(int x, int y, int w, int h) {
}
void NewGui::drawChar(byte chr, int xx, int yy, OverlayColor color) {
- OverlayColor *ptr = getBasePtr(xx, yy);
- uint x, y;
-
-#ifdef NEW_FONT_CODE
- assert(g_sysfont.bits != 0 && g_sysfont.maxwidth <= 16);
-
- // If this character is not included in the font, use the default char.
- if (chr < g_sysfont.firstchar || chr >= g_sysfont.firstchar + g_sysfont.size) {
- if (chr == ' ')
- return;
- chr = g_sysfont.defaultchar;
- }
-
- const uint w = getCharWidth(chr);
- const uint h = g_sysfont.height;
- chr -= g_sysfont.firstchar;
- const bitmap_t *tmp = g_sysfont.bits + (g_sysfont.offset ? g_sysfont.offset[chr] : (chr * h));
-//printf("Char '%c', width %d\n", chr, w);
-
- for (y = 0; y < h; y++) {
- const bitmap_t buffer = *tmp++;
- bitmap_t mask = 0x8000;
- for (x = 0; x < w; x++) {
- if ((buffer & mask) != 0)
- ptr[x] = color;
- mask >>= 1;
- }
- ptr += _screenPitch;
- }
-#else
- const uint w = 8;
- const uint h = 8;
- const byte *tmp = guifont + 6 + guifont[4] + chr * 8;
- uint buffer = 0;
- uint mask = 0;
-
- for (y = 0; y < h; y++) {
- for (x = 0; x < w; x++) {
- unsigned char c;
- mask >>= 1;
- if (mask == 0) {
- buffer = *tmp++;
- mask = 0x80;
- }
- c = ((buffer & mask) != 0);
- if (c)
- ptr[x] = color;
- }
- ptr += _screenPitch;
- }
-#endif
+ const int sys_height = _system->get_overlay_height();
+ const int sys_width = _system->get_overlay_width();
+ Surface dst = {
+ _screen,
+ sys_width,
+ sys_height,
+ sizeof(OverlayColor) * _screenPitch,
+ sizeof(OverlayColor)
+ };
+ g_guifont.drawChar(&dst, chr, xx, yy, color);
}
int NewGui::getStringWidth(const String &str) {
@@ -464,89 +377,20 @@ int NewGui::getStringWidth(const String &str) {
}
int NewGui::getCharWidth(byte c) {
-#ifdef NEW_FONT_CODE
- // If no width table is specified, return the maximum width
- if (!g_sysfont.width)
- return g_sysfont.maxwidth;
- // If this character is not included in the font, use the default char.
- if (c < g_sysfont.firstchar || g_sysfont.firstchar + g_sysfont.size < c) {
- if (c == ' ')
- return g_sysfont.maxwidth / 2;
- c = g_sysfont.defaultchar;
- }
- return g_sysfont.width[c - g_sysfont.firstchar];
-#else
- return guifont[c+6];
-#endif
+ return g_guifont.getCharWidth(c);
}
-void NewGui::drawString(const String &s, int x, int y, int w, OverlayColor color, int align, int deltax, bool useEllipsis) {
- const int leftX = x, rightX = x + w;
- uint i;
- int width = getStringWidth(s);
- 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(str[i], x, y, color);
- x += w;
- }
+void NewGui::drawString(const String &s, int x, int y, int w, OverlayColor color, TextAlignment align, int deltax, bool useEllipsis) {
+ const int sys_height = _system->get_overlay_height();
+ const int sys_width = _system->get_overlay_width();
+ Surface dst = {
+ _screen,
+ sys_width,
+ sys_height,
+ sizeof(OverlayColor) * _screenPitch,
+ sizeof(OverlayColor)
+ };
+ g_guifont.drawString(&dst, s, x, y, w, color, align, deltax, useEllipsis);
}
//
@@ -620,20 +464,3 @@ void NewGui::animateCursor() {
}
} // End of namespace GUI
-
-#ifdef __PALM_OS__
-#include "scumm_globals.h"
-
-_GINIT(NewGui)
-#ifndef NEW_FONT_CODE
-_GSETPTR(GUI::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/gui/newgui.h b/gui/newgui.h
index 1866845fa5..58e2bc2997 100644
--- a/gui/newgui.h
+++ b/gui/newgui.h
@@ -25,22 +25,12 @@
#include "common/singleton.h"
#include "common/str.h"
#include "common/system.h" // For events
+#include "gui/font.h"
// Uncomment the following to enable the new font code:
//#define NEW_FONT_CODE
-// Height of a single text line
-#ifdef NEW_FONT_CODE
-#include "gui/font.h"
-#define kLineHeight (g_sysfont.height + 2)
-#else
-enum {
- kLineHeight = 10
-};
-#endif
-
-
namespace GUI {
class Dialog;
@@ -51,12 +41,14 @@ class Dialog;
#define g_gui (GUI::NewGui::instance())
-// Text alignment modes for drawString()
-enum {
- kTextAlignLeft,
- kTextAlignCenter,
- kTextAlignRight
-};
+// Height of a single text line
+#ifdef NEW_FONT_CODE
+#define g_guifont g_sysfont
+#else
+#define g_guifont g_scummfont
+#endif
+#define kLineHeight (g_guifont.getFontHeight() + 2)
+
// Extremly simple stack class, doesn't even do any error checking (for now)
class DialogStack {
@@ -150,7 +142,7 @@ public:
void drawChar(byte c, int x, int y, OverlayColor color);
int getStringWidth(const String &str);
int getCharWidth(byte c);
- void drawString(const String &str, int x, int y, int w, OverlayColor color, int align = kTextAlignLeft, int deltax = 0, bool useEllipsis = true);
+ void drawString(const String &str, int x, int y, int w, OverlayColor color, TextAlignment align = kTextAlignLeft, int deltax = 0, bool useEllipsis = true);
void blitFromBuffer(int x, int y, int w, int h, const byte *buf, int pitch);
void blitToBuffer(int x, int y, int w, int h, byte *buf, int pitch);
diff --git a/gui/scummfont.cpp b/gui/scummfont.cpp
new file mode 100644
index 0000000000..263f7a50d3
--- /dev/null
+++ b/gui/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 "gui/font.h"
+
+namespace GUI {
+
+#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 GUI
+
+#ifdef __PALM_OS__
+#include "scumm_globals.h"
+
+_GINIT(NewGui)
+#ifndef NEW_FONT_CODE
+_GSETPTR(GUI::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/gui/widget.cpp b/gui/widget.cpp
index 3285ac14af..8fff12dff9 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -107,7 +107,7 @@ Widget *Widget::findWidgetInChain(Widget *w, int x, int y) {
#pragma mark -
-StaticTextWidget::StaticTextWidget(GuiObject *boss, int x, int y, int w, int h, const String &text, int align)
+StaticTextWidget::StaticTextWidget(GuiObject *boss, int x, int y, int w, int h, const String &text, TextAlignment align)
: Widget(boss, x, y, w, h), _align(align) {
_flags = WIDGET_ENABLED;
_type = kStaticTextWidget;
diff --git a/gui/widget.h b/gui/widget.h
index 46618367f6..a435e418b8 100644
--- a/gui/widget.h
+++ b/gui/widget.h
@@ -23,6 +23,7 @@
#include "common/scummsys.h"
#include "common/str.h"
+#include "gui/font.h"
#include "gui/object.h"
namespace GUI {
@@ -127,15 +128,15 @@ class StaticTextWidget : public Widget {
protected:
typedef Common::String String;
- String _label;
- int _align;
+ String _label;
+ TextAlignment _align;
public:
- StaticTextWidget(GuiObject *boss, int x, int y, int w, int h, const String &text, int align);
+ StaticTextWidget(GuiObject *boss, int x, int y, int w, int h, const String &text, TextAlignment align);
void setValue(int value);
void setLabel(const String &label) { _label = label; }
const String &getLabel() const { return _label; }
- void setAlign(int align) { _align = align; }
- int getAlign() const { return _align; }
+ void setAlign(TextAlignment align) { _align = align; }
+ TextAlignment getAlign() const { return _align; }
protected:
void drawWidget(bool hilite);