HhhOS/include/psf.h
2021-08-17 12:45:35 +03:00

25 lines
786 B
C

#pragma once
#include <types.h>
#include <framebuffer.h>
#define PSF_FONT_MAGIC 0x864ab572
typedef struct {
u32 magic; /* magic bytes to identify PSF */
u32 version; /* zero */
u32 headersize; /* whereet of bitmaps in file, 32 */
u32 flags; /* 0 if there's no unicode table */
u32 numglyph; /* number of glyphs */
u32 bytesperglyph; /* size of each glyph */
u32 height; /* height in pixels */
u32 width; /* width in pixels */
} PSF_font;
// these are linked using objcopy
extern char _binary_font_psfu_start;
extern char _binary_font_psfu_end;
// c is a unicode character, cx and cy are cursor position in characters
void draw_psf_char(framebuffer_t *framebuffer, u32 c, u16 cx, u16 cy, u32 fg, u32 bg);