From 3c42691e1b2d859d9266e088cc3d76b2c1cb9aaf Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Thu, 17 Oct 2019 17:53:03 +0200 Subject: font: load fallback fonts on demand When instantiating a primary font, build the fallback font list, but don't actually instantiate the fallback fonts. Instead, remember the (full) pattern that we should use if/when we instantiate it. Then, when looking up a glyph and we need a fallback font, loop the list and instantiate the font(s) there and then. --- font.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'font.h') diff --git a/font.h b/font.h index 3bd10129..9eebd0a9 100644 --- a/font.h +++ b/font.h @@ -29,6 +29,11 @@ struct glyph { typedef tll(struct glyph) hash_entry_t; +struct font_fallback { + char *pattern; + struct font *font; +}; + struct font { char *name; @@ -52,7 +57,7 @@ struct font { } strikeout; bool is_fallback; - tll(struct font *) fallbacks; + tll(struct font_fallback) fallbacks; size_t ref_counter; -- cgit v1.3