From 72d1db49ed69a5c8684429f994fd1d30aa62c2a4 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Fri, 11 Oct 2019 20:30:55 -0400 Subject: [PATCH] v0.7.5b: removed the baseline method from RenderedText, fixed one layout error with WndTitledMessage --- .../src/main/java/com/watabou/noosa/RenderedText.java | 6 +----- .../android/AndroidPlatformSupport.java | 2 +- .../shatteredpixeldungeon/ui/StyledButton.java | 2 +- .../shatteredpixeldungeon/windows/WndStartGame.java | 8 ++++---- .../shatteredpixeldungeon/windows/WndTitledMessage.java | 2 +- 5 files changed, 8 insertions(+), 12 deletions(-) diff --git a/SPD-classes/src/main/java/com/watabou/noosa/RenderedText.java b/SPD-classes/src/main/java/com/watabou/noosa/RenderedText.java index 50ca1ffa3..ac675d050 100644 --- a/SPD-classes/src/main/java/com/watabou/noosa/RenderedText.java +++ b/SPD-classes/src/main/java/com/watabou/noosa/RenderedText.java @@ -73,10 +73,6 @@ public class RenderedText extends Image { measure(); } - public float baseLine(){ - return size * scale.y; - } - private synchronized void measure(){ if (Thread.currentThread().getName().equals("SHPD Actor Thread")){ @@ -106,7 +102,7 @@ public class RenderedText extends Image { protected void updateMatrix() { super.updateMatrix(); //the y value is set at the top of the character, not at the top of accents. - Matrix.translate( matrix, 0, Math.round((baseLine()*Game.platform.getFontHeightOffset(font))/scale.y) ); + Matrix.translate( matrix, 0, Math.round(size*Game.platform.getFontHeightOffset(font))); } private static TextRenderBatch textRenderer = new TextRenderBatch(); diff --git a/android/src/main/java/com/shatteredpixel/shatteredpixeldungeon/android/AndroidPlatformSupport.java b/android/src/main/java/com/shatteredpixel/shatteredpixeldungeon/android/AndroidPlatformSupport.java index 88185bfa6..e81edcf5b 100644 --- a/android/src/main/java/com/shatteredpixel/shatteredpixeldungeon/android/AndroidPlatformSupport.java +++ b/android/src/main/java/com/shatteredpixel/shatteredpixeldungeon/android/AndroidPlatformSupport.java @@ -353,7 +353,7 @@ public class AndroidPlatformSupport extends PlatformSupport { public float getFontHeightOffset( BitmapFont font ){ //more weirdness with android 6 OTF fonts if (android6OTFPresent && !basicFonts.containsValue(font)){ - return -0.2f; + return -0.25f; } else { return 0.0f; } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/StyledButton.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/StyledButton.java index e45736ae0..726602a98 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/StyledButton.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/StyledButton.java @@ -141,7 +141,7 @@ public class StyledButton extends Button { reqHeight = Math.max(icon.height() + 4, reqHeight); } if (text != null && !text.text().equals("")){ - reqHeight = Math.max(text.baseLine() + 4, reqHeight); + reqHeight = Math.max(text.height() + 4, reqHeight); } return reqHeight; } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndStartGame.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndStartGame.java index 71f019689..df8f190ae 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndStartGame.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndStartGame.java @@ -61,7 +61,7 @@ public class WndStartGame extends Window { RenderedTextBlock title = PixelScene.renderTextBlock(Messages.get(this, "title"), 12 ); title.hardlight(Window.TITLE_COLOR); - title.setPos( (WIDTH - title.width())/2f, 2); + title.setPos( (WIDTH - title.width())/2f, 3); PixelScene.align(title); add(title); @@ -70,7 +70,7 @@ public class WndStartGame extends Window { float curX = heroBtnSpacing; for (HeroClass cl : HeroClass.values()){ HeroBtn button = new HeroBtn(cl); - button.setRect(curX, title.baseLine() + 4, HeroBtn.WIDTH, HeroBtn.HEIGHT); + button.setRect(curX, title.height() + 7, HeroBtn.WIDTH, HeroBtn.HEIGHT); curX += HeroBtn.WIDTH + heroBtnSpacing; add(button); } @@ -294,12 +294,12 @@ public class WndStartGame extends Window { super.layout(); avatar.x = x; - avatar.y = y + (height - avatar.height() - name.baseLine() - 2)/2f; + avatar.y = y + (height - avatar.height() - name.height() - 4)/2f; PixelScene.align(avatar); name.setPos( x + (avatar.width() - name.width())/2f, - avatar.y + avatar.height() + 2 + avatar.y + avatar.height() + 3 ); PixelScene.align(name); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndTitledMessage.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndTitledMessage.java index 2d57a6cb8..d38d850e5 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndTitledMessage.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndTitledMessage.java @@ -54,6 +54,6 @@ public class WndTitledMessage extends Window { text.setPos( titlebar.left(), titlebar.bottom() + GAP ); add( text ); - resize( width, (int)text.bottom() ); + resize( width, (int)text.bottom() + 2 ); } }