summaryrefslogtreecommitdiff
path: root/main_gui.c
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-11-16 22:05:33 +0000
committerpeter1138 <peter1138@openttd.org>2006-11-16 22:05:33 +0000
commit1a4f1c8177f7ee351cb0096e3456d055b97dc60a (patch)
tree4fb6c0fac873efffc85cef437baa70d50d51fdfb /main_gui.c
parent40d647ddde652bb8f1c7b4215279cc82d01ca38f (diff)
downloadopenttd-1a4f1c8177f7ee351cb0096e3456d055b97dc60a.tar.xz
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
Diffstat (limited to 'main_gui.c')
-rw-r--r--main_gui.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/main_gui.c b/main_gui.c
index 0c759a39d..40ddcad60 100644
--- a/main_gui.c
+++ b/main_gui.c
@@ -29,6 +29,7 @@
#include "variables.h"
#include "train.h"
#include "unmovable_map.h"
+#include "string.h"
#include "screenshot.h"
#include "genworld.h"
#include "settings.h"
@@ -2085,15 +2086,16 @@ static bool DrawScrollingStatusText(const NewsItem *ni, int pos)
s = buf;
d = buffer;
- for (;; s++) {
- if (*s == '\0') {
+ for (;;) {
+ WChar c = Utf8Consume(&s);
+ if (c == 0) {
*d = '\0';
break;
} else if (*s == 0x0D) {
d[0] = d[1] = d[2] = d[3] = ' ';
d += 4;
- } else if ((byte)*s >= ' ' && ((byte)*s < 0x88 || (byte)*s >= 0x99)) {
- *d++ = *s;
+ } else if (IsPrintable(c)) {
+ d += Utf8Encode(d, c);
}
}