From 1a4f1c8177f7ee351cb0096e3456d055b97dc60a Mon Sep 17 00:00:00 2001 From: peter1138 Date: Thu, 16 Nov 2006 22:05:33 +0000 Subject: (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. --- main_gui.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'main_gui.c') 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); } } -- cgit v1.2.3-70-g09d2