我在使用libgdx开发安卓应用时遇到了字体问题。当我第一次打开应用时,字体可以正常显示。但是当我暂停应用,然后重新开始应用时,字体会显示错误。
这是我创建字体的方法。
FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/MainFont.ttf"));
LabelStyle ls = new LabelStyle();
ls.font = generator.generateFont(30);
ls.fontColor = new Color(1.0f, 1.0f, 1.0f, 1.0f);
mPlay = new Label("Play", ls);
mInstructions = new Label("How To Play", ls);
generator.dispose();
我的暂停/恢复方法中什么也没有,不确定是否应该在那里添加一些内容。
以下是前后的样子。