Reputation: 207
With the previous version of FreeType there was a method setScale() Now I can change the scale with:
bitmapFont.getData().SetScale();
but I' ve this issue with te letter spacing:
https://i.sstatic.net/35PGQ.png
I can't play with the size parameter because I've a small viewPort and i can't change it.
Upvotes: 0
Views: 1237
Reputation: 20140
I'll recommend not to scale BitmapFont
. May be your bitmapfont rendering result is due to high scale down of your BitmapFont
that you generated by free-type Font generator.
You can use bitmapFont.getData().setScale(float x, float y);
but scaling should be reasonable extent, not two much high or low.
You can create BitmapFont
with FreeTypeFontGenerator
with your required size so that you don't need to scale up/down.
FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/timesBold.ttf"));
FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
Change font size in parameter and initialize BitmapFont:
fontParameter.size = 25; // by default this value is 16
BitmapFont font = fontGenerator.generateFont(fontParameter);
Want to use font.setScale();
instead of font.getData().setScale()
, reactoring are from Version 1.5.6 so you need to use older version from this version. I've a link of 1.5.5 version, download it. Zip having gdx-setup.jar
file, create project from that .jar
, import project into your IDE and run.
Upvotes: 1