From 8914106beec8a4d9717be89c07bc9272bb6d484a Mon Sep 17 00:00:00 2001 From: "Justin C. Miller" Date: Mon, 2 Apr 2018 10:20:56 -0700 Subject: [PATCH] Add PSF font header definition --- src/modules/main/font.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/modules/main/font.h diff --git a/src/modules/main/font.h b/src/modules/main/font.h new file mode 100644 index 0000000..788c81b --- /dev/null +++ b/src/modules/main/font.h @@ -0,0 +1,32 @@ +#pragma once +#include + +/* PSF2 header format + * Taken from the Linux KBD documentation + * http://www.win.tue.nl/~aeb/linux/kbd/font-formats-1.html + */ + +#define PSF2_MAGIC0 0x72 +#define PSF2_MAGIC1 0xb5 +#define PSF2_MAGIC2 0x4a +#define PSF2_MAGIC3 0x86 + +/* bits used in flags */ +#define PSF2_HAS_UNICODE_TABLE 0x01 + +/* max version recognized so far */ +#define PSF2_MAXVERSION 0 + +/* UTF8 separators */ +#define PSF2_SEPARATOR 0xFF +#define PSF2_STARTSEQ 0xFE + +struct psf2_header { + uint8_t magic[4]; + uint32_t version; + uint32_t headersize; // offset of bitmaps in file + uint32_t flags; + uint32_t length; // number of glyphs + uint32_t charsize; // number of bytes for each character + uint32_t height, width; // max dimensions of glyphs +};