How set Libgdx bitmap font size?

Kevin Bryan picture Kevin Bryan · Nov 10, 2015 · Viewed 25.7k times · Source

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

Netero picture Netero · Nov 10, 2015

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();