Kernel: prefs font does not allocate extra buffer

This commit is contained in:
Bananymous 2023-03-20 14:59:30 +02:00
parent f9ae1f0023
commit 75e85def83
1 changed files with 5 additions and 7 deletions

View File

@ -11,19 +11,17 @@
#define PSF2_HAS_UNICODE_TABLE 0x00000001 #define PSF2_HAS_UNICODE_TABLE 0x00000001
extern char _binary_font_prefs_psf_start; extern uint8_t _binary_font_prefs_psf_start[];
extern char _binary_font_prefs_psf_end; extern uint8_t _binary_font_prefs_psf_end[];
namespace Kernel namespace Kernel
{ {
BAN::ErrorOr<Font> Font::prefs() BAN::ErrorOr<Font> Font::prefs()
{ {
size_t font_data_size = &_binary_font_prefs_psf_end - &_binary_font_prefs_psf_start; size_t font_data_size = _binary_font_prefs_psf_end - _binary_font_prefs_psf_start;
BAN::Vector<uint8_t> font_data; BAN::Span<uint8_t> font_data(_binary_font_prefs_psf_start, font_data_size);
TRY(font_data.resize(font_data_size)); return parse_psf1(font_data);
memcpy(font_data.data(), &_binary_font_prefs_psf_start, font_data_size);
return parse_psf1(font_data.span());
} }
BAN::ErrorOr<Font> Font::load(BAN::StringView path) BAN::ErrorOr<Font> Font::load(BAN::StringView path)