diff options
Diffstat (limited to 'src/user/libfont/fonts.c')
-rw-r--r-- | src/user/libfont/fonts.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/user/libfont/fonts.c b/src/user/libfont/fonts.c index 1692992..c085604 100644 --- a/src/user/libfont/fonts.c +++ b/src/user/libfont/fonts.c @@ -6,14 +6,18 @@ #include "filist.h" #include "bdf.h" +#include "pbf.h" #define FONT_PATH "fonts/" #define FONT_PATH_L 6 struct font_loader_t { const char *ext; - bool (*func)(const char *, struct font_info *); + bool (*func)(struct file *f, struct font_info *); } font_loaders[] = { + { .ext = ".pbf", + .func = try_load_pbf + }, { .ext = ".bdf", .func = try_load_bdf }, @@ -36,20 +40,17 @@ struct font_info *get_font(const char *name) { blockcpy(buf + FONT_PATH_L, name, name_len); strcpy(buf + FONT_PATH_L + name_len, i->ext); struct file *f = open_file(buf); - if (!f) { - free_block(buf); + free_block(buf); + if (!f) continue; - } - syslogf("[libfont] Loading %s%s...", name, i->ext); - if (i->func(buf, font)) { + //syslogf("[libfont] Loading %s%s...", name, i->ext); + if (i->func(f, font)) { close_file(f); - free_block(buf); - syslogf("[libfont] Loaded %s%s.", name, i->ext); + //syslogf("[libfont] Loaded %s%s.", name, i->ext); return font; } close_file(f); - free_block(buf); - syslogf("[libfont] Failed to load %s%s.", name, i->ext); + //syslogf("[libfont] Failed to load %s%s.", name, i->ext); } del_last(); return 0; |