mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 00:14:32 -08:00
Add inital console font rendering
This commit is contained in:
@@ -1,32 +1,22 @@
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
|
||||
/* PSF2 header format
|
||||
* Taken from the Linux KBD documentation
|
||||
* http://www.win.tue.nl/~aeb/linux/kbd/font-formats-1.html
|
||||
*/
|
||||
struct screen;
|
||||
|
||||
#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
|
||||
struct font {
|
||||
uint16_t height;
|
||||
uint16_t width;
|
||||
uint16_t charsize;
|
||||
uint16_t count;
|
||||
uint8_t *data;
|
||||
};
|
||||
|
||||
int font_init(void *header, struct font *font);
|
||||
|
||||
int font_draw(
|
||||
struct font *f,
|
||||
struct screen *s,
|
||||
uint32_t glyph,
|
||||
uint32_t color,
|
||||
uint32_t x,
|
||||
uint32_t y);
|
||||
|
||||
Reference in New Issue
Block a user