v0.7.5b: refactored renderedTextMultiline

It is now much more flexible, and is used in all places.
This commit is contained in:
Evan Debenham
2019-10-11 19:34:22 -04:00
parent b4ae0ee991
commit 03ebdde440
36 changed files with 431 additions and 348 deletions

View File

@@ -98,17 +98,15 @@ public class RenderedText extends Image {
width = l.width;
//TODO this is almost the same as old height, but old height was clearly a bit off
height = size*1.375f;
//height = l.height - fonts.get(fontGenerator).get(size).getDescent() + size/5f;
//this is identical to l.height in most cases, but we force this for consistency.
height = Math.round(size*0.75f);
}
@Override
protected void updateMatrix() {
super.updateMatrix();
//the y value is set at the top of the character, not at the top of accents.
//FIXME this doesn't work for .otf fonts on android 6.0
Matrix.translate( matrix, 0, Math.round((baseLine()*0.1f)/scale.y) );
Matrix.translate( matrix, 0, Math.round((baseLine()*Game.platform.getFontHeightOffset(font))/scale.y) );
}
private static TextRenderBatch textRenderer = new TextRenderBatch();

View File

@@ -45,5 +45,9 @@ public abstract class PlatformSupport {
public abstract void resetGenerators();
public abstract BitmapFont getFont(int size, String text);
public abstract String[] splitforTextBlock( String text, boolean multiline );
public abstract float getFontHeightOffset( BitmapFont font );
}