From b24712a9ca6fa807660a02d6988269748daecdbf Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Tue, 15 Dec 2020 18:18:53 +0100 Subject: 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. --- source/blender/blenfont/intern/blf_dir.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'source/blender/blenfont') 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); } } -- cgit v1.2.3