Start on true type fonts
This commit is contained in:
parent
91c4d15313
commit
7f8b3e8786
|
@ -19,6 +19,7 @@ public class FontTexture extends BaseTexture {
|
|||
|
||||
@Override
|
||||
public void load(IAssetProvider provider) {
|
||||
//TODO use old texture system instead
|
||||
GL45.glTextureStorage2D(id, 1, GLTextureFormat.RGBA.glValue(), bounds, bounds);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
package speiger.src.coreengine.rendering.gui.font.providers;
|
||||
|
||||
import org.lwjgl.stb.STBTTFontinfo;
|
||||
import org.lwjgl.stb.STBTruetype;
|
||||
|
||||
import speiger.src.collections.ints.sets.IntSet;
|
||||
import speiger.src.coreengine.rendering.gui.font.glyth.GlythData;
|
||||
|
||||
public class STBTrueTypeProvider implements IFontProvider {
|
||||
long data;
|
||||
STBTTFontinfo info;
|
||||
IntSet skip;
|
||||
float oversample;
|
||||
float xOff;
|
||||
float yOff;
|
||||
float pointScale;
|
||||
float ascent;
|
||||
|
||||
public STBTrueTypeProvider(long data, STBTTFontinfo info, float size, float oversample, float xOff, float yOff, String skip) {
|
||||
this.data = data;
|
||||
this.info = info;
|
||||
skip.codePoints().forEach(this.skip::add);
|
||||
this.oversample = oversample;
|
||||
this.xOff = xOff;
|
||||
this.yOff = yOff;
|
||||
pointScale = STBTruetype.stbtt_ScaleForPixelHeight(info, size * oversample);
|
||||
int[] ascent = new int[1];
|
||||
STBTruetype.stbtt_GetFontVMetrics(info, ascent, new int[1], new int[1]);
|
||||
this.ascent = pointScale * ascent[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public GlythData glythData(int codepoint) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue