From 4596285ec2180fab9229937f63ae179537211472 Mon Sep 17 00:00:00 2001 From: Chanwoong Kim Date: Tue, 1 Mar 2016 20:23:48 +0900 Subject: [PATCH 1/2] Make 'draw_string_centered_raw' to support UTF8 strings. --- src/drawing/string.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/drawing/string.c b/src/drawing/string.c index 174521a75c..77f49c1455 100644 --- a/src/drawing/string.c +++ b/src/drawing/string.c @@ -584,18 +584,14 @@ void draw_string_centred_raw(rct_drawpixelinfo *dpi, int x, int y, int numLines, int width = gfx_get_string_width(text); gfx_draw_string(dpi, text, 254, x - (width / 2), y); - char c; - while ((c = *text++) != 0) { - if (c >= 32) continue; - if (c <= 4) { - text++; - continue; - } - if (c <= 16) continue; - text += 2; - if (c <= 22) continue; - text += 2; + const utf8 *ch = text; + const utf8 *nextCh = 0; + int codepoint = 0; + + while ((codepoint = utf8_get_next(ch, (const utf8**)&nextCh)) != 0) { + ch = nextCh; } + text = ch+1; y += font_get_line_height(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16)); } From 4ef8719933ed568d4cd1889cb802a2345eff3ac3 Mon Sep 17 00:00:00 2001 From: Chanwoong Kim Date: Tue, 1 Mar 2016 20:39:00 +0900 Subject: [PATCH 2/2] Add my name to contributors.md --- contributors.md | 1 + 1 file changed, 1 insertion(+) diff --git a/contributors.md b/contributors.md index 57033c669d..0f275fbd6f 100644 --- a/contributors.md +++ b/contributors.md @@ -58,6 +58,7 @@ Includes all git commit authors. Aliases are GitHub user names. * Hielke Morsink (Broxzier) * Lucas Riutzel (jackinloadup) * Youngjae Yu (YJSoft) +* Chanwoong Kim (kexplo) ## Toolchain * (Balletie) - OSX