Java 如果使用GlyphLayout绘制位图字体,则LibGDX文本会失真

Java 如果使用GlyphLayout绘制位图字体,则LibGDX文本会失真,java,libgdx,bitmap-fonts,Java,Libgdx,Bitmap Fonts,我需要使用glyphlayout,以便将文本居中,但我发现如果这样做,文本会由于间距不正确而扭曲 public SimpleButton(String text, float x, float y, float w, float h, BitmapFont font) { pos = new Vector2(x, y); this.w = w; this.h = h; this.text = text; this.font = font; glyp

我需要使用
glyphlayout
,以便将文本居中,但我发现如果这样做,文本会由于间距不正确而扭曲

public SimpleButton(String text, float x, float y, float w, float h, BitmapFont font) {
    pos = new Vector2(x, y);
    this.w = w;
    this.h = h;
    this.text = text;
    this.font = font;
    glyphLayout.setText(font, text);
    hitbox = new Rectangle(x, y - h, w, h);
}

public void render(SpriteBatch batch) {
    font.draw(batch, text, pos.x, pos.y);
}
就像这样,它显示得很好:

但是使用
glyphlayout
绘制时,由于某些原因,间距有所不同:

public void render(SpriteBatch batch) {
    font.draw(batch, glyphLayout, pos.x, pos.y);
}

Glyphlayout似乎正在更改此处的间距,但我看不到任何用于设置间距的选项