summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpixel <pixel>2002-12-23 08:07:51 +0000
committerpixel <pixel>2002-12-23 08:07:51 +0000
commit0e58972c009fc4d8ad2a69a453eeb6529c619bc7 (patch)
tree67deb77f044dd7a744c751d6c5a9becd50699f38
parente6dc945aaa53b0739148b5ba4ebf7f8870e64370 (diff)
Bleeeeh
-rw-r--r--lib/glfont.cc26
-rw-r--r--src/font-2.binbin162407 -> 162407 bytes
-rw-r--r--src/test.cc4
3 files changed, 27 insertions, 3 deletions
diff --git a/lib/glfont.cc b/lib/glfont.cc
index 3d254d3..a321aaf 100644
--- a/lib/glfont.cc
+++ b/lib/glfont.cc
@@ -84,7 +84,7 @@ mogltk::font::font(Handle * ffont) : textcolor(255, 255, 255, 255) {
ffont->read(&maxY, 1);
ffont->read(&base, 1);
ffont->read(&inter, 1);
-
+
nbcU = 256 / maxX;
nbcV = 256 / maxY;
@@ -227,6 +227,19 @@ void mogltk::font::putchar(char ch, Color c) {
}
}
+int mogltk::font::getchar(char ch) {
+ Uint16 * p;
+ int i;
+
+ for (i = 0, p = corresp; i < nbentries; i++, p++) {
+ if (*(p++) == ch) {
+ return *p;
+ }
+ }
+
+ return -1;
+}
+
void mogltk::font::newline(void) {
cx = ox;
cy += inter;
@@ -260,3 +273,14 @@ void mogltk::font::setcolor(Color c) {
void mogltk::font::setshadow(int s) {
shadow = s;
}
+
+int mogltk::font::singletextsize(const String & s) {
+ int i;
+ int r = 0;
+
+ for (i = 0; i < s.strlen(); i++) {
+ r += sizes[getchar(s[i])];
+ }
+
+ return r;
+}
diff --git a/src/font-2.bin b/src/font-2.bin
index 4cac824..cad0d34 100644
--- a/src/font-2.bin
+++ b/src/font-2.bin
Binary files differ
diff --git a/src/test.cc b/src/test.cc
index 344a737..3b9f3b6 100644
--- a/src/test.cc
+++ b/src/test.cc
@@ -90,8 +90,8 @@ virtual int startup() throw (GeneralException) {
glVertex2f(150, 80);
glEnd();
font.setshadow(1);
- font.putcursor(10, 10);
- font.setcolor(Color(255, 0, 0));
+ font.putcursor(10, 30);
+ font.setcolor(WHITE);
font.printf("PixelPawa!\n");
font.printf("It works!!\n");
font.printf("I can't believe it!\n");