[]Laya引擎bug

laya分析文本换行源码内有bug

laya.core.js内。
/**
    *@private
    *分析文本换行。
    */
    __proto.parseLines=function(text){
        var needWordWrapOrTruncate=this.wordWrap || this.overflow==Text.HIDDEN;
        if (needWordWrapOrTruncate){
            var wordWrapWidth=this.getWordWrapWidth();
        }
        if (this._currBitmapFont){
            this._charSize.width=this._currBitmapFont.getMaxWidth();
            this._charSize.height=this._currBitmapFont.getMaxHeight();
            }else {
            var measureResult=Browser.context.measureText(Text._testWord);
            this._charSize.width=measureResult.width;
            this._charSize.height=(measureResult.height || this.fontSize);
        };
        var lines=text.replace(/\r\n/g,"\n").split("\n");
        for (var i=0,n=lines.length;i < n;i++){
            var line=lines;
            if (needWordWrapOrTruncate)
                this.parseLine(line,wordWrapWidth);
            else {
                this._lineWidths.push(this.getTextWidth(line));
                this._lines.push(line);
            }
        }
    }

 

)ZGU}6J5XQ9(ZHZ5QB{4L6K.png

 
会出现这个错误,错误位置是
var measureResult=Browser.context.measureText(Text._testWord);
            this._charSize.width=measureResult.width;
            this._charSize.height=(measureResult.height || this.fontSize);

measureResult的问题.
不知道如何复现。上线的版本,这里报错很多
 
已邀请:

Aar0n

赞同来自:

能描述一下这个疑似bug的 情况是什么效果?

Aar0n

赞同来自:

if (Render.isConchApp){
                measureResult=/*__JS__ */window.conchTextCanvas.measureText(this._testWord);
                }else {
                measureResult=Browser.context.measureText(Text._testWord);
            }
if (!measureResult) measureResult = {width:100 }; //加上这一行异常处理
            this._charSize.width=measureResult.width;
            this._charSize.height=(measureResult.height || this.fontSize);

要回复问题请先

商务合作
商务合作