From b645654771738edbb9b0797dc986e748723a2727 Mon Sep 17 00:00:00 2001 From: Andrea Bogazzi Date: Mon, 17 Aug 2020 11:54:54 +0200 Subject: [PATCH] fix(fabric.Text): Ensure the shortcut text render the passed argument and not the entire line (#6526) --- src/shapes/text.class.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/shapes/text.class.js b/src/shapes/text.class.js index 233fd15538d..4f558e4332a 100644 --- a/src/shapes/text.class.js +++ b/src/shapes/text.class.js @@ -878,13 +878,12 @@ /** * @private - * @param {String} method + * @param {String} method fillText or strokeText. * @param {CanvasRenderingContext2D} ctx Context to render on - * @param {String} line Content of the line + * @param {Array} line Content of the line, splitted in an array by grapheme * @param {Number} left * @param {Number} top * @param {Number} lineIndex - * @param {Number} charOffset */ _renderChars: function(method, ctx, line, left, top, lineIndex) { // set proper line offset @@ -902,7 +901,7 @@ top -= lineHeight * this._fontSizeFraction / this.lineHeight; if (shortCut) { // render all the line in one pass without checking - this._renderChar(method, ctx, lineIndex, 0, this.textLines[lineIndex], left, top, lineHeight); + this._renderChar(method, ctx, lineIndex, 0, line.join(''), left, top, lineHeight); ctx.restore(); return; }