相关疑难解决方法(0)

LibGDX FreeType字体模糊

我使用屏幕高度百分比动态生成我的字体并设置百分比(显然将来乘以密度).

一些笔记.我正在读OTF文件.使用最新版本的LibGDX(版本1.2.0)

我有以下问题:(在字体大断裂,看上去很模糊,但仅限于媒体.大和小的外观非常尖锐)

坏字体

我的预设字体大小:

//Font sizes, small, med, large as a percentage of the screen.
    public static float
            FONT_SIZE_LARGE = 0.175f,
            FONT_SIZE_MEDIUM = 0.06f,
            FONT_SIZE_SMALL = 0.04f;
Run Code Online (Sandbox Code Playgroud)

我的字体生成器设置

FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
        FreeTypeFontGenerator generator;
this.generator = new FreeTypeFontGenerator(Gdx.files.internal(filename));
Run Code Online (Sandbox Code Playgroud)

创建实际字体:

//Create a new font and add it to available font sizes.
public BitmapFont createFont(float size, float color)
{
    this.parameter.size = Math.round(size);
    BitmapFont bitmapFont = generator.generateFont(parameter);
    bitmapFont.setColor(color);
    listOfFonts.add(new FontStorage(bitmapFont, size));
    return bitmapFont;
}
Run Code Online (Sandbox Code Playgroud)

现在我在不同的设备上尝试了一些东西,但仍然有同样的问题.我想它可能是因为它不是2的力量?(字体需要是2的幂才能均匀吗?)

字体是在许多不同的屏幕分辨率上绘制的,因此制作一定大小的三种位图字体是不可能的. …

java android opengl-es freetype libgdx

6
推荐指数
1
解决办法
3938
查看次数

标签 统计

android ×1

freetype ×1

java ×1

libgdx ×1

opengl-es ×1