Создание изображения из текста и накладывание одного изображения на другое.

This commit is contained in:
Евгений Титаренко 2024-04-11 09:47:52 +03:00
parent 9af7778b77
commit 38655e9c1b
5 changed files with 69 additions and 27 deletions

View file

@ -24,7 +24,7 @@ Font readPSF(const std::string &filename) {
if (magicNumber[0] != 0x72 || magicNumber[1] != 0xb5 || magicNumber[2] != 0x4a || magicNumber[3] != 0x86)
throw std::runtime_error("Invalid font file");
ifs.read((char *) &psf2Header, sizeof(psf2Header));
auto font = Font(psf2Header.numberOfGlyphs);
auto font = Font(psf2Header.numberOfGlyphs, psf2Header.glyphWidth, psf2Header.glyphHeight);
Glyph glyphs[psf2Header.numberOfGlyphs];
for (int i = 0; i < psf2Header.numberOfGlyphs; ++i) {
auto glyph = Glyph(psf2Header.glyphWidth, psf2Header.glyphHeight);
@ -83,7 +83,10 @@ Glyph::Glyph() {
}
Font::Font(uint32_t glyphs) {
Font::Font(uint32_t glyphsCount, uint32_t glyphWidth, uint32_t glyphHeight) {
this->glyphsCount = glyphsCount;
this->glyphWidth = glyphWidth;
this->glyphHeight = glyphHeight;
}
Font::Font() {