Closed dkoding closed 6 months ago
I am looking at Replacing a Placeholder Font in libGDX
I follow the example to the letter, but it does not work.
This is my font section in my skin.json file:
com.badlogic.gdx.graphics.g2d.BitmapFont: { "font": { "file": "norse.ttf", "size": 20, "minFilter": "MipMapLinearLinear", "magFilter": "Linear", "renderCount": 3, "gamma": 1, "borderGamma": 1, "kerning": true, "genMipMaps": true } }
Here is my code:
` manager.load(baseDir + "norse.json", Skin.class); manager.finishLoading(); skin = manager.get(baseDir + "norse.json", Skin.class);
parameter.size = 10; // Original is 60 BitmapFont newFont = generator.generateFont(parameter); skin.add("font", newFont);
skin.addRegions(new TextureAtlas(baseDir + "skin.atlas")); skin.load(Gdx.files.internal(baseDir + "skin.json")); `
...but the font is not changed. What am I missing?
You should create a skin with the no parameter constructor: skin = new Skin();, then add your font, finally load norse.json and skin.json. The documentation is correct.
skin = new Skin();
I am looking at Replacing a Placeholder Font in libGDX
I follow the example to the letter, but it does not work.
This is my font section in my skin.json file:
com.badlogic.gdx.graphics.g2d.BitmapFont: { "font": { "file": "norse.ttf", "size": 20, "minFilter": "MipMapLinearLinear", "magFilter": "Linear", "renderCount": 3, "gamma": 1, "borderGamma": 1, "kerning": true, "genMipMaps": true } }
Here is my code:
` manager.load(baseDir + "norse.json", Skin.class); manager.finishLoading(); skin = manager.get(baseDir + "norse.json", Skin.class);
parameter.size = 10; // Original is 60 BitmapFont newFont = generator.generateFont(parameter); skin.add("font", newFont);
skin.addRegions(new TextureAtlas(baseDir + "skin.atlas")); skin.load(Gdx.files.internal(baseDir + "skin.json")); `
...but the font is not changed. What am I missing?