|
|
@ -893,17 +893,6 @@ function getCellTextInfo(cell , ctx, option){ |
|
|
|
} |
|
|
|
else{ |
|
|
|
value = value.toString(); |
|
|
|
let splitValue = value.replace(/\r\n/g, "_x000D_").replace(/ /g, "_x000D_").replace(/\r/g, "_x000D_").replace(/\n/g, "_x000D_"); |
|
|
|
let splitArr = splitValue.split("_x000D_"); |
|
|
|
for(let x=0, len=splitArr.length;x<len;x++){ |
|
|
|
value = splitArr[x]; |
|
|
|
anchor = 0; |
|
|
|
preStr = undefined; |
|
|
|
preTextHeight = undefined; |
|
|
|
preTextWidth = undefined; |
|
|
|
preMeasureText = undefined; |
|
|
|
i=1; |
|
|
|
spaceOrTwoByte=null; |
|
|
|
while(i <= value.length){ |
|
|
|
let str = value.substring(anchor, i); |
|
|
|
let measureText = getMeasureText(str, ctx); |
|
|
@ -914,6 +903,10 @@ function getCellTextInfo(cell , ctx, option){ |
|
|
|
|
|
|
|
let height = textWidth * Math.sin(rt*Math.PI/180) + textHeight * Math.cos(rt*Math.PI/180);//consider text box wdith and line height
|
|
|
|
let lastWord = str.substr(str.length-1,1); |
|
|
|
let isSpace = false; |
|
|
|
if(checkWordByteLength(lastWord)===1 && lastWord !== ' ' && !/^.$/.test(lastWord) && !/^.$/u.test(lastWord)) { |
|
|
|
isSpace = lastWord.replace(/\r\n/g, "_x000D_").replace(/ /g, "_x000D_").replace(/\r/g, "_x000D_").replace(/\n/g, "_x000D_") === '_x000D_'; |
|
|
|
} |
|
|
|
if(lastWord==" " || checkWordByteLength(lastWord)==2){ |
|
|
|
if(preMeasureText!=null){ |
|
|
|
spaceOrTwoByte = { |
|
|
@ -1065,6 +1058,25 @@ function getCellTextInfo(cell , ctx, option){ |
|
|
|
splitIndex +=1; |
|
|
|
} |
|
|
|
} |
|
|
|
else if(isSpace && text_all_split[splitIndex]!=null && i!= value.length) { |
|
|
|
|
|
|
|
spaceOrTwoByte = null; |
|
|
|
anchor = i; |
|
|
|
|
|
|
|
text_all_split[splitIndex].push({ |
|
|
|
content:str, |
|
|
|
style:fontset, |
|
|
|
width:preTextWidth, |
|
|
|
height:preTextHeight, |
|
|
|
left:0, |
|
|
|
top:0, |
|
|
|
splitIndex:splitIndex, |
|
|
|
asc:measureText.actualBoundingBoxAscent, |
|
|
|
desc:measureText.actualBoundingBoxDescent, |
|
|
|
fs:fontSize, |
|
|
|
}); |
|
|
|
splitIndex +=1; |
|
|
|
} |
|
|
|
else if(i== value.length){ |
|
|
|
if(text_all_split[splitIndex]==null){ |
|
|
|
text_all_split[splitIndex]= []; |
|
|
@ -1098,8 +1110,6 @@ function getCellTextInfo(cell , ctx, option){ |
|
|
|
preMeasureText = measureText; |
|
|
|
|
|
|
|
} |
|
|
|
splitIndex +=1; |
|
|
|
} |
|
|
|
|
|
|
|
// console.log(text_all_split)
|
|
|
|
} |
|
|
|