Removed empty line spacing added when text is undefined. Fix #6807

This commit is contained in:
zekechan 2024-07-30 13:40:53 +08:00
parent a3470a08e5
commit cc0bac0214

View file

@ -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;
@ -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;
@ -317,6 +317,9 @@ var GetBitmapTextSize = function (src, round, updateOrigin, out)
currentLine++;
currentLineWidth = 0;
xAdvance = 0;
yAdvance = (lineHeight + lineSpacing) * currentLine;
continue;
}
@ -522,4 +525,4 @@ var GetBitmapTextSize = function (src, round, updateOrigin, out)
return out;
};
module.exports = GetBitmapTextSize;
module.exports = GetBitmapTextSize;