diff options
Diffstat (limited to 'src/user/libfont/bdf.c')
-rw-r--r-- | src/user/libfont/bdf.c | 15 |
1 files changed, 2 insertions, 13 deletions
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]); |