I am using a BitmapFont to render text the problem is that I decided to use TrueTypeFontFactory.createBitmapFont method to create the BitmapFont so I can use my own font instead of the default one. The text is rendered with no problems except it is fliped in the y axis, before using the TrueTypeFontFactory.createBitmapFont method I would just create a BitmapFont and pass true in the constructor in order to flip it, but now that I am using the TrueTypeFontFactory I can't do it that way, and I don't seem to be able to do it after the BitmapFont is created because there are no methods to do so. So I was wondering how could I flip the font in this case?
You could try calling font.setScale(1, -1); after it is created, but I don't know of a better way.
You can use FreeTypeFontParameter of flip=true function (parameter.flip=true
) default is false
FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("font/font.ttf"));
FreeTypeFontParameter parameter = new FreeTypeFontParameter();
parameter.size = 12;
parameter.flip=true;
BitmapFont font = generator.generateFont(parameter); // font size 12 pixels
Src : https://github.com/libgdx/libgdx/wiki/Gdx-freetype
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With