I'm trying to start using AssetManager in my game. Previously I used to generate two BitmapFonts (bigger and smaller) from my .ttf file and it worked well. Here's how it looked in the code:
FreeTypeFontGenerator generatorRoboto = new FreeTypeFontGenerator(Gdx.files.internal("fonts/Roboto-Regular.ttf"));
FreeTypeFontGenerator.FreeTypeFontParameter params = new FreeTypeFontGenerator.FreeTypeFontParameter();
params.size = 80;
BitmapFont robotoFont = generatorRoboto.generateFont(params);
robotoFont.getData().setScale(0.5f);
robotoFont.getRegion().getTexture().setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
params.size = 40;
BitmapFont smallerFont = generatorRoboto.generateFont(params);
smallerFont.getData().setScale(0.6f);
smallerFont.getRegion().getTexture().setFilter(Texture.TextureFilter.Linear,
Texture.TextureFilter.Linear);
Then I add it to skin and use it.
skin.add("roboto-regular-font", robotoFont, BitmapFont.class);
skin.add("roboto-smaller-font", smallerFont, BitmapFont.class);
It works well, but now I'm trying to use it with AssetManager (according to documentation):
FreeTypeFontLoaderParameter robotoFontLP = new FreeTypeFontLoaderParameter();
robotoFontLP.fontFileName = "fonts/Roboto-Regular.ttf";
robotoFontLP.fontParameters.size = 80;
manager.load("fonts/Roboto-Regular.ttf", BitmapFont.class, robotoFontLP);
manager.finishLoading();
BitmapFont robotoFontBig = manager.get("fonts/Roboto-Regular.ttf", BitmapFont.class);
robotoFontBig.getRegion().getTexture().setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
robotoFontBig.getData().setScale(0.5f);
BitmapFont robotoFontSmall = manager.get("fonts/Roboto-Regular.ttf", BitmapFont.class);
robotoFontSmall.getRegion().getTexture().setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
robotoFontSmall.getData().setScale(0.15f);
skin.add("roboto-regular-font", robotoFontBig, BitmapFont.class);
skin.add("roboto-smaller-font", robotoFontSmall, BitmapFont.class);
But it doesn't work, LibGDX treat them as the same font. What am I doing wrong?