diff options
author | Harley Acheson <harley.acheson@gmail.com> | 2022-06-17 20:30:34 +0300 |
---|---|---|
committer | Harley Acheson <harley.acheson@gmail.com> | 2022-06-17 20:31:48 +0300 |
commit | 524a9e3db8102c89abf3b80cddaea60c314d67ae (patch) | |
tree | eae881aad7e3b114dbdfb5cbac183355a38b5d06 /source/blender/editors/interface/interface_style.cc | |
parent | 5485057a27b92400ddc57dfb67c1017f26fefad8 (diff) |
BLF: Fallback Font Stack
Allow use of multiple fonts acting together like a fallback stack,
where if a glyph is not found in one it can be retrieved from another.
See D12622 for much more detail
Differential Revision: https://developer.blender.org/D12622
Reviewed by Brecht Van Lommel
Diffstat (limited to 'source/blender/editors/interface/interface_style.cc')
-rw-r--r-- | source/blender/editors/interface/interface_style.cc | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/source/blender/editors/interface/interface_style.cc b/source/blender/editors/interface/interface_style.cc index 291ede05730..904765f6dc4 100644 --- a/source/blender/editors/interface/interface_style.cc +++ b/source/blender/editors/interface/interface_style.cc @@ -382,19 +382,8 @@ void uiStyleInit(void) } CLAMP(U.dpi, 48, 144); - LISTBASE_FOREACH (uiFont *, font, &U.uifonts) { - BLF_unload_id(font->blf_id); - } - - if (blf_mono_font != -1) { - BLF_unload_id(blf_mono_font); - blf_mono_font = -1; - } - - if (blf_mono_font_render != -1) { - BLF_unload_id(blf_mono_font_render); - blf_mono_font_render = -1; - } + /* Needed so that custom fonts are always first. */ + BLF_unload_all(); uiFont *font_first = static_cast<uiFont *>(U.uifonts.first); @@ -498,6 +487,9 @@ void uiStyleInit(void) const bool unique = true; blf_mono_font_render = BLF_load_mono_default(unique); } + + /* Load the fallback fonts last. */ + BLF_load_font_stack(); } void UI_fontstyle_set(const uiFontStyle *fs) |