Начальная реализация поддержки шрифтов PSF

This commit is contained in:
Евгений Титаренко 2024-04-10 15:39:45 +03:00
parent 63b0d22340
commit 9af7778b77
5 changed files with 193 additions and 11 deletions

49
psf.h Normal file
View file

@ -0,0 +1,49 @@
#pragma once
#include <string>
#include <fstream>
#include <cstdint>
#include <map>
#pragma pack(push, 1)
struct PSF1Header {
char magicNumber[2];
uint8_t mode;
uint8_t glyphSize;
};
#pragma pack(pop)
#pragma pack(push, 1)
struct PSF2Header {
uint8_t magicNumber[4];
uint32_t version;
uint32_t headerSize;
uint32_t flags;
uint32_t numberOfGlyphs;
uint32_t bytesPerGlyph;
uint32_t glyphHeight;
uint32_t glyphWidth;
};
#pragma pack(pop)
class Glyph {
public:
uint8_t **glyph;
uint32_t width;
uint32_t height;
Glyph(uint32_t width, uint32_t height);
Glyph();
};
class Font {
public:
std::map<char16_t, Glyph> _glyphs;
Font();
Font(uint32_t glyphs);
};
Font readPSF(const std::string &filename);