Load most of the font characters.

This commit is contained in:
2024-01-21 00:42:20 +01:00
parent fb5033f9a7
commit cfd90f7dc9

View File

@@ -237,7 +237,7 @@ namespace DaggerFramework.Rendering
string ext = ".ttf"; string ext = ".ttf";
byte[] extBytes = new byte[Encoding.Default.GetByteCount(ext) + 1]; byte[] extBytes = new byte[Encoding.Default.GetByteCount(ext) + 1];
Encoding.Default.GetBytes(ext, extBytes); Encoding.Default.GetBytes(ext, extBytes);
int fontChars = 0; int fontChars = 2048; // TODO: control this dynamically to not load the entire font.
unsafe unsafe
{ {
@@ -245,12 +245,13 @@ namespace DaggerFramework.Rendering
{ {
fixed (byte* bufferP = font.Buffer) fixed (byte* bufferP = font.Buffer)
{ {
fontRay = Raylib.LoadFontFromMemory((sbyte*)extP, bufferP, (int)font.BufferSize, font.Size, null, 95); fontRay = Raylib.LoadFontFromMemory((sbyte*)extP, bufferP, (int)font.BufferSize, font.Size, null, fontChars);
} }
} }
} }
Raylib.SetTextureFilter(fontRay.texture, TextureFilter.TEXTURE_FILTER_TRILINEAR); // Raylib.GenTextureMipmaps(ref fontRay.texture);
Raylib.SetTextureFilter(fontRay.texture, TextureFilter.TEXTURE_FILTER_BILINEAR);
_fontPool.Add(fontRay); _fontPool.Add(fontRay);