Fix crash issue in TextRenderer

This commit is contained in:
Lyu Zong-Hong
2021-03-06 21:15:33 +09:00
parent 398d4220dc
commit 84d2f43265

View File

@@ -437,6 +437,7 @@ public class TextRenderer {
} }
} }
} }
if (lastPieceIdx >= 0) {
Piece lastPiece = pieces.get(lastPieceIdx); Piece lastPiece = pieces.get(lastPieceIdx);
lineWidths.add(lastPiece.x + lastPiece.w); lineWidths.add(lastPiece.x + lastPiece.w);
x = 0; x = 0;
@@ -458,6 +459,14 @@ public class TextRenderer {
} }
needClip = true; needClip = true;
} }
} else {
if (font.canShrink()) {
//try next font size down if out of space
updatePieces(font.shrink());
return;
}
needClip = true;
}
} }
else { else {
if (font.canShrink()) { if (font.canShrink()) {