Search code examples
javalibgdx

libgdx text gets blurry when changing scale using skin


I'm learning to work with libgdx and I'm having a problem using skins to draw text. By default the text is very small and when I try to change it using

skin.getFont("font").getData().setScale(5f);

it gets very blurry. I'm using the 'Flat Earth' from their git repository https://github.com/czyzby/gdx-skins. Is there a better way to change the scale of text?


Solution

  • BitmapFont rely on an image so when you scale them, they looks blurry.

    You could just crate a BitmapFont in biggest size as needed in your game so that no need to scale up, down.

    Pass that font to your skin and after that your text looks good. May be you need more Bitmapfont in different sizes.

    You can also create BitmapFont of different size using gdx-freetype extension