【问题标题】:Why is my FreeTypeFont coming out blurry?为什么我的 FreeTypeFont 模糊不清?
【发布时间】:2020-07-12 14:51:03
【问题描述】:

我使用的字体在脚本中看起来漂亮而锐利,但是当我在游戏中使用它时,它却非常模糊且难以看清。如何让它变得锋利?

这是我的代码:


FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("Fonts/Blenda Script.otf"));
FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
parameter.size = 8;
BitmapFont font = generator.generateFont(parameter); 
generator.dispose();
Label.LabelStyle labelStyle = new Label.LabelStyle(font, Color.BLACK);

我正在使用包含不同大小的开放式脚本。我尝试在脚本中制作大小匹配的大小,这样它就不必拉伸,但它仍然模糊不清。我该如何解决这个问题?

【问题讨论】:

    标签: java android fonts libgdx freetype


    【解决方案1】:

    从您提供的示例中,您的参数大小为 8 像素,很小。尝试增加值,看看它是否看起来更好。我根据屏幕宽度计算我的字体大小,我的一种正常字体是screenWidth*0.06,即使分辨率为 480 小,字体大小也为 28。

    【讨论】:

    • 是的,当我增加尺寸时质量会提高,但我需要这种字体来表示弹药的数量,并且我希望它只占用很小的空间。我最终增加了尺寸,然后缩小了尺寸。
    【解决方案2】:

    原来尺寸太小了,所以我增加了尺寸,然后将字体缩小到我想要的大小。

    【讨论】:

      猜你喜欢
      • 2017-02-15
      • 2021-03-20
      • 2020-04-23
      • 1970-01-01
      • 2023-03-07
      • 1970-01-01
      • 2017-04-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多