Skip to content

Commit

Permalink
BitmapFontTextRenderer: fixed issue where letters could be cut off on…
Browse files Browse the repository at this point in the history
… the end of the line because measurement didn't account for removing xOffset from whitespace after the final letter (closes #1676)
  • Loading branch information
joshtynjala committed Mar 21, 2018
1 parent 8ab6696 commit 12609c3
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions source/feathers/controls/text/BitmapFontTextRenderer.as
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ package feathers.controls.text
currentX -= customLetterSpacing;
if(charData !== null)
{
currentX -= (charData.xAdvance - charData.width) * scale;
currentX -= (charData.xAdvance - charData.width - charData.xOffset) * scale;
}
if(currentX < 0)
{
Expand Down Expand Up @@ -976,7 +976,7 @@ package feathers.controls.text
//this is the spacing after the last character
//that isn't whitespace
var previousCharData:BitmapChar = font.getChar(previousCharID);
widthOfWhitespaceAfterWord = customLetterSpacing + (previousCharData.xAdvance - previousCharData.width) * scale;
widthOfWhitespaceAfterWord = customLetterSpacing + (previousCharData.xAdvance - previousCharData.width - previousCharData.xOffset) * scale;
}
widthOfWhitespaceAfterWord += xAdvance;
}
Expand Down Expand Up @@ -1013,7 +1013,7 @@ package feathers.controls.text
if(previousCharID === previousCharID) //!isNaN
{
previousCharData = font.getChar(previousCharID);
widthOfWhitespaceAfterWord = customLetterSpacing + (previousCharData.xAdvance - previousCharData.width) * scale;
widthOfWhitespaceAfterWord = customLetterSpacing + (previousCharData.xAdvance - previousCharData.width - previousCharData.xOffset) * scale;
}
if(!isAligned)
{
Expand Down Expand Up @@ -1070,7 +1070,7 @@ package feathers.controls.text
currentX = currentX - customLetterSpacing;
if(charData !== null)
{
currentX -= (charData.xAdvance - charData.width) * scale;
currentX -= (charData.xAdvance - charData.width - charData.xOffset) * scale;
}
if(currentX < 0)
{
Expand Down Expand Up @@ -1423,7 +1423,7 @@ package feathers.controls.text
currentX -= customLetterSpacing;
if(charData !== null)
{
currentX -= (charData.xAdvance - charData.width) * scale;
currentX -= (charData.xAdvance - charData.width - charData.xOffset) * scale;
}
if(currentX < 0)
{
Expand Down Expand Up @@ -1467,7 +1467,7 @@ package feathers.controls.text
//this is the spacing after the last character
//that isn't whitespace
var previousCharData:BitmapChar = font.getChar(previousCharID);
widthOfWhitespaceAfterWord = customLetterSpacing + (previousCharData.xAdvance - previousCharData.width) * scale;
widthOfWhitespaceAfterWord = customLetterSpacing + (previousCharData.xAdvance - previousCharData.width - previousCharData.xOffset) * scale;
}
widthOfWhitespaceAfterWord += xAdvance;
}
Expand All @@ -1489,7 +1489,7 @@ package feathers.controls.text
if(previousCharID === previousCharID) //!isNaN
{
previousCharData = font.getChar(previousCharID);
widthOfWhitespaceAfterWord = customLetterSpacing + (previousCharData.xAdvance - previousCharData.width) * scale;
widthOfWhitespaceAfterWord = customLetterSpacing + (previousCharData.xAdvance - previousCharData.width - previousCharData.xOffset) * scale;
}
}
//we're just reusing this variable to avoid creating a
Expand All @@ -1516,7 +1516,7 @@ package feathers.controls.text
currentX -= customLetterSpacing;
if(charData !== null)
{
currentX -= (charData.xAdvance - charData.width) * scale;
currentX -= (charData.xAdvance - charData.width - charData.xOffset) * scale;
}
if(currentX < 0)
{
Expand Down Expand Up @@ -1655,7 +1655,7 @@ package feathers.controls.text
currentX -= customLetterSpacing;
if(charData !== null)
{
currentX -= (charData.xAdvance - charData.width) * scale;
currentX -= (charData.xAdvance - charData.width - charData.xOffset) * scale;
}

//then work our way backwards until we fit into the width
Expand Down

0 comments on commit 12609c3

Please sign in to comment.