BLF: Enable Filtering of woff and woff2 Fonts

Add files with extension ".woff" and ".woff2" to FILE_TYPE_FTFONT
file type. Allows selecting and using these types of font files.

See D13822 for more details.

Differential Revision: https://developer.blender.org/D13822

Reviewed by Campbell Barton
This commit is contained in:
Harley Acheson 2022-02-08 08:43:01 -08:00
parent 5d9d2565d2
commit 55c90df316
2 changed files with 8 additions and 1 deletions

View File

@ -1238,6 +1238,12 @@ FontBLF *blf_font_new(const char *name, const char *filename)
font = (FontBLF *)MEM_callocN(sizeof(FontBLF), "blf_font_new");
err = FT_New_Face(ft_lib, filename, 0, &font->face);
if (err) {
if (ELEM(err, FT_Err_Unknown_File_Format, FT_Err_Unimplemented_Feature)) {
printf("Format of this font file is not supported\n");
}
else {
printf("Error encountered while opening font file\n");
}
MEM_freeN(font);
return NULL;
}

View File

@ -2783,7 +2783,8 @@ int ED_path_extension_type(const char *path)
NULL)) {
return FILE_TYPE_TEXT;
}
if (BLI_path_extension_check_n(path, ".ttf", ".ttc", ".pfb", ".otf", ".otc", NULL)) {
if (BLI_path_extension_check_n(
path, ".ttf", ".ttc", ".pfb", ".otf", ".otc", ".woff", ".woff2", NULL)) {
return FILE_TYPE_FTFONT;
}
if (BLI_path_extension_check(path, ".btx")) {