text: Add some macros so we can more easily swap out the bitmap font
This commit is contained in:
parent
17473a289f
commit
22a6c0ca3a
@ -39,8 +39,8 @@ static void set_point(int x, int y, uint32_t value) {
|
||||
|
||||
#define BG_COLOR 0xFF050505
|
||||
#define FG_COLOR 0xFFCCCCCC
|
||||
#define char_width 9
|
||||
#define char_height 20
|
||||
#define char_width LARGE_FONT_CELL_WIDTH
|
||||
#define char_height LARGE_FONT_CELL_HEIGHT
|
||||
static void write_char(int x, int y, int val, uint32_t color) {
|
||||
if (val > 128) {
|
||||
val = 4;
|
||||
@ -48,7 +48,7 @@ static void write_char(int x, int y, int val, uint32_t color) {
|
||||
uint16_t * c = large_font[val];
|
||||
for (uint8_t i = 0; i < char_height; ++i) {
|
||||
for (uint8_t j = 0; j < char_width; ++j) {
|
||||
if (c[i] & (1 << (15-j))) {
|
||||
if (c[i] & (1 << (LARGE_FONT_MASK-j))) {
|
||||
set_point(x+j,y+i,color);
|
||||
} else {
|
||||
set_point(x+j,y+i,BG_COLOR);
|
||||
|
Binary file not shown.
@ -744,7 +744,7 @@ static void term_write_char(uint32_t val, uint16_t x, uint16_t y, uint32_t fg, u
|
||||
uint16_t * c = large_font[val];
|
||||
for (uint8_t i = 0; i < char_height; ++i) {
|
||||
for (uint8_t j = 0; j < char_width; ++j) {
|
||||
if (c[i] & (1 << (15-j))) {
|
||||
if (c[i] & (1 << (LARGE_FONT_MASK-j))) {
|
||||
term_set_point(x+j,y+i,_fg);
|
||||
} else {
|
||||
term_set_point(x+j,y+i,_bg);
|
||||
@ -1781,8 +1781,8 @@ static void reinit(void) {
|
||||
char_offset *= font_scaling;
|
||||
}
|
||||
} else {
|
||||
char_width = 9;
|
||||
char_height = 20;
|
||||
char_width = LARGE_FONT_CELL_WIDTH;
|
||||
char_height = LARGE_FONT_CELL_HEIGHT;
|
||||
}
|
||||
|
||||
int old_width = term_width;
|
||||
|
@ -28,8 +28,8 @@ extern size_t lfb_memsize;
|
||||
|
||||
/* Bitmap font details */
|
||||
#include "../../apps/terminal-font.h"
|
||||
#define char_height 20
|
||||
#define char_width 9
|
||||
#define char_height LARGE_FONT_CELL_HEIGHT
|
||||
#define char_width LARGE_FONT_CELL_WIDTH
|
||||
|
||||
/* Default colors */
|
||||
#define BG_COLOR 0xFF050505 /* Background */
|
||||
@ -51,7 +51,7 @@ static void write_char(int x, int y, int val, uint32_t color) {
|
||||
uint16_t * c = large_font[val];
|
||||
for (uint8_t i = 0; i < char_height; ++i) {
|
||||
for (uint8_t j = 0; j < char_width; ++j) {
|
||||
if (c[i] & (1 << (15-j))) {
|
||||
if (c[i] & (1 << (LARGE_FONT_MASK-j))) {
|
||||
set_point(x+j,y+i,color);
|
||||
} else {
|
||||
set_point(x+j,y+i,bg_color);
|
||||
|
Loading…
Reference in New Issue
Block a user