diff options
author | Benji Dial <benji6283@gmail.com> | 2021-02-17 16:35:02 -0500 |
---|---|---|
committer | Benji Dial <benji6283@gmail.com> | 2021-02-17 16:35:02 -0500 |
commit | 3a3602861226e995d95a8898668cd559c3ca1cf6 (patch) | |
tree | 0d5bc0494297a12e9ccb76b31cb365c843216735 /src/user/libfont/bdf.c | |
parent | 49d76d30a55707e2bf95fd9ba03296489fac8d1d (diff) | |
download | portland-os-3a3602861226e995d95a8898668cd559c3ca1cf6.tar.gz |
quick bitmap font format, borrowing new default font from X
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]); |