diff options
author | Harley Acheson <harley.acheson@gmail.com> | 2022-07-29 03:50:34 +0300 |
---|---|---|
committer | Harley Acheson <harley.acheson@gmail.com> | 2022-07-29 03:50:34 +0300 |
commit | c0845abd897ffd547cd0ac226da99318d5c2fb30 (patch) | |
tree | 5ea21bfe09e2bac350225ecec47c77427957f3ce /source/blender/blenfont/intern/blf_glyph.c | |
parent | 848dd4a40afed8874abfb499100f09ff291ce14e (diff) |
BLF: Fonts with FT_Face Optional
Allow FontBLFs to exist with NULL FT_Face, added only when actually
needed. Speeds up startup and unused fonts are not loaded.
See D15258 for more details.
Differential Revision: https://developer.blender.org/D15258
Reviewed by Brecht Van Lommel
Diffstat (limited to 'source/blender/blenfont/intern/blf_glyph.c')
-rw-r--r-- | source/blender/blenfont/intern/blf_glyph.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c index 215f79e6795..326cb2bcc27 100644 --- a/source/blender/blenfont/intern/blf_glyph.c +++ b/source/blender/blenfont/intern/blf_glyph.c @@ -584,16 +584,18 @@ static FT_UInt blf_glyph_index_from_charcode(FontBLF **font, const uint charcode continue; } if (coverage_bit < 0 || blf_font_has_coverage_bit(f, coverage_bit)) { - glyph_index = FT_Get_Char_Index(f->face, charcode); - if (glyph_index) { - *font = f; - return glyph_index; + if (blf_ensure_face(f)) { + glyph_index = FT_Get_Char_Index(f->face, charcode); + if (glyph_index) { + *font = f; + return glyph_index; + } } } } /* Not found in the stack, return from Last Resort if there is one. */ - if (last_resort) { + if (last_resort && blf_ensure_face(last_resort)) { glyph_index = FT_Get_Char_Index(last_resort->face, charcode); if (glyph_index) { *font = last_resort; |