font: cache top-level fonts

This greatly improves the performance when loading user-configured
fallback fonts.

Previously, we had to re-load these fallback fonts over and over again
for each (new) glyph.
This commit is contained in:
Daniel Eklöf 2019-10-16 22:34:23 +02:00
parent bf5ad13df0
commit 04edd96018
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 65 additions and 2 deletions

2
font.h
View file

@ -52,6 +52,8 @@ struct font {
bool is_fallback;
tll(char *) fallbacks;
size_t ref_counter;
/* Fields below are only valid for non-fallback fonts */
FcPattern *fc_pattern;
FcFontSet *fc_fonts;