Quantcast
Channel: Question and Answer » libgdx
Viewing all articles
Browse latest Browse all 434

How to render Fonts with correct size?

$
0
0

I’m making a game using libgdx and box2d so my Orthographic Camera Viewport is only 20×12 pixels/meters, when I try to render the a font on screen it becomes really big and pixelated, I also tried to use hiera bitmapfont generator to fix the size problem but is still so pixelated that makes it impossible to read. Then
I tried using FreetypeFont which allows to have better control of the font using FreetypeFont parameter and I’m also using two Orthographic camera now one for box2d and one for textures, how can I scale the libgdx camera? my box2d camera is 13×21 and It’s 1 pixel = 1 meter.

        generator = new FreeTypeFontGenerator(Gdx.files.internal("Fonts/font.ttf"));
        parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
        parameter.size = 16;
        parameter.color = Color.BLACK;
        font = generator.generateFont(parameter);

Viewing all articles
Browse latest Browse all 434

Trending Articles