Skip to content

Commit f77d373

Browse files
committed
Update measureLine method to include letterSpacing
1 parent 3894e34 commit f77d373

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/gameobjects/Text.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ Phaser.Text.prototype.updateText = function ()
443443
// Simple layout (no tabs)
444444
var lineWidth = this.style.strokeThickness + this.padding.x;
445445

446-
if (this.colors.length > 0 || this.strokeColors.length > 0 || this.fontWeights.length > 0 || this.fontStyles.length > 0)
446+
if (this.colors.length > 0 || this.strokeColors.length > 0 || this.fontWeights.length > 0 || this.fontStyles.length > 0 || this.letterSpacing !== '0px')
447447
{
448448
lineWidth += this.measureLine(lines[i]);
449449
}
@@ -772,6 +772,11 @@ Phaser.Text.prototype.measureLine = function (line)
772772
this.updateShadow(this.style.shadowFill);
773773
}
774774

775+
if (this.letterSpacing)
776+
{
777+
this.context.letterSpacing = this.letterSpacing;
778+
}
779+
775780
lineLength += this.context.measureText(letter).width;
776781

777782
this._charCount++;

0 commit comments

Comments
 (0)