Fix text renderer bounds issue

Prevent setting up game state when no player has priority
This commit is contained in:
drdev
2014-05-25 22:21:03 +00:00
parent a245c2dd31
commit e892ad6c9a
3 changed files with 9 additions and 2 deletions

View File

@@ -81,7 +81,7 @@ public class TextRenderer {
if (fullText.isEmpty()) { return; }
BitmapFont bitmapFont = font.getFont();
totalHeight = bitmapFont.getLineHeight();
totalHeight = bitmapFont.getCapHeight();
if (totalHeight > height) {
//immediately try one font size smaller if no room for anything
if (font.getSize() > FSkinFont.MIN_FONT_SIZE) {

View File

@@ -53,7 +53,9 @@ public class FTextArea extends FScrollPane {
}
public float getPreferredHeight(float width) {
return renderer.getWrappedBounds(text, font, width - 2 * insets.x).height + 2 * insets.y;
return renderer.getWrappedBounds(text, font, width - 2 * insets.x).height
+ font.getFont().getLineHeight() - font.getFont().getCapHeight() //need to account for difference in line and cap height
+ 2 * insets.y;
}
@Override

View File

@@ -145,6 +145,11 @@ public final class GuiDisplayUtil {
final Map<ZoneType, String> aiCardTexts, final String tChangePlayer, final String tChangePhase) {
final Game game = getGame();
Player pPriority = game.getPhaseHandler().getPriorityPlayer();
if (pPriority == null) {
SGuiDialog.message("No player has priority at the moment, so game state cannot be setup.");
return;
}
game.getAction().invoke(new Runnable() {
@Override
public void run() {