aboutsummaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorMax Horn2003-11-19 23:46:39 +0000
committerMax Horn2003-11-19 23:46:39 +0000
commitb8c0fbf06ef0624ed1e9f1a5af82b7a15165af22 (patch)
tree10b8a4c22d35aecdfef3c4b5b545adf234786ca0 /gui
parent083c3280775a0589763c109bf5241f617cc9df54 (diff)
downloadscummvm-rg350-b8c0fbf06ef0624ed1e9f1a5af82b7a15165af22.tar.gz
scummvm-rg350-b8c0fbf06ef0624ed1e9f1a5af82b7a15165af22.tar.bz2
scummvm-rg350-b8c0fbf06ef0624ed1e9f1a5af82b7a15165af22.zip
new font code (currently disabled by default), which allows using 'arbitrary' BDF fonts (via convbdf)
svn-id: r11350
Diffstat (limited to 'gui')
-rw-r--r--gui/EditTextWidget.cpp2
-rw-r--r--gui/ListWidget.cpp2
-rw-r--r--gui/TabWidget.cpp4
-rw-r--r--gui/console.cpp9
-rw-r--r--gui/console.h1
-rw-r--r--gui/font.cpp2581
-rw-r--r--gui/font.h48
-rw-r--r--gui/module.mk1
-rw-r--r--gui/newgui.cpp80
-rw-r--r--gui/newgui.h25
-rw-r--r--gui/widget.cpp2
11 files changed, 2731 insertions, 24 deletions
diff --git a/gui/EditTextWidget.cpp b/gui/EditTextWidget.cpp
index ce6a828b69..3a1fc488df 100644
--- a/gui/EditTextWidget.cpp
+++ b/gui/EditTextWidget.cpp
@@ -150,7 +150,7 @@ void EditTextWidget::drawWidget(bool hilite) {
// Draw the text
adjustOffset();
- g_gui.drawString(_label, _x + 2, _y + 3, _w - 6, g_gui._textcolor, kTextAlignLeft, -_labelOffset, false);
+ g_gui.drawString(_label, _x + 2, _y + 2, _w - 6, g_gui._textcolor, kTextAlignLeft, -_labelOffset, false);
}
int EditTextWidget::getCaretPos() const {
diff --git a/gui/ListWidget.cpp b/gui/ListWidget.cpp
index 734d24b488..9404a8f945 100644
--- a/gui/ListWidget.cpp
+++ b/gui/ListWidget.cpp
@@ -277,7 +277,7 @@ void ListWidget::drawWidget(bool hilite) {
else
gui->frameRect(_x + 1, _y + 1 + kLineHeight * i, _w - 1, kLineHeight, gui->_textcolorhi);
}
- gui->drawString(buffer, _x + 2, _y + 3 + kLineHeight * i, _w - 4,
+ gui->drawString(buffer, _x + 2, _y + 2 + kLineHeight * i, _w - 4,
(_selectedItem == pos && _hasFocus) ? gui->_bgcolor : gui->_textcolor);
}
}
diff --git a/gui/TabWidget.cpp b/gui/TabWidget.cpp
index 9d07b8d4f4..3f1cb29f44 100644
--- a/gui/TabWidget.cpp
+++ b/gui/TabWidget.cpp
@@ -27,7 +27,7 @@
namespace GUI {
enum {
- kTabHeight = 15,
+ kTabHeight = 16,
kTabLeftOffset = 4,
kTabSpacing = 2,
@@ -130,7 +130,7 @@ void TabWidget::drawWidget(bool hilite) {
NewGuiColor color = (i == _activeTab) ? gui->_color : gui->_shadowcolor;
int yOffset = (i == _activeTab) ? 0 : 2;
gui->box(x, _y + yOffset, _tabWidth, kTabHeight - yOffset, color, color);
- gui->drawString(_tabs[i].title, x + kTabPadding, _y + yOffset / 2 + 4, _tabWidth - 2 * kTabPadding, gui->_textcolor, kTextAlignCenter);
+ gui->drawString(_tabs[i].title, x + kTabPadding, _y + yOffset / 2 + (kTabHeight - kLineHeight - 1), _tabWidth - 2 * kTabPadding, gui->_textcolor, kTextAlignCenter);
x += _tabWidth + kTabSpacing;
}
diff --git a/gui/console.cpp b/gui/console.cpp
index 427f6e6dfc..078661930b 100644
--- a/gui/console.cpp
+++ b/gui/console.cpp
@@ -24,6 +24,15 @@
#include "base/engine.h"
+#ifdef NEW_FONT_CODE
+#include "gui/font.h"
+#define kCharWidth g_sysfont.maxwidth
+#else
+enum {
+ kCharWidth = 8
+};
+#endif
+
namespace GUI {
diff --git a/gui/console.h b/gui/console.h
index e51da5d923..caf1a2d7ae 100644
--- a/gui/console.h
+++ b/gui/console.h
@@ -31,7 +31,6 @@ namespace GUI {
enum {
kBufferSize = 32768,
kLineBufferSize = 256,
- kCharWidth = 8,
kHistorySize = 20
};
diff --git a/gui/font.cpp b/gui/font.cpp
new file mode 100644
index 0000000000..020e5c0445
--- /dev/null
+++ b/gui/font.cpp
@@ -0,0 +1,2581 @@
+/* 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
+
+*/
+
+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. */
+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
new file mode 100644
index 0000000000..b5467e518b
--- /dev/null
+++ b/gui/font.h
@@ -0,0 +1,48 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2002-2003 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
+
+namespace GUI {
+
+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 {
+ 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*/
+};
+
+extern const Font g_sysfont;
+
+} // End of namespace GUI
+
+#endif
diff --git a/gui/module.mk b/gui/module.mk
index 097deb8e93..dc7e5a597a 100644
--- a/gui/module.mk
+++ b/gui/module.mk
@@ -7,6 +7,7 @@ MODULE_OBJS := \
gui/console.o \
gui/dialog.o \
gui/EditTextWidget.o \
+ gui/font.o \
gui/launcher.o \
gui/ListWidget.o \
gui/message.o \
diff --git a/gui/newgui.cpp b/gui/newgui.cpp
index 25f8193bc2..3f25bcb44d 100644
--- a/gui/newgui.cpp
+++ b/gui/newgui.cpp
@@ -27,6 +27,11 @@
# include "palm.h"
#endif
+#ifdef NEW_FONT_CODE
+#include "gui/font.h"
+#endif
+
+
namespace GUI {
/*
@@ -49,6 +54,13 @@ enum {
kKeyRepeatSustainDelay = 100
};
+#ifdef NEW_FONT_CODE
+/*
+ * TODO:
+ * - replace kLineHeight by global variable or query method
+ * - ....
+ */
+#else
#ifdef __PALM_OS__
static byte *guifont;
#else
@@ -83,6 +95,9 @@ static byte guifont[] = {
};
#endif
+#endif // NEW_FONT_CODE
+
+
// Constructor
NewGui::NewGui() : _screen(0), _needRedraw(false),
_stateIsSaved(false), _cursorAnimateCounter(0), _cursorAnimateTimer(0) {
@@ -113,9 +128,8 @@ void NewGui::runLoop() {
return;
// Setup some default GUI colors. Normally this will be done whenever an
- // EVENT_SCREEN_CHANGED is received. However, not all backends support
- // that even at this time, so we also do it "manually" whenever a run loop
- // is entered.
+ // EVENT_SCREEN_CHANGED is received. However, not yet all backends support
+ // that event, so we also do it "manually" whenever a run loop is entered.
updateColors();
if (!_stateIsSaved) {
@@ -402,18 +416,48 @@ void NewGui::addDirtyRect(int x, int y, int w, int h) {
_system->copy_rect_overlay(buf, _screenPitch, x, y, w, h);
}
-void NewGui::drawChar(const byte chr, int xx, int yy, NewGuiColor color) {
- unsigned int buffer = 0, mask = 0, x, y;
- byte *tmp;
+void NewGui::drawChar(byte chr, int xx, int yy, NewGuiColor color) {
+ NewGuiColor *ptr = getBasePtr(xx, yy);
+ uint x, y;
- tmp = guifont + 224 + (chr + 1) * 8;
+#ifdef NEW_FONT_CODE
+ assert(g_sysfont.bits != 0 && g_sysfont.maxwidth <= 16);
- NewGuiColor *ptr = getBasePtr(xx, yy);
+ // 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;
+ }
- for (y = 0; y < 8; y++) {
- for (x = 0; x < 8; x++) {
+ 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 + 224 + (chr + 1) * 8;
+ uint buffer = 0;
+ uint mask = 0;
+
+ for (y = 0; y < h; y++) {
+ for (x = 0; x < w; x++) {
unsigned char c;
- if ((mask >>= 1) == 0) {
+ mask >>= 1;
+ if (mask == 0) {
buffer = *tmp++;
mask = 0x80;
}
@@ -423,6 +467,7 @@ void NewGui::drawChar(const byte chr, int xx, int yy, NewGuiColor color) {
}
ptr += _screenPitch;
}
+#endif
}
int NewGui::getStringWidth(const String &str) {
@@ -434,7 +479,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
}
void NewGui::drawString(const String &s, int x, int y, int w, NewGuiColor color, int align, int deltax, bool useEllipsis) {
diff --git a/gui/newgui.h b/gui/newgui.h
index 86b241e2c0..a4a9229888 100644
--- a/gui/newgui.h
+++ b/gui/newgui.h
@@ -26,6 +26,21 @@
#include "common/str.h"
#include "common/system.h" // For events
+// 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;
@@ -36,12 +51,6 @@ class Dialog;
#define g_gui (NewGui::instance())
-// Height of a single text line
-enum {
- kLineHeight = 11
-};
-
-
// Text alignment modes for drawString()
enum {
kTextAlignLeft,
@@ -65,7 +74,9 @@ public:
Dialog *operator [](int i) { return _stack[i]; }
};
-// This class hopefully will replace the old Gui class completly one day
+/**
+ * GUI manager singleton.
+ */
class NewGui : public Common::Singleton<NewGui> {
typedef Common::String String;
friend class Dialog;
diff --git a/gui/widget.cpp b/gui/widget.cpp
index 7b688e1458..b873e32b79 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -141,7 +141,7 @@ void ButtonWidget::handleMouseUp(int x, int y, int button, int clickCount) {
void ButtonWidget::drawWidget(bool hilite) {
NewGui *gui = &g_gui;
- gui->drawString(_label, _x, _y, _w,
+ gui->drawString(_label, _x, _y + (_h - kLineHeight)/2 + 1, _w,
!isEnabled() ? gui->_color :
hilite ? gui->_textcolorhi : gui->_textcolor, _align);
}