From 6ae83196cb50fafbf5657104babd124fac27b818 Mon Sep 17 00:00:00 2001 From: wbfsa Date: Wed, 21 Oct 2020 21:09:34 +0800 Subject: [PATCH] fix(the bug with first word is space): fix ti --- src/global/getRowlen.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/global/getRowlen.js b/src/global/getRowlen.js index 63e6fd7..816af9c 100644 --- a/src/global/getRowlen.js +++ b/src/global/getRowlen.js @@ -928,14 +928,16 @@ 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); if(lastWord==" " || checkWordByteLength(lastWord)==2){ - spaceOrTwoByte = { - index:i, - str:preStr, - width:preTextWidth, - height:preTextHeight, - asc:preMeasureText.actualBoundingBoxAscent, - desc:preMeasureText.actualBoundingBoxDescent, - }; + if(preMeasureText!=null){ + spaceOrTwoByte = { + index:i, + str:preStr, + width:preTextWidth, + height:preTextHeight, + asc:preMeasureText.actualBoundingBoxAscent, + desc:preMeasureText.actualBoundingBoxDescent, + }; + } } // textW_all += textW;