From 3a3602861226e995d95a8898668cd559c3ca1cf6 Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Wed, 17 Feb 2021 16:35:02 -0500 Subject: quick bitmap font format, borrowing new default font from X --- src/user/libfont/bdf.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'src/user/libfont/bdf.c') diff --git a/src/user/libfont/bdf.c b/src/user/libfont/bdf.c index 2c19a15..de5489d 100644 --- a/src/user/libfont/bdf.c +++ b/src/user/libfont/bdf.c @@ -17,16 +17,10 @@ static inline uint8_t hex_to_n(char ch) { } //very minimal implementation -bool try_load_bdf(const char *path, struct font_info *into) { - struct file *f = open_file(path); - if (!f) - PANIC("Can't open font file sent by get_font."); - +bool try_load_bdf(struct file *f, struct font_info *into) { read_line_from_file(f, line_buf, LINE_BUF_SIZE - 1); - if (!strequ(line_buf, "STARTFONT 2.1")) { - close_file(f); + if (!strequ(line_buf, "STARTFONT 2.1")) return false; - } for (uint16_t i = 0; i < 256; ++i) into->bitmaps[i] = 0; @@ -71,9 +65,6 @@ bool try_load_bdf(const char *path, struct font_info *into) { } } - close_file(f); - f = 0; - if ((into->char_height == -1) || (into->char_width == -1) || (into->space_height == -1) || @@ -90,8 +81,6 @@ bool try_load_bdf(const char *path, struct font_info *into) { return true; bad_format: - if (f) - close_file(f); for (uint16_t i = 0; i < 256; ++i) if (into->bitmaps[i]) free_block(into->bitmaps[i]); -- cgit v1.2.3