I am using a font generated by Heiro tool.
game.scoreFont = new BitmapFont(Gdx.files.internal("fonts/score.fnt"), false);
I applied it for a label;
private void drawScore() {
Label.LabelStyle scoreStyle = new Label.LabelStyle();// style
scoreStyle.font = game.scoreFont;
scoreLabel2 = new Label(scoreController.getScoreString(), scoreStyle);// label
scoreLabel2.setPosition(scoreBox.getX()+scoreBox.getWidth()/2.7f,scoreBox.getY()+scoreBox.getHeight()/2);
scoreLabel2.setAlignment( Align.center);
}
While generating font,I gave a size of 32. But same font I want to use for a label somewhere else in the game ,with a little bit bigger size.
Is it possible to increase the size then?or Should I generate a new font of required size with Heiro tool again?
You can scale your BitmapFont
by
bitmapFont.getData().setScale(2);
and then use this font in LabelStyle
, however you can also scale in this way
labelStyle.font.getData().setScale(2);
It works on reference of BitmapFont
so it scaled everywhere, where you're using that BitmapFont
in your game.
So you can create two object of BitmapFont
with same file and scale one font and use where you want bigger font.
I'll recommend you to create two font with different size using your tools. Scaling is never a good solution.