-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpsf.h
61 lines (50 loc) · 1.46 KB
/
psf.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef PSF_H_
#define PSF_H_
#include <stdint.h>
#include <stdio.h>
#define PSF1_MAGIC0 0x36
#define PSF1_MAGIC1 0x04
#define PSF1_MODE512 0x01
#define PSF1_MODEHASTAB 0x02
#define PSF1_MODEHASSEQ 0x04
#define PSF1_MAXMODE 0x05
#define PSF1_SEPARATOR 0xFFFF
#define PSF1_STARTSEQ 0xFFFE
struct psf1_header {
unsigned char magic[2]; /* Magic number */
unsigned char mode; /* PSF font mode */
unsigned char charsize; /* Character size */
};
/**
* Initializes the psf context from a psf font file.
* <p>
* Only PSF1 files are supported.
*
* @param psffile an null-terminated string representing the path to
* the psf font file
* @return 0 if successful, 1 if failed
*/
int psf_init(const char *psffile);
/**
* De-initializes the psf context.
*/
void psf_deinit();
/**
* Draw a character to the framebuffer.
*
* @param ch the unicode representation of the character
* @param x the x-coordinate of the top-left corner
* @param y the y-coordinate of the top-left corner
* @param color the color of the character in 24-bit RGB format
* @return 0 if the character has been successfully drawn, otherwise 1
*/
int psf_drawfont(uint16_t ch, uint32_t x, uint32_t y, uint32_t color);
/**
* Returns the memory address of the PSF glyph.
*/
uint8_t *psf_getglyph(uint16_t ch);
/**
* Prints a character into stream.
*/
void psf_printfont(uint16_t ch, FILE *stream);
#endif // PSF_H_