fixed line height in ttf fonts
This commit is contained in:
parent
6d6f4950ef
commit
f3a535a433
|
@ -11,7 +11,7 @@ import java.util.HashMap;
|
||||||
|
|
||||||
import static org.lwjgl.stb.STBTruetype.*;
|
import static org.lwjgl.stb.STBTruetype.*;
|
||||||
|
|
||||||
public class FontTTF implements IFont {
|
public class FontTTF extends BaseFont {
|
||||||
private final HashMap<Integer, Char> chars;
|
private final HashMap<Integer, Char> chars;
|
||||||
private final STBTTFontinfo info;
|
private final STBTTFontinfo info;
|
||||||
private final int lineHeight;
|
private final int lineHeight;
|
||||||
|
@ -33,8 +33,8 @@ public class FontTTF implements IFont {
|
||||||
}
|
}
|
||||||
//todo: save these
|
//todo: save these
|
||||||
stbtt_GetFontVMetrics(info, ascent, descent, lineGap);
|
stbtt_GetFontVMetrics(info, ascent, descent, lineGap);
|
||||||
lineHeight = lineGap[0];
|
|
||||||
this.size = stbtt_ScaleForPixelHeight(info, size);
|
this.size = stbtt_ScaleForPixelHeight(info, size);
|
||||||
|
lineHeight = (int)((ascent[0] - descent[0] + lineGap[0]) * this.size);
|
||||||
|
|
||||||
//precache ascii characters
|
//precache ascii characters
|
||||||
for(int i = 32; i < 128; ++i) {
|
for(int i = 32; i < 128; ++i) {
|
||||||
|
|
Loading…
Reference in New Issue