26 lines
567 B
C#
26 lines
567 B
C#
|
|
using Voile.VFS;
|
|
|
|
namespace Voile.Resources;
|
|
|
|
public class FontLoader : ResourceLoader<Font>
|
|
{
|
|
public override IEnumerable<string> SupportedExtensions => new string[]
|
|
{
|
|
".ttf"
|
|
};
|
|
|
|
|
|
protected override Font LoadResource(string path)
|
|
{
|
|
using Stream stream = VirtualFileSystem.Read(path);
|
|
|
|
byte[] fileBuffer = new byte[stream.Length];
|
|
int bytesRead = stream.Read(fileBuffer, 0, fileBuffer.Length);
|
|
var result = new Font(path, fileBuffer);
|
|
|
|
result.BufferSize = bytesRead;
|
|
|
|
return result;
|
|
}
|
|
} |