raeleus / skin-composer

Create skins for LibGDX scene2d.ui with a graphical interface.
MIT License
427 stars 34 forks source link

Documentation error? #142

Closed dkoding closed 6 months ago

dkoding commented 11 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?

raeleus commented 6 months ago

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.