Commit: b24712a9ca6fa807660a02d6988269748daecdbf
Author: Bastien Montagne
Date: Tue Dec 15 18:18:53 2020 +0100
Branches: master
https://developer.blender.org/rBb24712a9ca6fa807660a02d6988269748daecdbf
Fix (studio-reported) broken handling of relative font paths.
`blf_dir_search` BLF util would not properly handle relative fonts not
found in pre-defined 'system fonts' directoriesi stored in
`global_font_dir` global variable.
Now it rebases relative paths to current .blend file location as
expected.
Note: the fact that VSE is setting font ptaths relative by default is
probably not actually desired, but this is another issue really. See
`BKE_sequencer_text_font_load` code.
===================================================================
M source/blender/blenfont/intern/blf_dir.c
===================================================================
diff --git a/source/blender/blenfont/intern/blf_dir.c
b/source/blender/blenfont/intern/blf_dir.c
index 51d3849aa48..25235097505 100644
--- a/source/blender/blenfont/intern/blf_dir.c
+++ b/source/blender/blenfont/intern/blf_dir.c
@@ -47,6 +47,9 @@
#include "blf_internal.h"
#include "blf_internal_types.h"
+#include "BKE_global.h"
+#include "BKE_main.h"
+
static ListBase global_font_dir = {NULL, NULL};
static DirBLF *blf_dir_find(const char *path)
@@ -137,9 +140,11 @@ char *blf_dir_search(const char *file)
}
if (!s) {
- /* check the current directory, why not ? */
- if (BLI_exists(file)) {
- s = BLI_strdup(file);
+ /* Assume file is either an abslute path, or a relative path to current
directory. */
+ BLI_strncpy(full_path, file, sizeof(full_path));
+ BLI_path_abs(full_path, BKE_main_blendfile_path(G_MAIN));
+ if (BLI_exists(full_path)) {
+ s = BLI_strdup(full_path);
}
}
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs