0

So I am updating my old android game and I am having some problems with the font. I had to scale up my bitmap font and now it is blurry. Because of that I want to know where can I get a bitmap font with higher resolution and in which folder do I have to put it? Can someone help me with that?

yourBitmapFontName = new BitmapFont();

batch.begin();
yourBitmapFontName.getRegion().getTexture().setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
yourBitmapFontName.getData().setScale(7f);
yourBitmapFontName.setColor(com.badlogic.gdx.graphics.Color.WHITE);
yourBitmapFontName.draw(batch, Score, Gdx.graphics.getWidth()/2-6,130);
batch.end();
Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Tomaz Mazej
  • 465
  • 5
  • 19

3 Answers3

1

you find answers for your question on the BitmapFont page of the libgdx wiki.

In short here:

  • libGDX ships with Hiero, the tool to make BitmapFonts
  • You place the font in your assets folder

An alternative for Hiero is SkinComposer. Cleaner interface and there's a downloadable version, but I had problems with creating big fonts with a lot of glyphs.

MrStahlfelge
  • 1,721
  • 2
  • 13
  • 23
1

Make a dir "fonts" inside assets of android project and store your font(s) there. Basically all the assets (atlases, music, sound samples...) must go to the android project assets dir.

And for font editor I warmly suggest ShoeBox:

https://www.youtube.com/watch?v=dxPf1M7YORU

Watch the video and you'll see why it's better than others, what you can achieve with it what is impossible with other font editors and how to use it of course.

MilanG
  • 6,994
  • 2
  • 35
  • 64
0

You put it in the Assets folder.

enter image description here

And Load it like this:

    FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("Lobster.ttf"));
    FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
    parameter.size = 50; // font size
     BitmapFont lobster= generator.generateFont(parameter);
    generator.dispose();
Hitesh Sahu
  • 41,955
  • 17
  • 205
  • 154