summaryrefslogtreecommitdiff
path: root/src/user/libfont/fonts.c
diff options
context:
space:
mode:
authorBenji Dial <benji6283@gmail.com>2021-02-17 16:35:02 -0500
committerBenji Dial <benji6283@gmail.com>2021-02-17 16:35:02 -0500
commit3a3602861226e995d95a8898668cd559c3ca1cf6 (patch)
tree0d5bc0494297a12e9ccb76b31cb365c843216735 /src/user/libfont/fonts.c
parent49d76d30a55707e2bf95fd9ba03296489fac8d1d (diff)
downloadportland-os-3a3602861226e995d95a8898668cd559c3ca1cf6.tar.gz
quick bitmap font format, borrowing new default font from X
Diffstat (limited to 'src/user/libfont/fonts.c')
-rw-r--r--src/user/libfont/fonts.c21
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;