diff --git a/src/shapes/itext.class.js b/src/shapes/itext.class.js index 13c1c844..bcf27cc4 100644 --- a/src/shapes/itext.class.js +++ b/src/shapes/itext.class.js @@ -718,11 +718,11 @@ additionalSpace = this._getWidthOfCharSpacing(); chars = _char.split(''); charWidth = 0; - for (var j = 0, len = chars.length, char; j < len; j++) { - char = chars[j]; - shouldFill && ctx.fillText(char, left + charWidth, top); - shouldStroke && ctx.strokeText(char, left + charWidth, top); - _charWidth = ctx.measureText(char).width + additionalSpace; + for (var j = 0, len = chars.length, jChar; j < len; j++) { + jChar = chars[j]; + shouldFill && ctx.fillText(jChar, left + charWidth, top); + shouldStroke && ctx.strokeText(jChar, left + charWidth, top); + _charWidth = ctx.measureText(jChar).width + additionalSpace; charWidth += _charWidth > 0 ? _charWidth : 0; } } diff --git a/src/shapes/text.class.js b/src/shapes/text.class.js index dd4dd16e..f3770fad 100644 --- a/src/shapes/text.class.js +++ b/src/shapes/text.class.js @@ -477,7 +477,7 @@ */ _renderChars: function(method, ctx, chars, left, top) { // remove Text word from method var - var shortM = method.slice(0, -4), char, width; + var shortM = method.slice(0, -4), _char, width; if (this[shortM].toLive) { var offsetX = -this.width / 2 + this[shortM].offsetX || 0, offsetY = -this.height / 2 + this[shortM].offsetY || 0; @@ -491,8 +491,8 @@ chars = chars.split(''); for (var i = 0, len = chars.length; i < len; i++) { char = chars[i]; - width = ctx.measureText(char).width + additionalSpace; - ctx[method](char, left, top); + width = ctx.measureText(_char).width + additionalSpace; + ctx[method](_char, left, top); left += width > 0 ? width : 0; } }