LibFont: Move PSF code to separate file
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include <BAN/ByteSpan.h>
|
||||
#include <BAN/HashMap.h>
|
||||
#include <BAN/StringView.h>
|
||||
#include <BAN/Vector.h>
|
||||
|
||||
namespace LibFont
|
||||
{
|
||||
@@ -10,7 +11,17 @@ namespace LibFont
|
||||
class Font
|
||||
{
|
||||
public:
|
||||
Font() = default;
|
||||
Font(BAN::HashMap<uint32_t, uint32_t>&& glyph_offsets, BAN::Vector<uint8_t>&& glyph_data, uint32_t width, uint32_t height, uint32_t pitch)
|
||||
: m_glyph_offsets(BAN::move(glyph_offsets))
|
||||
, m_glyph_data(BAN::move(glyph_data))
|
||||
, m_width(width)
|
||||
, m_height(height)
|
||||
, m_pitch(pitch)
|
||||
{ }
|
||||
|
||||
static BAN::ErrorOr<Font> load(BAN::StringView path);
|
||||
static BAN::ErrorOr<Font> load(BAN::ConstByteSpan font_data);
|
||||
#if __is_kernel
|
||||
static BAN::ErrorOr<Font> prefs();
|
||||
#endif
|
||||
@@ -28,10 +39,6 @@ namespace LibFont
|
||||
return m_glyph_data.data() + it->value;
|
||||
}
|
||||
|
||||
private:
|
||||
static BAN::ErrorOr<Font> parse_psf1(BAN::ConstByteSpan);
|
||||
static BAN::ErrorOr<Font> parse_psf2(BAN::ConstByteSpan);
|
||||
|
||||
private:
|
||||
BAN::HashMap<uint32_t, uint32_t> m_glyph_offsets;
|
||||
BAN::Vector<uint8_t> m_glyph_data;
|
||||
|
||||
14
LibFont/include/LibFont/PSF.h
Normal file
14
LibFont/include/LibFont/PSF.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include <LibFont/Font.h>
|
||||
|
||||
namespace LibFont
|
||||
{
|
||||
|
||||
bool is_psf1(BAN::ConstByteSpan);
|
||||
BAN::ErrorOr<Font> parse_psf1(BAN::ConstByteSpan);
|
||||
|
||||
bool is_psf2(BAN::ConstByteSpan);
|
||||
BAN::ErrorOr<Font> parse_psf2(BAN::ConstByteSpan);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user