font: Specify that we use code page 437, use unsigned 8-bit fonts and special characters to print the menu's tree

This commit is contained in:
mintsuki 2020-12-07 17:14:14 +01:00
parent 8d04ab1c30
commit d40a6a3619
10 changed files with 23 additions and 22 deletions

View File

@ -54,7 +54,7 @@ Some keys take *URIs* as values; these are described in the next section.
* `DEFAULT_ENTRY` - 1-based entry index of the entry which will be automatically selected at startup. If unspecified, it is `1`.
* `GRAPHICS` - If set to `yes`, do use graphical VESA framebuffer for the boot menu, else use text mode.
* `MENU_RESOLUTION` - Specify screen resolution to be used by the Limine menu in the form `<width>x<height>`. This will *only* affect the menu, not any booted OS. If not specified, Limine will pick a resolution automatically. If the resolution is not available, Limine will pick another one automatically. Ignored if `GRAPHICS` is not `yes`.
* `MENU_FONT` - URI path to a font file to be used instead of the default one for the menu. The font file must be a consecutive bitmap containing 8x16 glyphs in ASCII.
* `MENU_FONT` - URI path to a font file to be used instead of the default one for the menu. The font file must be a code page 437 character set comprised of 256 consecutive 8x16 glyphs bitmaps (4096 byte font file). Each glyph's bitmap must be expressed left to right (1 byte per row), and top to bottom (16 bytes per whole glyph).
* `THEME_COLOURS` - Specifies the colour palette used by the terminal (AARRGGBB). It is a `;` separated array of 8 colours: black, red, green, brown, blue, magenta, cyan, and gray, respectively. Ignored if `GRAPHICS` is not `yes`.
* `THEME_COLORS` - Alias of `THEME_COLOURS`.
* `THEME_MARGIN` - Set the amount of margin around the terminal. Ignored if `GRAPHICS` is not `yes`.

Binary file not shown.

Binary file not shown.

View File

@ -166,13 +166,13 @@ void vbe_plot_bg_blent_rect(int x, int y, int width, int height, uint32_t hex) {
}
struct vbe_char {
char c;
uint8_t c;
uint32_t fg;
uint32_t bg;
};
void vbe_plot_char(struct vbe_char *c, int x, int y) {
uint8_t *glyph = &vga_font[c->c * VGA_FONT_HEIGHT];
uint8_t *glyph = &vga_font[(size_t)c->c * VGA_FONT_HEIGHT];
vbe_plot_bg_blent_rect(x, y, VGA_FONT_WIDTH, VGA_FONT_HEIGHT, c->bg);
@ -305,7 +305,7 @@ void vbe_double_buffer(bool state) {
}
}
void vbe_putchar(char c) {
void vbe_putchar(uint8_t c) {
switch (c) {
case '\b':
if (cursor_x || cursor_y) {

View File

@ -25,7 +25,7 @@ bool init_vbe(struct vbe_framebuffer_info *ret,
bool vbe_tty_init(int *rows, int *cols, uint32_t *colours, int margin, int margin_gradient, struct image *background);
void vbe_putchar(char c);
void vbe_putchar(uint8_t c);
void vbe_clear(bool move);
void vbe_enable_cursor(void);
void vbe_disable_cursor(void);

View File

@ -11,11 +11,11 @@
#define VD_COLS (80 * 2)
#define VD_ROWS 25
static char *back_buffer = NULL;
static char *front_buffer = NULL;
static char *video_mem = (char *)0xb8000;
static uint8_t *back_buffer = NULL;
static uint8_t *front_buffer = NULL;
static uint8_t *video_mem = (uint8_t *)0xb8000;
static char *current_buffer;
static uint8_t *current_buffer;
static size_t cursor_offset = 0;
static int cursor_status = 1;
@ -135,7 +135,7 @@ void text_set_text_bg(int bg) {
text_palette = (text_palette & 0x0f) | (ansi_colours[bg] << 4);
}
void text_putchar(char c) {
void text_putchar(uint8_t c) {
switch (c) {
case '\b':
if (cursor_offset) {

View File

@ -5,7 +5,7 @@
void init_vga_textmode(int *rows, int *cols);
void text_putchar(char c);
void text_putchar(uint8_t c);
void text_clear(bool move);
void text_enable_cursor(void);
void text_disable_cursor(void);

View File

@ -13,7 +13,7 @@ static enum {
TEXTMODE
} term_backend = NOT_READY;
void (*raw_putchar)(char c);
void (*raw_putchar)(uint8_t c);
void (*clear)(bool move);
void (*enable_cursor)(void);
void (*disable_cursor)(void);
@ -77,7 +77,7 @@ void term_deinit(void) {
term_backend = NOT_READY;
}
static void term_putchar(char c);
static void term_putchar(uint8_t c);
void term_write(const char *buf, size_t count) {
if (term_backend == NOT_READY)
@ -98,7 +98,7 @@ static int get_cursor_pos_y(void) {
return y;
}
static void escape_parse(char c);
static void escape_parse(uint8_t c);
static int escape = 0;
static int esc_value0 = 0;
@ -108,7 +108,7 @@ static int esc_default0 = 1;
static int esc_default1 = 1;
static int *esc_default = &esc_default0;
static void term_putchar(char c) {
static void term_putchar(uint8_t c) {
if (escape) {
escape_parse(c);
return;
@ -143,7 +143,7 @@ static void sgr(void) {
}
}
static void escape_parse(char c) {
static void escape_parse(uint8_t c) {
if (c >= '0' && c <= '9') {
*esc_value *= 10;
*esc_value += c - '0';

View File

@ -5,7 +5,7 @@
#include <stdbool.h>
#include <lib/image.h>
extern void (*raw_putchar)(char c);
extern void (*raw_putchar)(uint8_t c);
extern void (*clear)(bool move);
extern void (*enable_cursor)(void);
extern void (*disable_cursor)(void);

View File

@ -197,6 +197,7 @@ static int print_tree(int level, int base_index, int selected_entry,
struct menu_entry *current_entry,
struct menu_entry **selected_menu_entry) {
int max_entries = 0;
for (;;) {
if (current_entry == NULL)
break;
@ -206,19 +207,19 @@ static int print_tree(int level, int base_index, int selected_entry,
for (int j = 0; j < i; j++)
actual_parent = actual_parent->parent;
if (actual_parent->next != NULL)
print(" | ");
print(" \xb3");
else
print(" ");
print(" ");
}
if (current_entry->next == NULL)
print(" `-");
print(" \xc0");
else
print(" |-");
print(" \xc3");
}
if (current_entry->sub)
print(current_entry->expanded ? "[-]" : "[+]");
else if (level)
print("-> ");
print("\xc4> ");
else
print(" ");
if (base_index + max_entries == selected_entry) {