Выделил переиспользуемые модули из проекта.
This commit is contained in:
parent
3fe2a87e35
commit
7c83d9c93e
15 changed files with 287 additions and 207 deletions
52
psf.h
52
psf.h
|
@ -1,52 +0,0 @@
|
|||
#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;
|
||||
uint32_t glyphWidth;
|
||||
uint32_t glyphHeight;
|
||||
uint32_t glyphsCount;
|
||||
|
||||
Font();
|
||||
|
||||
explicit Font(uint32_t glyphs, uint32_t glyphWidth, uint32_t glyphHeight);
|
||||
};
|
||||
|
||||
Font readPSF(const std::string &filename);
|
Loading…
Add table
Add a link
Reference in a new issue