cpp-bmp-reader/psf.h

49 lines
No EOL
777 B
C++

#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);