[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

View file

@ -9,9 +9,9 @@ const uint32_t kMagic = 0x864AB572;
}
Psf::Psf(mmth::OwnedMemoryRegion&& psf_file)
: psf_file_(glcr::Move(psf_file)),
header_(reinterpret_cast<PsfHeader*>(psf_file_.vaddr())) {
Psf::Psf(glcr::StringView path)
: psf_file_(mmth::File::Open(path)),
header_(reinterpret_cast<PsfHeader*>(psf_file_.raw_ptr())) {
EnsureValid();
}