use prerendered font to fix font scaling

- using freetypefont generator scale CJK Fonts too big
This commit is contained in:
Anthony Calosa
2022-04-16 17:48:55 +08:00
parent 646af5a5b7
commit 9e94f56b8b
6 changed files with 21866 additions and 10598 deletions

View File

@@ -126,26 +126,14 @@ public class Controls {
FileHandle atlasFile = skinFile.sibling(skinFile.nameWithoutExtension() + ".atlas");
TextureAtlas atlas = new TextureAtlas(atlasFile);
//font
FreeTypeFontGenerator generateFonts=new FreeTypeFontGenerator(Config.instance().getFile(Paths.SKIN_FONT));
FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
parameter.borderWidth=0;
parameter.incremental = true;
parameter.mono=true;
parameter.size=11;
parameter.minFilter = Texture.TextureFilter.Nearest;
parameter.magFilter = Texture.TextureFilter.Nearest;
parameter.color= Color.WHITE;
defaultfont = generateFonts.generateFont(parameter);
parameter.size=22;
parameter.color= Color.WHITE;
bigfont = generateFonts.generateFont(parameter);
SelectedSkin.add("default",defaultfont);
SelectedSkin.add("big",bigfont);
defaultfont = new BitmapFont(Config.instance().getFile(Paths.SKIN).sibling("LanaPixel.fnt"));
bigfont = new BitmapFont(Config.instance().getFile(Paths.SKIN).sibling("LanaPixel.fnt"));
bigfont.getData().setScale(2, 2);
SelectedSkin.add("default", defaultfont);
SelectedSkin.add("big", bigfont);
SelectedSkin.addRegions(atlas);
SelectedSkin.load(skinFile);
}
return SelectedSkin;
}

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 KiB

View File

@@ -1,4 +1,18 @@
{
"com.badlogic.gdx.graphics.g2d.BitmapFont": {
"big": {
"file": "LanaPixel.fnt"
},
"black": {
"file": "LanaPixel.fnt"
},
"blackbig": {
"file": "LanaPixel.fnt"
},
"default": {
"file": "LanaPixel.fnt"
}
},
"com.badlogic.gdx.graphics.Color": {
"RGBA_0_0_0_255": {
"r": 0,