summaryrefslogtreecommitdiff
path: root/lib/glfont.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/glfont.cc')
-rw-r--r--lib/glfont.cc42
1 files changed, 33 insertions, 9 deletions
diff --git a/lib/glfont.cc b/lib/glfont.cc
index b00f470..02b9a45 100644
--- a/lib/glfont.cc
+++ b/lib/glfont.cc
@@ -2,10 +2,12 @@
#include "glbase.h"
#include "glfont.h"
#include "Input.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
Uint8 prescale2[4] = { 0, 85, 170, 255 }, prescale3[8] = { 0, 36, 72, 109, 145, 182, 218, 255 };
-#define DEBUG 1
#define STRBUFSIZ 512
/*
@@ -245,19 +247,16 @@ void mogltk::font::newline(void) {
cy += inter;
}
-int mogltk::font::printf(const String & m, ...) {
- static char buffer[STRBUFSIZ + 1];
- va_list ap;
+int mogltk::font::printf(const ugly_string & m, va_list ap) {
char * p;
+ static char buffer[STRBUFSIZ + 1];
int r;
-
- va_start(ap, m);
+
#ifdef HAVE_VSNPRINTF
- r = vsnprintf(buffer, STRBUFSIZ, m.to_charp(), ap);
+ r = vsnprintf(buffer, STRBUFSIZ, m.p, ap);
#else
- r = vsprintf(buffer, m.to_charp(), ap);
+ r = vsprintf(buffer, m.p, ap);
#endif
- va_end(ap);
for (p = buffer; *p; p++) {
if (*p == '\n') {
@@ -270,6 +269,31 @@ int mogltk::font::printf(const String & m, ...) {
return r;
}
+int mogltk::font::printf(const ugly_string & m, ...) {
+ va_list ap;
+ int r;
+
+ va_start(ap, m);
+ r = printf(m, ap);
+ va_end(ap);
+
+ return r;
+}
+
+int mogltk::font::printf(const char * p, ...) {
+ ugly_string m;
+ va_list ap;
+ int r;
+
+ m.p = p;
+
+ va_start(ap, m);
+ r = printf(m, ap);
+ va_end(ap);
+
+ return r;
+}
+
void mogltk::font::setcolor(Color c) {
textcolor = c;
}