Libgdx: does not support ttf for prints and figures?



  • I've been downloading comic-sans-ms.ttf. Added all necessary https://github.com/libgdx/libgdx/wiki/Dependency-management-with-Gradle#freetypefont-gradle ♪ I threw a print in the assets. 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();

    }

    The ribbon is a 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 don't use the typewriters, the standard libgdx prints.
    Used it. https://github.com/libgdx/libgdx/wiki/Gdx-freetype



  • Try writing some more of the symbols used helped me.

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

    and code

    parameter.characters = FONT_CHARACTERS;
    



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2