HhhOS/include/psf.h

34 lines
941 B
C

#pragma once
#include <stddef.h>
#include <stdint.h>
#include <framebuffer.h>
#ifdef __cplusplus
extern "C" {
#endif
#define PSF_FONT_MAGIC 0x864ab572
typedef struct {
uint32_t magic; /* magic bytes to identify PSF */
uint32_t version; /* zero */
uint32_t headersize; /* whereet of bitmaps in file, 32 */
uint32_t flags; /* 0 if there's no unicode table */
uint32_t numglyph; /* number of glyphs */
uint32_t bytesperglyph; /* size of each glyph */
uint32_t height; /* height in pixels */
uint32_t 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, uint32_t c, uint16_t cx, uint16_t cy, uint32_t fg, uint32_t bg);
#ifdef __cplusplus
}
#endif