Skip to content

Commit

Permalink
Reinsert text shortcut for some cases (#4519)
Browse files Browse the repository at this point in the history
* test

* use simple text line not grapheme
  • Loading branch information
asturur committed Dec 2, 2017
1 parent 88a2c7c commit c96bb92
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/shapes/text.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -850,10 +850,17 @@
charsToRender = '',
charBox,
boxWidth = 0,
timeToRender;
timeToRender,
shortCut = !isJustify && this.isEmptyStyles(lineIndex);

ctx.save();
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);
ctx.restore();
return;
}
for (var i = 0, len = line.length - 1; i <= len; i++) {
timeToRender = i === len || this.charSpacing;
charsToRender += line[i];
Expand Down

0 comments on commit c96bb92

Please sign in to comment.