Comparing version 1.0.4 to 1.0.5
@@ -13,3 +13,3 @@ import huozi from '../index'; | ||
function drawText(text, options) { | ||
const textSequence = text.trim().replace('\n', '').split('').map(value => { | ||
const textSequence = text.replace(/\r\n/g, '\n').trim().split('').map(value => { | ||
return { | ||
@@ -16,0 +16,0 @@ fontSize: +options.charFontSize || 18, |
11
index.js
@@ -12,3 +12,4 @@ /*! | ||
* - 特别地,当用户将本程序与 AVG.js,或更具体的,avg-core 库同时使用时,无论用于商业或非商业,均可选择 Apache License 2.0。关于 AVG.js 的详情,请访问:https://github.com/avgjs/avg-core | ||
* | ||
* - 特别地,当用户将本程序与 pixi-richtext (https://github.com/avgjs/pixi-richtext) 库同时使用时,无论用于商业或非商业,均可选择 Apache License 2.0。 | ||
* | ||
* English Translation: | ||
@@ -21,2 +22,3 @@ * | ||
* - In particular, Apache License 2.0 is available for users who use this software with AVG.js, or more specifically, the avg-core library, whether for commercial or non-commercial use. For more details about AVG.js, see: https://github.com/avgjs/avg-core | ||
* - In particular, Apache License 2.0 is available for users who use the pixi-richtext (https://github.com/avgjs/pixi-richtext) library, whether for commercial or non-commercial use. | ||
*/ | ||
@@ -109,3 +111,3 @@ | ||
if (/[\n “”‘’]/.test(character)) { | ||
if (/[ “”‘’]/.test(character)) { | ||
if (lastIsWesternChar) { | ||
@@ -167,2 +169,7 @@ westernTextCache.push(char); | ||
if (character === '\n') { | ||
lineWrap(); | ||
continue; | ||
} | ||
// 测量文字宽度 | ||
@@ -169,0 +176,0 @@ context.font = `${charFontSize}px ${fontFamily}`; |
@@ -12,3 +12,4 @@ /** | ||
* - 特别地,当用户将本程序与 AVG.js,或更具体的,avg-core 库同时使用时,无论用于商业或非商业,均可选择 Apache License 2.0。关于 AVG.js 的详情,请访问:https://github.com/avgjs/avg-core | ||
* | ||
* - 特别地,当用户将本程序与 pixi-richtext (https://github.com/avgjs/pixi-richtext) 库同时使用时,无论用于商业或非商业,均可选择 Apache License 2.0。 | ||
* | ||
* English Translation: | ||
@@ -21,2 +22,3 @@ * | ||
* - In particular, Apache License 2.0 is available for users who use this software with AVG.js, or more specifically, the avg-core library, whether for commercial or non-commercial use. For more details about AVG.js, see: https://github.com/avgjs/avg-core | ||
* - In particular, Apache License 2.0 is available for users who use the pixi-richtext (https://github.com/avgjs/pixi-richtext) library, whether for commercial or non-commercial use. | ||
*/ | ||
@@ -23,0 +25,0 @@ |
@@ -12,3 +12,4 @@ /** | ||
* - 特别地,当用户将本程序与 AVG.js,或更具体的,avg-core 库同时使用时,无论用于商业或非商业,均可选择 Apache License 2.0。关于 AVG.js 的详情,请访问:https://github.com/avgjs/avg-core | ||
* | ||
* - 特别地,当用户将本程序与 pixi-richtext (https://github.com/avgjs/pixi-richtext) 库同时使用时,无论用于商业或非商业,均可选择 Apache License 2.0。 | ||
* | ||
* English Translation: | ||
@@ -21,2 +22,3 @@ * | ||
* - In particular, Apache License 2.0 is available for users who use this software with AVG.js, or more specifically, the avg-core library, whether for commercial or non-commercial use. For more details about AVG.js, see: https://github.com/avgjs/avg-core | ||
* - In particular, Apache License 2.0 is available for users who use the pixi-richtext (https://github.com/avgjs/pixi-richtext) library, whether for commercial or non-commercial use. | ||
*/ | ||
@@ -23,0 +25,0 @@ |
{ | ||
"name": "huozi", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "A simple typography engine for CJK languages, especially designed for game rich-text.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -50,3 +50,3 @@ <h1 align="center" style=" font-family: STSong, SimSun, serif; border: none; font-size: 48px; margin-bottom: 0;"> | ||
const textSequence = '需要排版的文字内容'.split('').map(value => { | ||
const textSequence = '需要排版的文字内容'.replace(/\r\n/g, '\n').split('').map(value => { | ||
return { | ||
@@ -135,1 +135,2 @@ fontSize: 26, | ||
- 特别地,当用户将本程序与 AVG.js,或更具体地,avg-core 库同时使用时,无论用于商业或非商业,均可选择 Apache License 2.0。关于 AVG.js 的详情,请访问:https://github.com/avgjs/avg-core | ||
- 特别地,当用户将本程序与 [pixi-richtext](https://github.com/avgjs/pixi-richtext) 库同时使用时,无论用于商业或非商业,均可选择 Apache License 2.0。 |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
192585
2
460
135