UI: disable TTC & OTC fonts in the file selector

These are not fully supported, users who load these will not be able
to access all the faces within the TTC/OTC.

Existing uses of TTC/OTC won't be blocked, these are just not shown as
supported fonts in the file selector. Addresses #44254.

Ref !121060
This commit is contained in:
Campbell Barton
2024-04-25 12:33:27 +10:00
parent 4d49c78e74
commit 43121bcb67
2 changed files with 5 additions and 6 deletions

View File

@@ -71,9 +71,7 @@ static void blf_load_datafiles_dir()
}
const char *filepath = file_list[i].path;
if (!BLI_path_extension_check_n(
filepath, ".ttf", ".ttc", ".otf", ".otc", ".woff", ".woff2", nullptr))
{
if (!BLI_path_extension_check_n(filepath, ".ttf", ".otf", ".woff", ".woff2", nullptr)) {
continue;
}
if (BLF_is_loaded(filepath)) {

View File

@@ -2694,9 +2694,10 @@ int ED_path_extension_type(const char *path)
{
return FILE_TYPE_TEXT;
}
if (BLI_path_extension_check_n(
path, ".ttf", ".ttc", ".pfb", ".otf", ".otc", ".woff", ".woff2", nullptr))
{
/* NOTE: While `.ttc` & `.otc` files can be loaded, only a single "face" is supported,
* users will have to extract bold/italic etc manually for Blender to use them, see #44254. */
if (BLI_path_extension_check_n(path, ".ttf", ".pfb", ".otf", ".woff", ".woff2", nullptr)) {
return FILE_TYPE_FTFONT;
}
if (BLI_path_extension_check(path, ".btx")) {