fix: font changing made easier
This commit is contained in:
@@ -14,17 +14,17 @@ extern char* framebuffer;
|
||||
void psf_init()
|
||||
{
|
||||
uint16_t glyph = 0;
|
||||
PSF_font *font = (PSF_font*)&_binary_include_fonts_viscii10_8x16_psfu_start;
|
||||
PSF_font *font = (PSF_font*)&FONT_START;
|
||||
if (font->flags)
|
||||
{
|
||||
unicode = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
char* s = (char*)((unsigned char*)&_binary_include_fonts_viscii10_8x16_psfu_start + font->headersize + font->numglyph * font->bytesperglyph);
|
||||
char* s = (char*)((unsigned char*)&FONT_START + font->headersize + font->numglyph * font->bytesperglyph);
|
||||
unicode = calloc(USHRT_MAX, 2);
|
||||
|
||||
while(s>_binary_include_fonts_viscii10_8x16_psfu_end){
|
||||
while(s>FONT_END){
|
||||
uint16_t uc = (uint16_t)((unsigned char *)s[0]);
|
||||
if(uc == 0xFF) {
|
||||
glyph++;
|
||||
@@ -60,13 +60,13 @@ void putpixel(uint32_t* fb, int pitch, int bpp, int x, int y, uint32_t color)
|
||||
|
||||
void draw_char(unsigned short int c, int cx, int cy, uint32_t fg, uint32_t bg)
|
||||
{
|
||||
PSF_font *font = (PSF_font*)&_binary_include_fonts_viscii10_8x16_psfu_start;
|
||||
PSF_font *font = (PSF_font*)&FONT_START;
|
||||
int bytesperline=(font->width+7)/8;
|
||||
if (unicode != NULL) {
|
||||
c = unicode[c];
|
||||
}
|
||||
|
||||
unsigned char* glyph = (unsigned char*)&_binary_include_fonts_viscii10_8x16_psfu_start + font->headersize + (c>0&&c<font->numglyph?c:0)*font->bytesperglyph;
|
||||
unsigned char* glyph = (unsigned char*)&FONT_START + font->headersize + (c>0&&c<font->numglyph?c:0)*font->bytesperglyph;
|
||||
|
||||
int offs =
|
||||
(cy * font->height * scanline) +
|
||||
@@ -96,7 +96,7 @@ void scroll()
|
||||
{
|
||||
serial_printf(3, "Scrolling...\r");
|
||||
uint32_t bg_color = 0x00000000;
|
||||
PSF_font *font = (PSF_font*)&_binary_include_fonts_viscii10_8x16_psfu_start;
|
||||
PSF_font *font = (PSF_font*)&FONT_START;
|
||||
|
||||
int line_size = font->height * scanline;
|
||||
int framebuffer_size = scanline * font->height * (1080/font->height);
|
||||
|
||||
@@ -10,8 +10,11 @@
|
||||
|
||||
extern int scanline;
|
||||
|
||||
extern char _binary_include_fonts_viscii10_8x16_psfu_start;
|
||||
extern char _binary_include_fonts_viscii10_8x16_psfu_end;
|
||||
#define FONT_START _binary_include_fonts_viscii10_8x16_psfu_start
|
||||
#define FONT_END _binary_include_fonts_viscii10_8x16_psfu_start
|
||||
|
||||
extern char FONT_START;
|
||||
extern char FONT_END;
|
||||
uint16_t* unicode;
|
||||
#define PIXEL uint32_t
|
||||
|
||||
|
||||
Reference in New Issue
Block a user