Storm Asdg Storm Asdg - 27 days ago 25
Java Question

How set Libgdx bitmap font size?

I'm rendering on screen the game fps using bitmap font but there are no methods for the size. This is a problem for me because my camera viewport size is very small so the text when rendered is huge and pixelated.

font.draw(batch, Float.toString(Gdx.graphics.getFramesPerSecond), x, y);

Answer

Did you try setScale() method that what i use to resize my font

myFont.getRegion().getTexture().setFilter(TextureFilter.Linear, TextureFilter.Linear);
myFont.setScale(scale);

if you have trouble, leave a comment

Good Luck !!

Edit :

With the latest libgdx version, try to scale font like this :

myFont.getData().setScale();
Comments