
[ad_1]
After doing some testing it seems the problem is caused by a large font size and a large viewport size. Luckily this is easily fixed by following these simple steps:
- Reduce
Font
size by half. - Reduce
Viewport
size by half. - Make sure the font
minFilter
isMipMapLinearNearest
and themagFilter
isLinear
. - If this doesn’t work go to step 1.
(In your case though I think the font size is just fine so I would suggest just reducing viewport size at first. If that doesn’t work follow the steps above.)
To be clear try reducing your font size to 32
and your viewport size to (500, 500 * aspectRatio)
, then if that doesn’t work try 16
and (250, 250 * aspectRatio)
.
This method does require you to use a separate viewport to render text with unless you want to change the viewport size of your actual game as well, so just create a new viewport of any type and make sure to apply it before rendering text:
gameViewport.apply();
batch.setProjectionMatrix(gameViewport.getCamera().combined);
batch.begin();
// Draw game stuff
textViewport.apply(true); // Center camera
batch.setProjectionMatrix(textViewport.getCamera().combined);
// Draw text
batch.end();
[ad_2]