Search code examples
javafontslibgdxfreetype

LibGDX FreeTypeFontGenerator huge font disappearing characters


I'm using FreeTypeFontGenerator to generate my fonts for my game. The font I'm using is OpenSans-Regular.ttf.

When using a font size of around 110 everything is fine, but when I use something higher like 160, some characters disappear. For example:

YOU WIN!

becomes

YOU W N!

Does anyone know how to fix this?


Solution

  • The problem is caused by characters not fitting on the texture page. Fixed by calling

    FreeTypeFontGenerator.setMaxTextureSize(FreeTypeFontGenerator.NO_MAXIMUM);