From ade71934239c01d3affc2e6a1ef623e403e94311 Mon Sep 17 00:00:00 2001 From: Olli Wang Date: Thu, 20 Oct 2016 17:05:54 +0800 Subject: [PATCH] Improves to display CJK characters with English words. This commit improves to display CJK characters mixed with English words so there is less spaces at line breaks. --- src/nanovg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nanovg.c b/src/nanovg.c index 2068cf0..e5dbc7b 100644 --- a/src/nanovg.c +++ b/src/nanovg.c @@ -2673,13 +2673,13 @@ int nvgTextBreakLines(NVGcontext* ctx, const char* string, const char* end, floa rowMaxX = q.x1 - rowStartX; } // track last end of a word - if ((ptype == NVG_CHAR && type == NVG_SPACE) || type == NVG_CJK_CHAR) { + if (((ptype == NVG_CHAR || ptype == NVG_CJK_CHAR) && type == NVG_SPACE) || type == NVG_CJK_CHAR) { breakEnd = iter.str; breakWidth = rowWidth; breakMaxX = rowMaxX; } // track last beginning of a word - if ((ptype == NVG_SPACE && type == NVG_CHAR) || type == NVG_CJK_CHAR) { + if ((ptype == NVG_SPACE && (type == NVG_CHAR || type == NVG_CJK_CHAR)) || type == NVG_CJK_CHAR) { wordStart = iter.str; wordStartX = iter.x; wordMinX = q.x0 - rowStartX;