First, I loaded the skin as a json file. In the file, I put two BitmapFont defintions ("font" and "big-font") and left them practically blank (I did load a dummy ".fnt" file to prevent the parser from complaining). I then generated two FreeType Fonts using the following code:
//start font generator
FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/button-font.ttf"));
FreeTypeFontGenerator.FreeTypeFontParameter parameters = new FreeTypeFontGenerator.FreeTypeFontParameter();
//default font (the sizes are arbitrary, since it did not work...)
parameters.size = 10;
BitmapFont defaultFont = generator.generateFont(parameters);
//big font
parameters.size = 100;
BitmapFont bigFont = generator.generateFont(parameters);
And set them as the skin fonts like so:
skin.add("font", defaultFont, BitmapFont.class);
skin.add("big-font", bigFont, BitmapFont.class);
The problem is that the gui (particularly the TextButton, which uses the "font" font) does not seem to care about what I did programmatically and keeps using the dummy font that I've set in the json file.
What am I doing wrong? Is there a better way to integrate ttf fonts and json skin parsing?
Thanks in advance for any help.