emoji支持
This commit is contained in:
parent
e6070da8b0
commit
cd532587e2
11
libs/ui.js
11
libs/ui.js
@ -1138,7 +1138,12 @@ ui.prototype._drawTextContent_next = function (tempCtx, content, config) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// get next character
|
// get next character
|
||||||
var ch = content.charAt(config.index++);
|
var ch = content.charAt(config.index);
|
||||||
|
var code = content.charCodeAt(config.index++);
|
||||||
|
while (code >= 0xD800 && code <= 0xDBFF) {
|
||||||
|
ch += content.charAt(config.index);
|
||||||
|
code = content.charCodeAt(config.index++);
|
||||||
|
}
|
||||||
return this._drawTextContent_drawChar(tempCtx, content, config, ch);
|
return this._drawTextContent_drawChar(tempCtx, content, config, ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1183,7 +1188,7 @@ ui.prototype._drawTextContent_drawChar = function (tempCtx, content, config, ch)
|
|||||||
config.forceChangeLine = true;
|
config.forceChangeLine = true;
|
||||||
} else {
|
} else {
|
||||||
this._drawTextContent_newLine(tempCtx, config);
|
this._drawTextContent_newLine(tempCtx, config);
|
||||||
config.index--;
|
config.index-=ch.length;
|
||||||
return this._drawTextContent_next(tempCtx, content, config);
|
return this._drawTextContent_next(tempCtx, content, config);
|
||||||
}
|
}
|
||||||
} else if (forbidEnd.indexOf(ch) >= 0 && config.index < content.length) {
|
} else if (forbidEnd.indexOf(ch) >= 0 && config.index < content.length) {
|
||||||
@ -1196,7 +1201,7 @@ ui.prototype._drawTextContent_drawChar = function (tempCtx, content, config, ch)
|
|||||||
if (config.offsetX + charwidth + nextchwidth > config.maxWidth) {
|
if (config.offsetX + charwidth + nextchwidth > config.maxWidth) {
|
||||||
// 下一项会换行,因此在此处换行
|
// 下一项会换行,因此在此处换行
|
||||||
this._drawTextContent_newLine(tempCtx, config);
|
this._drawTextContent_newLine(tempCtx, config);
|
||||||
config.index--;
|
config.index-=ch.length;
|
||||||
return this._drawTextContent_next(tempCtx, content, config);
|
return this._drawTextContent_next(tempCtx, content, config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user