Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarley Acheson <harley.acheson@gmail.com>2022-08-16 22:43:10 +0300
committerHarley Acheson <harley.acheson@gmail.com>2022-08-16 22:43:10 +0300
commit09640ab2919c17f24e14c8d71fafdb15c4748395 (patch)
tree3f4be2f62f470d9a72d61c03a05eccb3df461668 /source/blender/blenfont
parentccf31810d666c85b4c82fef090bfd08cd2402726 (diff)
Fix T99872: Crash Loading Embedded Fonts - Master
Commit rBc0845abd897f to 3.4 (master) uses font's filepath without checking if it exists, therefore crashing on embedded fonts since they do not have a filepath (loaded from memory). See D15703 for more details Differential Revision: https://developer.blender.org/D15703 Reviewed by Brecht Van Lommel
Diffstat (limited to 'source/blender/blenfont')
-rw-r--r--source/blender/blenfont/intern/blf_font.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c
index b3729b7a673..226752bffd8 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -1384,22 +1384,27 @@ static FontBLF *blf_font_new_ex(const char *name,
BLI_mutex_init(&font->glyph_cache_mutex);
- /* If we have static details about this font we don't need to load the Face. */
- const eFaceDetails *static_details = NULL;
- char filename[256];
- for (int i = 0; i < (int)ARRAY_SIZE(static_face_details); i++) {
- BLI_split_file_part(font->filepath, filename, sizeof(filename));
- if (STREQ(static_face_details[i].name, filename)) {
- static_details = &static_face_details[i];
- font->UnicodeRanges[0] = static_details->coverage1;
- font->UnicodeRanges[1] = static_details->coverage2;
- font->UnicodeRanges[2] = static_details->coverage3;
- font->UnicodeRanges[3] = static_details->coverage4;
- break;
+ /* If we have static details about this font file, we don't have to load the Face yet. */
+ bool face_needed = true;
+
+ if (font->filepath) {
+ const eFaceDetails *static_details = NULL;
+ char filename[256];
+ for (int i = 0; i < (int)ARRAY_SIZE(static_face_details); i++) {
+ BLI_split_file_part(font->filepath, filename, sizeof(filename));
+ if (STREQ(static_face_details[i].name, filename)) {
+ static_details = &static_face_details[i];
+ font->UnicodeRanges[0] = static_details->coverage1;
+ font->UnicodeRanges[1] = static_details->coverage2;
+ font->UnicodeRanges[2] = static_details->coverage3;
+ font->UnicodeRanges[3] = static_details->coverage4;
+ face_needed = false;
+ break;
+ }
}
}
- if (!static_details) {
+ if (face_needed) {
if (!blf_ensure_face(font)) {
blf_font_free(font);
return NULL;