diff --git a/src/shapes/itext.class.js b/src/shapes/itext.class.js index 48afcc7b..ef1b92d8 100644 --- a/src/shapes/itext.class.js +++ b/src/shapes/itext.class.js @@ -292,7 +292,7 @@ var loc = this.get2DCursorLocation(index); if (!this._getLineStyle(loc.lineIndex)) { - this._setLineStyle(loc.lineIndex, {}) + this._setLineStyle(loc.lineIndex, {}); } if (!this._getStyleDeclaration(loc.lineIndex, loc.charIndex)) { diff --git a/src/shapes/textbox.class.js b/src/shapes/textbox.class.js index b402e2db..6aa647b3 100644 --- a/src/shapes/textbox.class.js +++ b/src/shapes/textbox.class.js @@ -208,9 +208,7 @@ charOffset = charOffset || 0; for (var i = 0; i < text.length; i++) { - decl = this._getStyleDeclaration(lineIndex, i + charOffset); - - if (decl) { + if (this.styles && this.styles[lineIndex] && (decl = this.styles[lineIndex][i + charOffset])) { ctx.save(); width += this._applyCharStylesGetWidth(ctx, text[i], lineIndex, i, decl); ctx.restore();