LibGDX 中的不规则字体间距

Irregular font spacing in LibGDX

我正在 LibGDX 开发这款游戏,我有一个 BitmapFont 用来在屏幕上写乐谱。字体以奇怪的间距出现,并且在移动时会发生变化。我该如何解决?以下是文本显示方式的一些示例:

这里是字体代码:

generator = new FreeTypeFontGenerator(Gdx.files.internal("font/komika.ttf"));
parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
parameter.size = 100;
defaultFont = generator.generateFont(parameter);

这是标签的代码:

topScoreLabel = new Label(String.valueOf("Best : " + topScore), skin);
topScoreLabel.setColor(Color.RED);
topScoreLabel.setBounds(GAME_WORLD_WIDTH - 30, GAME_WORLD_HEIGHT - 20 * aspectRatio, 25, 20 * aspectRatio);
topScoreLabel.setFontScale(0.05f);
topScoreLabel.setAlignment(Align.right);

我使用这么大的字体是因为它应该在大屏幕上很好地缩放,如果我有任何更小的屏幕则不会。我该如何解决这个问题?

使用font.setUseIntegerPositions(false)。它在默认情况下处于打开状态,因为文本通常与像素完美的 camera/viewport 一起使用,并且如果 sprite 与屏幕像素对齐,则看起来不那么模糊。