Downloaded font: comic-sans-ms.ttf. added all necessary dependencies to the gradle. In the assets threw the font. Created method:

private void createFonts() { FileHandle fontFile = Gdx.files.internal("comic-sans-ms.ttf.ttf"); FreeTypeFontGenerator generator = new FreeTypeFontGenerator(fontFile); FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter(); parameter.size = 16; parameter.color.add(Color.BLACK); font = generator.generateFont(parameter); generator.dispose(); } //в конструкторе вызываю public GameScreen(final Drop gam) { createFonts(); } 

In render render variable that increases its value:

  font.getData(); font.getColor(); font.draw(game.batch, " " + game.dropsGatchered, 120, 470); 

after launch, the numbers are not displayed on the screen (game.dropsGatchered). If you do not use fonts, then with standard libgdx fonts everything is drawn. Used this instruction

  • The rubric of stupid answers: even libgdx hates Comic Sans - leon0399
  • @ leon0399 and about the connection and display on the screen in syntax no problem? - upward

1 answer 1

Try again to register the symbols used, it helped me

 private final String FONT_CHARACTERS = "абвгдеёжзийклмнопрстуфхцчшщъыьэюяАБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789][_!$%#@|\\/?-+=()*&.;,{}\"´`'<>"; 

and in the code

 parameter.characters = FONT_CHARACTERS;