# LibGdx: set TextButton font to a TrueTypeFont

I am making my first LibGdx game, and having an hard time understanding font scaling on TextButtons.

Here is a comparison between the rendering on my Kindle Fire 7 and an high resolution tablet:

I tried using the scale() method, but the result is a pixelated mess.

I've read about TrueType fonts, and I'd like to set the font size by calculating the screen density.

I've tried to create a TextButtonStyle containing a font with the following:

//Generate the font
FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/Merriweather-Regular.ttf"));
TextButtonStyle style = new TextButtonStyle();
FreeTypeFontParameter param = new FreeTypeFontParameter();

//Set the font size (12 as an example)
param.size = 12;
style.font = generator.generateFont(param);

//Set the new style to the button
button = new TextButton("START GAME", style);


The TextButton correctly gets the new font, BUT loses the actual button as only the text gets rendered; I guess that's because the new TextButtonStyle only contains information about the font and is otherwise empty.

I tried setting the new font to a Skin also, but only ended with further confusion; most resources I found online don't mention font rendering on TextButtons, or end up being confusing with convulted methods.

Is there a simple way to achieve what I want? Thanks.

In my answer to this question on SO I describe how you can add a TTF font to your skin file which will allow you to use the font on your labels.
Basically when you create your skin file you have to add an ObjectMap with the fonts inside and supply it to your skin's parameters.