Skip to content

Commit

Permalink
Removed empty line spacing added when text is undefined. Fix #6807
Browse files Browse the repository at this point in the history
  • Loading branch information
zekeatchan committed Jul 30, 2024
1 parent a3470a0 commit cc0bac0
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/gameobjects/bitmaptext/GetBitmapTextSize.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,10 +263,12 @@ var GetBitmapTextSize = function (src, round, updateOrigin, out)

for (i = crs.length - 1; i >= 0; i--)
{
// eslint-disable-next-line quotes
text = stringInsert(text, crs[i], "\n");
if (crs[i] > -1)
{
text = stringInsert(text, crs[i], "\n");
}
}

out.wrappedText = text;

textLength = text.length;
Expand Down Expand Up @@ -298,8 +300,6 @@ var GetBitmapTextSize = function (src, round, updateOrigin, out)
current = null;
}

xAdvance = 0;
yAdvance = (lineHeight + lineSpacing) * (currentLine + 1);
lastGlyph = null;

lineWidths[currentLine] = currentLineWidth;
Expand All @@ -317,6 +317,9 @@ var GetBitmapTextSize = function (src, round, updateOrigin, out)
currentLine++;
currentLineWidth = 0;

xAdvance = 0;
yAdvance = (lineHeight + lineSpacing) * currentLine;

continue;
}

Expand Down Expand Up @@ -522,4 +525,4 @@ var GetBitmapTextSize = function (src, round, updateOrigin, out)
return out;
};

module.exports = GetBitmapTextSize;
module.exports = GetBitmapTextSize;

0 comments on commit cc0bac0

Please sign in to comment.