BLF: Fallback Stack Error Handling
Properly handle invalid fonts. See D15798 for more details Differential Revision: https://developer.blender.org/D15798 Reviewed by Brecht Van Lommel
This commit is contained in:
parent
627bd4c46a
commit
d81e947c59
|
@ -110,6 +110,10 @@ static FT_Error blf_cache_face_requester(FTC_FaceID faceID,
|
|||
font->face->generic.data = font;
|
||||
font->face->generic.finalizer = blf_face_finalizer;
|
||||
}
|
||||
else {
|
||||
/* Clear this on error to avoid exception in FTC_Manager_LookupFace. */
|
||||
*face = NULL;
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
|
|
@ -65,7 +65,9 @@ void BLF_load_font_stack()
|
|||
struct direntry *dir;
|
||||
uint num_files = BLI_filelist_dir_contents(path, &dir);
|
||||
for (int f = 0; f < num_files; f++) {
|
||||
if (!FILENAME_IS_CURRPAR(dir[f].relname) && !BLI_is_dir(dir[f].path)) {
|
||||
if (!BLI_is_dir(dir[f].path) &&
|
||||
BLI_path_extension_check_n(
|
||||
dir[f].path, ".ttf", ".ttc", ".otf", ".otc", ".woff", ".woff2", NULL)) {
|
||||
if (!BLF_is_loaded(dir[f].path)) {
|
||||
int font_id = BLF_load(dir[f].path);
|
||||
if (font_id == -1) {
|
||||
|
|
Loading…
Reference in New Issue