diff --git a/core/src/com/riiablo/Fonts.java b/core/src/com/riiablo/Fonts.java index 99c25c03..d4eecf17 100644 --- a/core/src/com/riiablo/Fonts.java +++ b/core/src/com/riiablo/Fonts.java @@ -41,6 +41,11 @@ public class Fonts { ReallyTheLastSucker = load(assets, "ReallyTheLastSucker", BlendMode.ID); BitmapFont.BitmapFontData data; + data = font8.getData(); + data.lineHeight = data.xHeight = data.capHeight = 12; + data.ascent = 16; + data.down = -12; + data = font16.getData(); data.lineHeight = data.xHeight = data.capHeight = 14; data.ascent = 17; diff --git a/core/src/com/riiablo/panel/CharacterPanel.java b/core/src/com/riiablo/panel/CharacterPanel.java index 4150956e..ab54ace1 100644 --- a/core/src/com/riiablo/panel/CharacterPanel.java +++ b/core/src/com/riiablo/panel/CharacterPanel.java @@ -126,8 +126,8 @@ public class CharacterPanel extends WidgetGroup implements Disposable { //Label armorclass = createStatLabel(Stat.armorclass); Label armorclass = new StatLabel(Riiablo.charData.getStats(), Stat.armorclass); - armorclass.setPosition(275, getHeight() - 210); - armorclass.setSize(36, 16); + armorclass.setPosition(272, getHeight() - 210); + armorclass.setSize(40, 16); addActor(armorclass); Label vitLabel = new Label(4066, Riiablo.fonts.ReallyTheLastSucker); diff --git a/core/src/com/riiablo/widget/StatLabel.java b/core/src/com/riiablo/widget/StatLabel.java index 3ba2a115..4b04cbeb 100644 --- a/core/src/com/riiablo/widget/StatLabel.java +++ b/core/src/com/riiablo/widget/StatLabel.java @@ -1,6 +1,7 @@ package com.riiablo.widget; import com.badlogic.gdx.graphics.Color; +import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.utils.Align; import com.riiablo.Riiablo; import com.riiablo.item.Attributes; @@ -38,13 +39,22 @@ public class StatLabel extends Label { @Override public void setText(CharSequence newText) { + BitmapFont font = getFont(newText.length()); + if (font != getStyle().font) { + getStyle().font = font; + setStyle(getStyle()); // hacky, but only way to correct update style with changes + } + super.setText(newText); - if (newText.length() > 6) { - getStyle().font = Riiablo.fonts.ReallyTheLastSucker; - } else if (newText.length() > 3) { - getStyle().font = Riiablo.fonts.font8; + } + + private static BitmapFont getFont(int len) { + if (len > 6) { + return Riiablo.fonts.ReallyTheLastSucker; + } else if (len > 3) { + return Riiablo.fonts.font8; } else { - getStyle().font = Riiablo.fonts.font16; + return Riiablo.fonts.font16; } }