Browse Source

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.
shared-context
Olli Wang 8 years ago
parent
commit
ade7193423
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      src/nanovg.c

+ 2
- 2
src/nanovg.c View File

@@ -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;


Loading…
Cancel
Save