// ---------全局Font------------
static FreeTypeFontGenerator Generator;
static BitmapFont Font;
static FreeTypeBitmapFontData fontData; /**
* 创建获取或获取全局font
*/
public static BitmapFont getFont() {
if (Font == null) {
Generator = new FreeTypeFontGenerator(
Gdx.files.internal("font/font.ttf"));
String txt = Generator.DEFAULT_CHARS+"名称速度灵活度抗撞击价格面包车分次新手赠与";
txt = txt.replaceAll("(?s)(.)(?=.*\\1)", "");// 去掉重复字符
fontData = Generator.generateData(30, txt, false);
fontData.getTextureRegion().getTexture()
.setFilter(TextureFilter.Linear, TextureFilter.Linear);
Font = new BitmapFont(fontData, fontData.getTextureRegion(), false);
return Font;
} else {
return Font;
}
}
@某群里面的3D同学