[Mammoth/Teton] Add an OpenFile interface and use it to load a font.

This commit is contained in:
Drew Galbraith 2023-11-22 16:42:42 -08:00
parent 4fd17a59ea
commit 86ce0a68a3
6 changed files with 84 additions and 21 deletions

25
lib/mammoth/file/file.h Normal file
View file

@ -0,0 +1,25 @@
#pragma once
#include <glacier/memory/move.h>
#include <glacier/string/string_view.h>
#include "mammoth/util/memory_region.h"
namespace mmth {
class File {
public:
static File Open(glcr::StringView path);
glcr::StringView as_str();
void* raw_ptr();
uint8_t* byte_ptr();
private:
OwnedMemoryRegion file_data_;
File(OwnedMemoryRegion&& file) : file_data_(glcr::Move(file)) {}
};
} // namespace mmth