text-freetype2: Cache data to reduce load time

This caches the font list data to a file to minimize load times.  Font
data will be refreshed when any font files are added/removed, based upon
a checksum of the font file names and dates (if available).
This commit is contained in:
jp9000
2015-10-04 03:30:20 -07:00
parent f29ac7770c
commit e91f5384b4
6 changed files with 321 additions and 16 deletions

View File

@@ -9,19 +9,19 @@
#include <util/darray.h>
struct font_path_info {
char *face_and_style;
size_t full_len;
size_t face_len;
char *face_and_style;
uint32_t full_len;
uint32_t face_len;
bool is_bitmap;
size_t num_sizes;
int *sizes;
bool is_bitmap;
uint32_t num_sizes;
int *sizes;
bool bold;
bool italic;
bool bold;
bool italic;
char *path;
FT_Long index;
char *path;
FT_Long index;
};
static inline void font_path_info_free(struct font_path_info *info)
@@ -34,6 +34,7 @@ static inline void font_path_info_free(struct font_path_info *info)
extern void build_font_path_info(FT_Face face, FT_Long idx, const char *path);
extern char *sfnt_name_to_utf8(FT_SfntName *sfnt_name);
extern bool load_cached_os_font_list(void);
extern void load_os_font_list(void);
extern void free_os_font_list(void);
extern const char *get_font_path(const char *family, uint16_t size,