[fb] Add default hard-coded font

For the fb driver to have a font before loading from disk is available,
create a hard-coded font as a byte array.

To create this, added a new scripts/psf_to_cpp.py which also refactored
out much of scripts/parse_font.py into a new shared module
scripts/fontpsf.py.
This commit is contained in:
Justin C. Miller
2021-01-02 15:52:26 -08:00
parent 7ca3a19eed
commit 6af29a7181
5 changed files with 387 additions and 25 deletions

View File

@@ -8,6 +8,8 @@
#include <j6libc/syscalls.h>
#include "font.h"
extern "C" {
int main(int, const char **);
void _get_init(size_t *initc, struct j6_init_value **initv);
@@ -33,6 +35,14 @@ main(int argc, const char **argv)
if (!fb)
return 1;
size_t font_size = sizeof(font_glyph_data);
if (font_size != (font_glyph_size*font_glyph_count)) {
_syscall_system_log("fb driver has wrong font data, exiting");
return 1;
}
volatile uint8_t const * p = font_glyph_data;
uint32_t *fbp = reinterpret_cast<uint32_t*>(fb->addr);
size_t size = fb->size;
for (size_t i=0; i < size/4; ++i) {