summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/font.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/firmware/font.c b/firmware/font.c
index e6f90e4..a8d8786 100644
--- a/firmware/font.c
+++ b/firmware/font.c
@@ -550,7 +550,14 @@ int font_load_ex(const char *path, size_t buffer_size)
}
int font_load(const char *path)
{
- return font_load_ex(path, MAX_FONT_SIZE);
+ int size;
+ int fd = open( path, O_RDONLY );
+ if ( fd < 0 )
+ return -1;
+ size = filesize(fd);
+ if (size > MAX_FONT_SIZE)
+ size = MAX_FONT_SIZE;
+ return font_load_ex(path, size);
}
void font_unload(int font_id)