summaryrefslogtreecommitdiff
path: root/firmware/font.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/font.c')
-rw-r--r--firmware/font.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/firmware/font.c b/firmware/font.c
index 7dbc5a258a..e973108bca 100644
--- a/firmware/font.c
+++ b/firmware/font.c
@@ -632,10 +632,10 @@ void glyph_cache_save(struct font* pf)
632 return; 632 return;
633} 633}
634 634
635int get_glyph_size(const char *path) 635int font_glyphs_to_bufsize(const char *path, int glyphs)
636{ 636{
637 struct font f; 637 struct font f;
638 int overhead; 638 int bufsize;
639 char buf[FONT_HEADER_SIZE]; 639 char buf[FONT_HEADER_SIZE];
640 640
641 f.buffer_start = buf; 641 f.buffer_start = buf;
@@ -656,9 +656,13 @@ int get_glyph_size(const char *path)
656 } 656 }
657 close(f.fd); 657 close(f.fd);
658 658
659 overhead = LRU_SLOT_OVERHEAD + sizeof(struct font_cache_entry) + 659 bufsize = LRU_SLOT_OVERHEAD + sizeof(struct font_cache_entry) +
660 sizeof( unsigned short); 660 sizeof( unsigned short);
661 return overhead + (f.maxwidth * ((f.height + 7) / 8)); 661 bufsize += f.maxwidth * ((f.height + 7) / 8);
662 bufsize *= glyphs;
663 if ( bufsize < FONT_HEADER_SIZE )
664 bufsize = FONT_HEADER_SIZE;
665 return bufsize;
662} 666}
663 667
664static int ushortcmp(const void *a, const void *b) 668static int ushortcmp(const void *a, const void *b)