How get a string width in Libgdx?

BitmapFont API < 1.5.6 To mesure the width of a String you use your Font and get the bounds of the String, you are going to draw. BitmapFont.getBounds(String str).width BitmapFont API You can get the height to for the right offset for drawing too. Just replace width with height. In addition for multiline texts use … Read more

How to draw smooth text in libgdx?

font.getRegion().getTexture().setFilter(TextureFilter.Linear, TextureFilter.Linear); This gets the texture used in a BitmapFont and changes its filtering to bilinear, allowing higher resulting image quality while both up- and downscaling it at the cost of slightly slower (the difference is usually not noticeable) GPU rendering.