feature: line spacing + characters are aligned

This commit is contained in:
0x35c 2024-12-19 19:04:43 +01:00
parent 61debdcb85
commit bab3069152
5 changed files with 159 additions and 22 deletions

View File

@ -5,5 +5,6 @@
struct font { struct font {
uint32_t height; uint32_t height;
uint32_t width; uint32_t width;
uint32_t yoffset;
char *bitmap; char *bitmap;
}; };

View File

@ -8,641 +8,769 @@ struct font consolas_regular_13_font[] = {\
{ {
.width = 0, .width = 0,
.height = 0, .height = 0,
.yoffset = 0,
.bitmap = NULL, .bitmap = NULL,
}, },
{ {
.width = 0, .width = 0,
.height = 0, .height = 0,
.yoffset = 0,
.bitmap = NULL, .bitmap = NULL,
}, },
{ {
.width = 0, .width = 0,
.height = 0, .height = 0,
.yoffset = 0,
.bitmap = NULL, .bitmap = NULL,
}, },
{ {
.width = 0, .width = 0,
.height = 0, .height = 0,
.yoffset = 0,
.bitmap = NULL, .bitmap = NULL,
}, },
{ {
.width = 0, .width = 0,
.height = 0, .height = 0,
.yoffset = 0,
.bitmap = NULL, .bitmap = NULL,
}, },
{ {
.width = 0, .width = 0,
.height = 0, .height = 0,
.yoffset = 0,
.bitmap = NULL, .bitmap = NULL,
}, },
{ {
.width = 0, .width = 0,
.height = 0, .height = 0,
.yoffset = 0,
.bitmap = NULL, .bitmap = NULL,
}, },
{ {
.width = 0, .width = 0,
.height = 0, .height = 0,
.yoffset = 0,
.bitmap = NULL, .bitmap = NULL,
}, },
{ {
.width = 0, .width = 0,
.height = 0, .height = 0,
.yoffset = 0,
.bitmap = NULL, .bitmap = NULL,
}, },
{ {
.width = 0, .width = 0,
.height = 0, .height = 0,
.yoffset = 0,
.bitmap = NULL, .bitmap = NULL,
}, },
{ {
.width = 0, .width = 0,
.height = 0, .height = 0,
.yoffset = 0,
.bitmap = NULL, .bitmap = NULL,
}, },
{ {
.width = 0, .width = 0,
.height = 0, .height = 0,
.yoffset = 0,
.bitmap = NULL, .bitmap = NULL,
}, },
{ {
.width = 0, .width = 0,
.height = 0, .height = 0,
.yoffset = 0,
.bitmap = NULL, .bitmap = NULL,
}, },
{ {
.width = 0, .width = 0,
.height = 0, .height = 0,
.yoffset = 0,
.bitmap = NULL, .bitmap = NULL,
}, },
{ {
.width = 0, .width = 0,
.height = 0, .height = 0,
.yoffset = 0,
.bitmap = NULL, .bitmap = NULL,
}, },
{ {
.width = 0, .width = 0,
.height = 0, .height = 0,
.yoffset = 0,
.bitmap = NULL, .bitmap = NULL,
}, },
{ {
.width = 0, .width = 0,
.height = 0, .height = 0,
.yoffset = 0,
.bitmap = NULL, .bitmap = NULL,
}, },
{ {
.width = 0, .width = 0,
.height = 0, .height = 0,
.yoffset = 0,
.bitmap = NULL, .bitmap = NULL,
}, },
{ {
.width = 0, .width = 0,
.height = 0, .height = 0,
.yoffset = 0,
.bitmap = NULL, .bitmap = NULL,
}, },
{ {
.width = 0, .width = 0,
.height = 0, .height = 0,
.yoffset = 0,
.bitmap = NULL, .bitmap = NULL,
}, },
{ {
.width = 0, .width = 0,
.height = 0, .height = 0,
.yoffset = 0,
.bitmap = NULL, .bitmap = NULL,
}, },
{ {
.width = 0, .width = 0,
.height = 0, .height = 0,
.yoffset = 0,
.bitmap = NULL, .bitmap = NULL,
}, },
{ {
.width = 0, .width = 0,
.height = 0, .height = 0,
.yoffset = 0,
.bitmap = NULL, .bitmap = NULL,
}, },
{ {
.width = 0, .width = 0,
.height = 0, .height = 0,
.yoffset = 0,
.bitmap = NULL, .bitmap = NULL,
}, },
{ {
.width = 0, .width = 0,
.height = 0, .height = 0,
.yoffset = 0,
.bitmap = NULL, .bitmap = NULL,
}, },
{ {
.width = 0, .width = 0,
.height = 0, .height = 0,
.yoffset = 0,
.bitmap = NULL, .bitmap = NULL,
}, },
{ {
.width = 0, .width = 0,
.height = 0, .height = 0,
.yoffset = 0,
.bitmap = NULL, .bitmap = NULL,
}, },
{ {
.width = 0, .width = 0,
.height = 0, .height = 0,
.yoffset = 0,
.bitmap = NULL, .bitmap = NULL,
}, },
{ {
.width = 0, .width = 0,
.height = 0, .height = 0,
.yoffset = 0,
.bitmap = NULL, .bitmap = NULL,
}, },
{ {
.width = 0, .width = 0,
.height = 0, .height = 0,
.yoffset = 0,
.bitmap = NULL, .bitmap = NULL,
}, },
{ {
.width = 0, .width = 0,
.height = 0, .height = 0,
.yoffset = 0,
.bitmap = NULL, .bitmap = NULL,
}, },
{ {
.width = 0, .width = 0,
.height = 0, .height = 0,
.yoffset = 0,
.bitmap = NULL, .bitmap = NULL,
}, },
{ {
.width = 1, .width = 1,
.height = 1, .height = 1,
.yoffset = 12,
.bitmap = " ", .bitmap = " ",
}, },
{ {
.width = 3, .width = 3,
.height = 13, .height = 13,
.yoffset = 0,
.bitmap = "## ## ## ## ## ## ## ## ## ## #########", .bitmap = "## ## ## ## ## ## ## ## ## ## #########",
}, },
{ {
.width = 6, .width = 6,
.height = 5, .height = 5,
.yoffset = 0,
.bitmap = "##############################", .bitmap = "##############################",
}, },
{ {
.width = 10, .width = 10,
.height = 12, .height = 12,
.yoffset = 1,
.bitmap = " ## ## ## ## ## ## #################### ## ## ## ## #################### ## ## ## ## ## ## ", .bitmap = " ## ## ## ## ## ## #################### ## ## ## ## #################### ## ## ## ## ## ## ",
}, },
{ {
.width = 8, .width = 8,
.height = 15, .height = 15,
.yoffset = 0,
.bitmap = " ### ## ##### ###### ## ## ## ## ##### ###### ##### ### ## ### ######### ###### ## ## ", .bitmap = " ### ## ##### ###### ## ## ## ## ##### ###### ##### ### ## ### ######### ###### ## ## ",
}, },
{ {
.width = 11, .width = 11,
.height = 13, .height = 13,
.yoffset = 0,
.bitmap = " ### ## ##### ### ## ## ## ## ## ## ######## ### ## ## ###### ####### ## ## ## ### ## ## ## ##### ## ### ", .bitmap = " ### ## ##### ### ## ## ## ## ## ## ######## ### ## ## ###### ####### ## ## ## ### ## ## ## ##### ## ### ",
}, },
{ {
.width = 11, .width = 11,
.height = 13, .height = 13,
.yoffset = 0,
.bitmap = " #### ###### ## ## ## ## ###### #### #### ## ###### ## ## ##### ## #### ## #### ######## #### ### ", .bitmap = " #### ###### ## ## ## ## ###### #### #### ## ###### ## ## ##### ## #### ## #### ######## #### ### ",
}, },
{ {
.width = 3, .width = 3,
.height = 5, .height = 5,
.yoffset = 0,
.bitmap = "###############", .bitmap = "###############",
}, },
{ {
.width = 5, .width = 5,
.height = 16, .height = 16,
.yoffset = 0,
.bitmap = " # ### ## ## ## ## ## ## ## ## ## ## ## ## ### # ", .bitmap = " # ### ## ## ## ## ## ## ## ## ## ## ## ## ### # ",
}, },
{ {
.width = 5, .width = 5,
.height = 16, .height = 16,
.yoffset = 0,
.bitmap = " # ### ## ## ## ## ## ## ## ## ## ## ## ## ### # ", .bitmap = " # ### ## ## ## ## ## ## ## ## ## ## ## ## ### # ",
}, },
{ {
.width = 8, .width = 8,
.height = 8, .height = 8,
.yoffset = 0,
.bitmap = " ## # ## # ######## ###### ###### ######## # ## # ## ", .bitmap = " ## # ## # ######## ###### ###### ######## # ## # ## ",
}, },
{ {
.width = 8, .width = 8,
.height = 8, .height = 8,
.yoffset = 4,
.bitmap = " ## ## ## ################ ## ## ## ", .bitmap = " ## ## ## ################ ## ## ## ",
}, },
{ {
.width = 5, .width = 5,
.height = 6, .height = 6,
.yoffset = 10,
.bitmap = " ### #### ### ####### ### ", .bitmap = " ### #### ### ####### ### ",
}, },
{ {
.width = 6, .width = 6,
.height = 2, .height = 2,
.yoffset = 7,
.bitmap = "############", .bitmap = "############",
}, },
{ {
.width = 4, .width = 4,
.height = 3, .height = 3,
.yoffset = 10,
.bitmap = " ## ########", .bitmap = " ## ########",
}, },
{ {
.width = 9, .width = 9,
.height = 15, .height = 15,
.yoffset = 0,
.bitmap = " ## ## ### ## ### ## ### ## ## ### ## ### ## ### ## ", .bitmap = " ## ## ### ## ### ## ### ## ## ### ## ### ## ### ## ",
}, },
{ {
.width = 8, .width = 8,
.height = 12, .height = 12,
.yoffset = 1,
.bitmap = " #### ###### ## ## ## ##### ###### ########## ###### ##### ## ## ## ###### #### ", .bitmap = " #### ###### ## ## ## ##### ###### ########## ###### ##### ## ## ## ###### #### ",
}, },
{ {
.width = 8, .width = 8,
.height = 12, .height = 12,
.yoffset = 1,
.bitmap = " ## #### ##### ## ## ## ## ## ## ## ## ################", .bitmap = " ## #### ##### ## ## ## ## ## ## ## ## ################",
}, },
{ {
.width = 8, .width = 8,
.height = 12, .height = 12,
.yoffset = 1,
.bitmap = " #### ###### # ## ## ## ### ## ### ### ### ################", .bitmap = " #### ###### # ## ## ## ### ## ### ### ### ################",
}, },
{ {
.width = 7, .width = 7,
.height = 12, .height = 12,
.yoffset = 1,
.bitmap = "##### ####### ## ## ## ##### ##### ## ## ######## ##### ", .bitmap = "##### ####### ## ## ## ##### ##### ## ## ######## ##### ",
}, },
{ {
.width = 10, .width = 10,
.height = 12, .height = 12,
.yoffset = 1,
.bitmap = " ### ### #### ##### ## ## ### ## ### ## ## ## #################### ## ## ", .bitmap = " ### ### #### ##### ## ## ### ## ### ## ## ## #################### ## ## ",
}, },
{ {
.width = 7, .width = 7,
.height = 12, .height = 12,
.yoffset = 1,
.bitmap = "###### ###### ## ## ##### ###### ## ## ## ######### ##### ", .bitmap = "###### ###### ## ## ##### ###### ## ## ## ######### ##### ",
}, },
{ {
.width = 8, .width = 8,
.height = 12, .height = 12,
.yoffset = 1,
.bitmap = " #### ##### ## ## ###### ####### ## #### #### ##### ### ###### #### ", .bitmap = " #### ##### ## ## ###### ####### ## #### #### ##### ### ###### #### ",
}, },
{ {
.width = 8, .width = 8,
.height = 12, .height = 12,
.yoffset = 1,
.bitmap = "################ ### ## ### ## ### ## ### ### ### ### ", .bitmap = "################ ### ## ### ## ### ## ### ### ### ### ",
}, },
{ {
.width = 8, .width = 8,
.height = 12, .height = 12,
.yoffset = 1,
.bitmap = " #### ######### #### ##### ### ###### ###### ### ##### #### ######### #### ", .bitmap = " #### ######### #### ##### ### ###### ###### ### ##### #### ######### #### ",
}, },
{ {
.width = 8, .width = 8,
.height = 12, .height = 12,
.yoffset = 1,
.bitmap = " #### ###### ### ##### #### #### ## ####### ###### ## ## ##### #### ", .bitmap = " #### ###### ### ##### #### #### ## ####### ###### ## ## ##### #### ",
}, },
{ {
.width = 3, .width = 3,
.height = 9, .height = 9,
.yoffset = 4,
.bitmap = "######### #########", .bitmap = "######### #########",
}, },
{ {
.width = 5, .width = 5,
.height = 12, .height = 12,
.yoffset = 4,
.bitmap = " ### ### ### ### #### ### ####### ### ", .bitmap = " ### ### ### ### #### ### ####### ### ",
}, },
{ {
.width = 7, .width = 7,
.height = 10, .height = 10,
.yoffset = 3,
.bitmap = " # ### ### #### #### #### #### ### ### # ", .bitmap = " # ### ### #### #### #### #### ### ### # ",
}, },
{ {
.width = 8, .width = 8,
.height = 5, .height = 5,
.yoffset = 6,
.bitmap = "################ ################", .bitmap = "################ ################",
}, },
{ {
.width = 7, .width = 7,
.height = 10, .height = 10,
.yoffset = 3,
.bitmap = " # ### ### #### #### #### #### ### ### # ", .bitmap = " # ### ### #### #### #### #### ### ### # ",
}, },
{ {
.width = 6, .width = 6,
.height = 13, .height = 13,
.yoffset = 0,
.bitmap = "### ##### ### ## ## ##### #### ## ## ## ### ### ### ", .bitmap = "### ##### ### ## ## ##### #### ## ## ## ### ### ### ",
}, },
{ {
.width = 10, .width = 10,
.height = 16, .height = 16,
.yoffset = 0,
.bitmap = " #### ####### ## ## ## ## ## ##################### ######## ######## ######## ############## ## ###### ## ## ## ####### ##### ", .bitmap = " #### ####### ## ## ## ## ## ##################### ######## ######## ######## ############## ## ###### ## ## ## ####### ##### ",
}, },
{ {
.width = 12, .width = 12,
.height = 12, .height = 12,
.yoffset = 1,
.bitmap = " ### #### #### ###### ## ## ## ## ### ### ######## ######## ### ### ## ## ### ###", .bitmap = " ### #### #### ###### ## ## ## ## ### ### ######## ######## ### ### ## ## ### ###",
}, },
{ {
.width = 8, .width = 8,
.height = 12, .height = 12,
.yoffset = 1,
.bitmap = "###### ########## #### #### ########## ####### ## #### #### ######### ###### ", .bitmap = "###### ########## #### #### ########## ####### ## #### #### ######### ###### ",
}, },
{ {
.width = 8, .width = 8,
.height = 12, .height = 12,
.yoffset = 1,
.bitmap = " #### ###### ## ### ## ## ## ## ## ## # ####### #### ", .bitmap = " #### ###### ## ### ## ## ## ## ## ## # ####### #### ",
}, },
{ {
.width = 8, .width = 8,
.height = 12, .height = 12,
.yoffset = 1,
.bitmap = "##### ####### ## ## ## #### #### #### #### #### ##### ## ####### ##### ", .bitmap = "##### ####### ## ## ## #### #### #### #### #### ##### ## ####### ##### ",
}, },
{ {
.width = 7, .width = 7,
.height = 12, .height = 12,
.yoffset = 1,
.bitmap = "################ ## ## ################ ## ## ##############", .bitmap = "################ ## ## ################ ## ## ##############",
}, },
{ {
.width = 7, .width = 7,
.height = 12, .height = 12,
.yoffset = 1,
.bitmap = "################ ## ## ################ ## ## ## ## ", .bitmap = "################ ## ## ################ ## ## ## ## ",
}, },
{ {
.width = 8, .width = 8,
.height = 12, .height = 12,
.yoffset = 1,
.bitmap = " #### ###### ## #### ## ## ###### ###### #### ## ## ## ####### #### ", .bitmap = " #### ###### ## #### ## ## ###### ###### #### ## ## ## ####### #### ",
}, },
{ {
.width = 8, .width = 8,
.height = 12, .height = 12,
.yoffset = 1,
.bitmap = "## #### #### #### #### #################### #### #### #### #### ##", .bitmap = "## #### #### #### #### #################### #### #### #### #### ##",
}, },
{ {
.width = 8, .width = 8,
.height = 12, .height = 12,
.yoffset = 1,
.bitmap = "################ ## ## ## ## ## ## ## ## ################", .bitmap = "################ ## ## ## ## ## ## ## ## ################",
}, },
{ {
.width = 6, .width = 6,
.height = 12, .height = 12,
.yoffset = 1,
.bitmap = "############ ## ## ## ## ## ## ### ####### ### ", .bitmap = "############ ## ## ## ## ## ## ### ####### ### ",
}, },
{ {
.width = 10, .width = 10,
.height = 12, .height = 12,
.yoffset = 1,
.bitmap = "## ### ## ### ## ### ## ### ##### #### #### ##### ## ### ## ### ## ### ## ### ", .bitmap = "## ### ## ### ## ### ## ### ##### #### #### ##### ## ### ## ### ## ### ## ### ",
}, },
{ {
.width = 7, .width = 7,
.height = 12, .height = 12,
.yoffset = 1,
.bitmap = "## ## ## ## ## ## ## ## ## ## ##############", .bitmap = "## ## ## ## ## ## ## ## ## ## ##############",
}, },
{ {
.width = 10, .width = 10,
.height = 12, .height = 12,
.yoffset = 1,
.bitmap = "### ####### ######## ######## ############################## ###### ## ###### ###### ###### ###### ###", .bitmap = "### ####### ######## ######## ############################## ###### ## ###### ###### ###### ###### ###",
}, },
{ {
.width = 8, .width = 8,
.height = 12, .height = 12,
.yoffset = 1,
.bitmap = "### ##### ###### ###### ###### #### ## #### ## #### ###### ###### ###### ##### ###", .bitmap = "### ##### ###### ###### ###### #### ## #### ## #### ###### ###### ###### ##### ###",
}, },
{ {
.width = 10, .width = 10,
.height = 12, .height = 12,
.yoffset = 1,
.bitmap = " #### ######## ## ## ### #### #### #### #### #### ### ## ## ######## #### ", .bitmap = " #### ######## ## ## ### #### #### #### #### #### ### ## ## ######## #### ",
}, },
{ {
.width = 8, .width = 8,
.height = 12, .height = 12,
.yoffset = 1,
.bitmap = "###### ####### ## ##### #### #### ########## ###### ## ## ## ## ", .bitmap = "###### ####### ## ##### #### #### ########## ###### ## ## ## ## ",
}, },
{ {
.width = 9, .width = 9,
.height = 15, .height = 15,
.yoffset = 1,
.bitmap = " #### ####### ## ## ## #### #### #### #### #### ## ## ## ####### ##### ## # ##### ### ", .bitmap = " #### ####### ## ## ## #### #### #### #### #### ## ## ## ####### ##### ## # ##### ### ",
}, },
{ {
.width = 8, .width = 8,
.height = 12, .height = 12,
.yoffset = 1,
.bitmap = "##### ####### ## ## ## ## ## ## ###### ##### ## ### ## ### ## ### ## ##### ###", .bitmap = "##### ####### ## ## ## ## ## ## ###### ##### ## ### ## ### ## ### ## ##### ###",
}, },
{ {
.width = 8, .width = 8,
.height = 12, .height = 12,
.yoffset = 1,
.bitmap = " #### ###### ## # ## ### ##### ##### ### #### ######### ##### ", .bitmap = " #### ###### ## # ## ### ##### ##### ### #### ######### ##### ",
}, },
{ {
.width = 8, .width = 8,
.height = 12, .height = 12,
.yoffset = 1,
.bitmap = "################ ## ## ## ## ## ## ## ## ## ## ", .bitmap = "################ ## ## ## ## ## ## ## ## ## ## ",
}, },
{ {
.width = 8, .width = 8,
.height = 12, .height = 12,
.yoffset = 1,
.bitmap = "## #### #### #### #### #### #### #### #### #### ### ###### #### ", .bitmap = "## #### #### #### #### #### #### #### #### #### ### ###### #### ",
}, },
{ {
.width = 12, .width = 12,
.height = 12, .height = 12,
.yoffset = 1,
.bitmap = "### ### ### ## ### ### ## ## ### ### ### ### ## ## ###### ###### #### #### ### ", .bitmap = "### ### ### ## ### ### ## ## ### ### ### ### ## ## ###### ###### #### #### ### ",
}, },
{ {
.width = 10, .width = 10,
.height = 12, .height = 12,
.yoffset = 1,
.bitmap = " ## # ## ## ## ## ## ## ## ## ## ## ## ## ######## ######## ######## ######## ### ### ### ### ", .bitmap = " ## # ## ## ## ## ## ## ## ## ## ## ## ## ######## ######## ######## ######## ### ### ### ### ",
}, },
{ {
.width = 10, .width = 10,
.height = 12, .height = 12,
.yoffset = 1,
.bitmap = "### ### ## ## ### ### ###### #### #### #### #### ###### ### ### ### ### ### ###", .bitmap = "### ### ## ## ### ### ###### #### #### #### #### ###### ### ### ### ### ### ###",
}, },
{ {
.width = 10, .width = 10,
.height = 12, .height = 12,
.yoffset = 1,
.bitmap = "## ##### ### ## ## ## ## ###### #### #### ## ## ## ## ## ", .bitmap = "## ##### ### ## ## ## ## ###### #### #### ## ## ## ## ## ",
}, },
{ {
.width = 8, .width = 8,
.height = 12, .height = 12,
.yoffset = 1,
.bitmap = "################ ## ### ## ### ### ### ### ## ################", .bitmap = "################ ## ### ## ### ### ### ### ## ################",
}, },
{ {
.width = 5, .width = 5,
.height = 16, .height = 16,
.yoffset = 0,
.bitmap = "############ ## ## ## ## ## ## ## ## ## ## ## ##########", .bitmap = "############ ## ## ## ## ## ## ## ## ## ## ## ##########",
}, },
{ {
.width = 9, .width = 9,
.height = 15, .height = 15,
.yoffset = 0,
.bitmap = "## ### ## ### ## ### ## ## ### ## ### ## ### ## ## ", .bitmap = "## ### ## ### ## ### ## ## ### ## ### ## ### ## ## ",
}, },
{ {
.width = 5, .width = 5,
.height = 16, .height = 16,
.yoffset = 0,
.bitmap = "########## ## ## ## ## ## ## ## ## ## ## ## ############", .bitmap = "########## ## ## ## ## ## ## ## ## ## ## ## ############",
}, },
{ {
.width = 10, .width = 10,
.height = 6, .height = 6,
.yoffset = 1,
.bitmap = " ## #### ###### ## ## ## ## ### ###", .bitmap = " ## #### ###### ## ## ## ## ### ###",
}, },
{ {
.width = 10, .width = 10,
.height = 2, .height = 2,
.yoffset = 14,
.bitmap = "####################", .bitmap = "####################",
}, },
{ {
.width = 7, .width = 7,
.height = 5, .height = 5,
.yoffset = 0,
.bitmap = " ### ### ## ", .bitmap = " ### ### ## ",
}, },
{ {
.width = 7, .width = 7,
.height = 9, .height = 9,
.yoffset = 4,
.bitmap = " #### ###### # ## ############## #### ########## ######", .bitmap = " #### ###### # ## ############## #### ########## ######",
}, },
{ {
.width = 8, .width = 8,
.height = 13, .height = 13,
.yoffset = 0,
.bitmap = "## ## ## ## ###### ####### ### #### #### #### #### ########## ##### ", .bitmap = "## ## ## ## ###### ####### ### #### #### #### #### ########## ##### ",
}, },
{ {
.width = 7, .width = 7,
.height = 9, .height = 9,
.yoffset = 4,
.bitmap = " #### ######### ### ## ## ### # ###### #### ", .bitmap = " #### ######### ### ## ## ### # ###### #### ",
}, },
{ {
.width = 8, .width = 8,
.height = 13, .height = 13,
.yoffset = 0,
.bitmap = " ## ## ## ## ###### ########## #### #### #### #### ### ####### ### ##", .bitmap = " ## ## ## ## ###### ########## #### #### #### #### ### ####### ### ##",
}, },
{ {
.width = 8, .width = 8,
.height = 9, .height = 9,
.yoffset = 4,
.bitmap = " #### ###### ### #################### ### ####### ######", .bitmap = " #### ###### ### #################### ### ####### ######",
}, },
{ {
.width = 9, .width = 9,
.height = 13, .height = 13,
.yoffset = 0,
.bitmap = " #### ##### ## ## ## ####### ####### ## ## ## ## ## ## ", .bitmap = " #### ##### ## ## ## ####### ####### ## ## ## ## ## ## ",
}, },
{ {
.width = 8, .width = 8,
.height = 12, .height = 12,
.yoffset = 4,
.bitmap = " ################ ## ## ## ####### ###### ## ####### ########## ########## ##### ", .bitmap = " ################ ## ## ## ####### ###### ## ####### ########## ########## ##### ",
}, },
{ {
.width = 7, .width = 7,
.height = 13, .height = 13,
.yoffset = 0,
.bitmap = "## ## ## ## ###### ########## #### #### #### #### #### #### ##", .bitmap = "## ## ## ## ###### ########## #### #### #### #### #### #### ##",
}, },
{ {
.width = 8, .width = 8,
.height = 13, .height = 13,
.yoffset = 0,
.bitmap = " ### ### ### ##### ##### ## ## ## ## ## ################", .bitmap = " ### ### ### ##### ##### ## ## ## ## ## ################",
}, },
{ {
.width = 7, .width = 7,
.height = 16, .height = 16,
.yoffset = 0,
.bitmap = " ### ### ### ############## ## ## ## ## ## ## ### ######## #### ", .bitmap = " ### ### ### ############## ## ## ## ## ## ## ### ######## #### ",
}, },
{ {
.width = 9, .width = 9,
.height = 13, .height = 13,
.yoffset = 0,
.bitmap = "## ## ## ## ## ### ## ### ##### #### #### ##### ## ### ## ### ## ### ", .bitmap = "## ## ## ## ## ### ## ### ##### #### #### ##### ## ### ## ### ## ### ",
}, },
{ {
.width = 8, .width = 8,
.height = 13, .height = 13,
.yoffset = 0,
.bitmap = "##### ##### ## ## ## ## ## ## ## ## ## ################", .bitmap = "##### ##### ## ## ## ## ## ## ## ## ## ################",
}, },
{ {
.width = 8, .width = 8,
.height = 9, .height = 9,
.yoffset = 4,
.bitmap = "#### ## ################## ## #### ## #### ## #### ## #### ## #### ## ##", .bitmap = "#### ## ################## ## #### ## #### ## #### ## #### ## #### ## ##",
}, },
{ {
.width = 7, .width = 7,
.height = 9, .height = 9,
.yoffset = 4,
.bitmap = "###### ########## #### #### #### #### #### #### ##", .bitmap = "###### ########## #### #### #### #### #### #### ##",
}, },
{ {
.width = 8, .width = 8,
.height = 9, .height = 9,
.yoffset = 4,
.bitmap = " #### ###### ### ##### #### #### ##### ### ###### #### ", .bitmap = " #### ###### ### ##### #### #### ##### ### ###### #### ",
}, },
{ {
.width = 8, .width = 8,
.height = 12, .height = 12,
.yoffset = 4,
.bitmap = "###### ####### ### #### #### #### #### ########## ###### ## ## ## ", .bitmap = "###### ####### ### #### #### #### #### ########## ###### ## ## ## ",
}, },
{ {
.width = 8, .width = 8,
.height = 12, .height = 12,
.yoffset = 4,
.bitmap = " ###### ########## #### #### #### #### ### ####### ###### ## ## ##", .bitmap = " ###### ########## #### #### #### #### ### ####### ###### ## ## ##",
}, },
{ {
.width = 7, .width = 7,
.height = 9, .height = 9,
.yoffset = 4,
.bitmap = "###### ########## #### #### ## ## ## ## ", .bitmap = "###### ########## #### #### ## ## ## ## ",
}, },
{ {
.width = 7, .width = 7,
.height = 9, .height = 9,
.yoffset = 4,
.bitmap = " ##### ###### ## #### ##### #### ############### ", .bitmap = " ##### ###### ## #### ##### #### ############### ",
}, },
{ {
.width = 9, .width = 9,
.height = 12, .height = 12,
.yoffset = 1,
.bitmap = " # ## ## ################## ## ## ## ## ## ###### #####", .bitmap = " # ## ## ################## ## ## ## ## ## ###### #####",
}, },
{ {
.width = 7, .width = 7,
.height = 9, .height = 9,
.yoffset = 4,
.bitmap = "## #### #### #### #### #### #### ########## ######", .bitmap = "## #### #### #### #### #### #### ########## ######",
}, },
{ {
.width = 10, .width = 10,
.height = 9, .height = 9,
.yoffset = 4,
.bitmap = "### ### ## ## ### ### ## ## ## ## ###### #### #### ## ", .bitmap = "### ### ## ## ### ### ## ## ## ## ###### #### #### ## ",
}, },
{ {
.width = 10, .width = 10,
.height = 9, .height = 9,
.yoffset = 4,
.bitmap = "### ### ## ## ## ## ## ## ## ## ######## ######## ######## ### #### ### ### ", .bitmap = "### ### ## ## ## ## ## ## ## ## ######## ######## ######## ### #### ### ### ",
}, },
{ {
.width = 11, .width = 11,
.height = 9, .height = 9,
.yoffset = 4,
.bitmap = " ### ### ### ### ### ### ##### #### #### ###### ###### ### ### ", .bitmap = " ### ### ### ### ### ### ##### #### #### ###### ###### ### ### ",
}, },
{ {
.width = 10, .width = 10,
.height = 12, .height = 12,
.yoffset = 4,
.bitmap = "### ### ### ## ### ### ## ## ###### ##### #### ### ## ### ##### #### ", .bitmap = "### ### ### ## ### ### ## ## ###### ##### #### ### ## ### ##### #### ",
}, },
{ {
.width = 7, .width = 7,
.height = 9, .height = 9,
.yoffset = 4,
.bitmap = "############## ## ## ### ## ### ##############", .bitmap = "############## ## ## ### ## ### ##############",
}, },
{ {
.width = 7, .width = 7,
.height = 16, .height = 16,
.yoffset = 0,
.bitmap = " ### #### ## ## ## ## ## ### #### ## ## ## ## ## ##### ####", .bitmap = " ### #### ## ## ## ## ## ### #### ## ## ## ## ## ##### ####",
}, },
{ {
.width = 2, .width = 2,
.height = 18, .height = 18,
.yoffset = -2,
.bitmap = "####################################", .bitmap = "####################################",
}, },
{ {
.width = 7, .width = 7,
.height = 16, .height = 16,
.yoffset = 0,
.bitmap = "### #### ## ## ## ## ## ### #### ## ## ## ## ## ##### #### ", .bitmap = "### #### ## ## ## ## ## ### #### ## ## ## ## ## ##### #### ",
}, },
{ {
.width = 9, .width = 9,
.height = 4, .height = 4,
.yoffset = 6,
.bitmap = " ### ######## #### ######## #### ", .bitmap = " ### ######## #### ######## #### ",
}, },
{ {
.width = 0, .width = 0,
.height = 0, .height = 0,
.yoffset = 0,
.bitmap = NULL, .bitmap = NULL,
}, },
}; };

View File

@ -9,9 +9,10 @@
#define SCREEN_WIDTH 1024 #define SCREEN_WIDTH 1024
#define SCREEN_HEIGHT 768 #define SCREEN_HEIGHT 768
#define FONT_SIZE 13 #define FONT_WIDTH 13
#define VGA_WIDTH (SCREEN_WIDTH / FONT_SIZE) #define FONT_HEIGHT 17
#define VGA_HEIGHT (SCREEN_HEIGHT / FONT_SIZE) #define VGA_WIDTH (SCREEN_WIDTH / FONT_WIDTH)
#define VGA_HEIGHT (SCREEN_HEIGHT / FONT_HEIGHT)
#define TERM_COUNT 10 #define TERM_COUNT 10
struct screen { struct screen {
@ -19,7 +20,7 @@ struct screen {
size_t column; size_t column;
uint32_t fg_color; uint32_t fg_color;
uint32_t bg_color; uint32_t bg_color;
uint16_t buffer[VGA_WIDTH * VGA_HEIGHT]; uint8_t buffer[VGA_WIDTH * VGA_HEIGHT];
uint32_t default_color; uint32_t default_color;
struct icon *background; struct icon *background;
struct font *font; struct font *font;

View File

@ -42,8 +42,8 @@ void terminal_remove_last_char(void)
screen->column = VGA_WIDTH - 1; screen->column = VGA_WIDTH - 1;
screen->row--; screen->row--;
} }
uint32_t pos_x = (screen->column) * FONT_SIZE; uint32_t pos_x = (screen->column) * FONT_WIDTH;
uint32_t pos_y = screen->row * FONT_SIZE; uint32_t pos_y = screen->row * FONT_HEIGHT;
struct font node = get_font_node( struct font node = get_font_node(
screen->buffer[screen->row * VGA_WIDTH + screen->column]); screen->buffer[screen->row * VGA_WIDTH + screen->column]);
@ -112,7 +112,8 @@ void terminal_putentryat(struct font node, uint32_t fg_color, uint32_t bg_color,
for (size_t cy = 0; cy < node.height; cy++) { for (size_t cy = 0; cy < node.height; cy++) {
for (size_t cx = 0; cx < node.width; cx++) { for (size_t cx = 0; cx < node.width; cx++) {
if (glyph[cy * node.width + cx] == '#') if (glyph[cy * node.width + cx] == '#')
put_pixel(fg_color, x + cx, y + cy); put_pixel(fg_color, x + cx,
y + cy + node.yoffset);
} }
} }
} }
@ -127,8 +128,8 @@ static void terminal_scroll(void)
screen->row--; screen->row--;
memset(display.buff, 0, display.height * display.pitch); memset(display.buff, 0, display.height * display.pitch);
for (size_t i = 0; i < VGA_WIDTH * (VGA_HEIGHT - 1); i++) { for (size_t i = 0; i < VGA_WIDTH * (VGA_HEIGHT - 1); i++) {
const uint32_t x = (i % VGA_WIDTH) * FONT_SIZE; const uint32_t x = (i % VGA_WIDTH) * FONT_WIDTH;
const uint32_t y = (i / VGA_WIDTH) * FONT_SIZE; const uint32_t y = (i / VGA_WIDTH) * FONT_HEIGHT;
screen->buffer[i] = screen->buffer[i + VGA_WIDTH]; screen->buffer[i] = screen->buffer[i + VGA_WIDTH];
terminal_putentryat(get_font_node(screen->buffer[i]), terminal_putentryat(get_font_node(screen->buffer[i]),
screen->fg_color, screen->bg_color, x, y); screen->fg_color, screen->bg_color, x, y);
@ -138,7 +139,7 @@ static void terminal_scroll(void)
static void terminal_new_line(void) static void terminal_new_line(void)
{ {
screen->column = 0; screen->column = 0;
if (++screen->row == VGA_HEIGHT - 1) if (++screen->row >= VGA_HEIGHT - 1)
terminal_scroll(); terminal_scroll();
} }
@ -203,9 +204,9 @@ int terminal_putchar(char c)
return 1; return 1;
screen->buffer[screen->column + screen->row * VGA_WIDTH] = c; screen->buffer[screen->column + screen->row * VGA_WIDTH] = c;
terminal_putentryat(get_font_node(c), screen->fg_color, terminal_putentryat(get_font_node(c), screen->fg_color,
screen->bg_color, screen->column * FONT_SIZE, screen->bg_color, screen->column * FONT_WIDTH,
screen->row * FONT_SIZE); screen->row * FONT_HEIGHT);
if (++screen->column == VGA_WIDTH) if (++screen->column >= VGA_WIDTH)
terminal_new_line(); terminal_new_line();
return 1; return 1;
} }

View File

@ -13,7 +13,8 @@ with open(sys.argv[1]) as f:
font_name: str = os.path.basename(sys.argv[1]).split(".")[0] font_name: str = os.path.basename(sys.argv[1]).split(".")[0]
img_file_relative_path: str = re.findall(r"file=\"(\w+[^\"]+)\"", fnt_data)[0] img_file_relative_path: str = re.findall(r"file=\"(\w+[^\"]+)\"", fnt_data)[0]
img_file_absolute_path: str = sys.argv[1][0:sys.argv[1].rfind("/") + 1] + img_file_relative_path img_file_absolute_path: str = sys.argv[1][0:sys.argv[1].rfind("/") +
1] + img_file_relative_path
image = Image.open(img_file_absolute_path) image = Image.open(img_file_absolute_path)
@ -23,15 +24,18 @@ pixels = [pixels[i * width:(i + 1) * width] for i in range(height)]
characteres: list[list[int]] = [None for i in range(128)] characteres: list[list[int]] = [None for i in range(128)]
for id, x, y, width, height, xoffset, yoffset, xadvance in re.findall(r"id=(\d+) x=(\d+) y=(\d+) width=(\d+) height=(\d+) xoffset=(-?\d+) yoffset=(-?\d+) xadvance=(\d+)", fnt_data): for id, x, y, width, height, xoffset, yoffset, xadvance in re.findall(
id, x, y, width, height, xoffset, yoffset, xadvance = int(id), int(x), int(y), int(width), int(height), int(xoffset), int(yoffset), int(xadvance) r"id=(\d+) x=(\d+) y=(\d+) width=(\d+) height=(\d+) xoffset=(-?\d+) yoffset=(-?\d+) xadvance=(\d+)",
fnt_data):
id, x, y, width, height, xoffset, yoffset, xadvance = int(id), int(x), int(
y), int(width), int(height), int(xoffset), int(yoffset), int(xadvance)
bitmap: list[str] = [] bitmap: list[str] = []
for line in pixels[y:y + height]: for line in pixels[y:y + height]:
tmp: str = "" tmp: str = ""
for r,g,b,a in line[x:x + width]: for r, g, b, a in line[x:x + width]:
tmp += "#" if a else " " tmp += "#" if a else " "
bitmap.append(tmp) bitmap.append(tmp)
characteres[id] = [height, width, bitmap] characteres[id] = [height, width, yoffset, bitmap]
string: str = f"""\ string: str = f"""\
#pragma once #pragma once
@ -45,11 +49,12 @@ struct font {font_name}_font[] = {{\\\
for charactere in characteres: for charactere in characteres:
if (charactere is not None): if (charactere is not None):
height, width, bitmap = charactere height, width, yoffset, bitmap = charactere
string += f""" string += f"""
{{ {{
.width = {width}, .width = {width},
.height = {height}, .height = {height},
.yoffset = {yoffset},
.bitmap = "{"".join(bitmap)}", .bitmap = "{"".join(bitmap)}",
}},\ }},\
""" """
@ -58,6 +63,7 @@ for charactere in characteres:
{{ {{
.width = 0, .width = 0,
.height = 0, .height = 0,
.yoffset = 0,
.bitmap = NULL, .bitmap = NULL,
}},\ }},\
""" """