Scale a Bitmapfont in LibGDX

后端 未结 3 1101
我寻月下人不归
我寻月下人不归 2021-02-07 03:05

How can I scale a Bitmapfont object in LibGDX? It seems the method setScale is no longer available.

3条回答
  •  别那么骄傲
    2021-02-07 03:55

    As Fish mentioned, it is recommended to use freetype generator as following:

    FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/timesBold.ttf"));
    FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
    

    Then change the font size in parameter and initialize BitmapFont:

    fontParameter.size = 18;
    BitmapFont font = fontGenerator.generateFont(fontParameter);
    

    It is also needed to include libgdx-freetype.so in armeabi folder of your project.

提交回复
热议问题