fixed line height in ttf fonts

This commit is contained in:
DaniTheSkunk 2022-12-13 04:01:18 +00:00
parent 6d6f4950ef
commit f3a535a433
1 changed files with 2 additions and 2 deletions

View File

@ -11,7 +11,7 @@ import java.util.HashMap;
import static org.lwjgl.stb.STBTruetype.*;
public class FontTTF implements IFont {
public class FontTTF extends BaseFont {
private final HashMap<Integer, Char> chars;
private final STBTTFontinfo info;
private final int lineHeight;
@ -33,8 +33,8 @@ public class FontTTF implements IFont {
}
//todo: save these
stbtt_GetFontVMetrics(info, ascent, descent, lineGap);
lineHeight = lineGap[0];
this.size = stbtt_ScaleForPixelHeight(info, size);
lineHeight = (int)((ascent[0] - descent[0] + lineGap[0]) * this.size);
//precache ascii characters
for(int i = 32; i < 128; ++i) {