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.
This commit is contained in:
Bastien Montagne 2020-12-15 18:18:53 +01:00
parent c6692014cf
commit b24712a9ca
Notes: blender-bot 2024-04-29 13:07:32 +02:00
Referenced by commit 0b6be26126, BLF: remove checks for blend file relative paths
1 changed files with 8 additions and 3 deletions

View File

@ -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);
}
}