summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2020-02-15 03:08:29 +0100
committerCharles Pigott <charlespigott@googlemail.com>2020-02-15 23:15:58 +0000
commit0c80ae5288a80a012f6c89de569ce8447832fbb3 (patch)
tree13db3e5cc94043e8cf759a745285fadfcc3dc171
parent7f693ce497d949b8f66e00a40f4477681ac71af1 (diff)
downloadopenttd-0c80ae5288a80a012f6c89de569ce8447832fbb3.tar.xz
Fix: Ignore not printable characters when layouting a string
-rw-r--r--src/gfx_layout.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/gfx_layout.cpp b/src/gfx_layout.cpp
index f093a5386..584a71273 100644
--- a/src/gfx_layout.cpp
+++ b/src/gfx_layout.cpp
@@ -631,6 +631,8 @@ static inline void GetLayouter(Layouter::LineCacheItem &line, const char *&str,
} else if (c >= SCC_FIRST_FONT && c <= SCC_LAST_FONT) {
state.SetFontSize((FontSize)(c - SCC_FIRST_FONT));
} else {
+ /* Filter out non printable characters */
+ if (!IsPrintable(c)) continue;
/* Filter out text direction characters that shouldn't be drawn, and
* will not be handled in the fallback non ICU case because they are
* mostly needed for RTL languages which need more ICU support. */