[Bf-blender-cvs] [55c90df316c] master: BLF: Enable Filtering of woff and woff2 Fonts
Harley Acheson
noreply at git.blender.org
Tue Feb 8 17:43:49 CET 2022
Commit: 55c90df316c7f5106b4ff97f1a6d6bcac3b195a3
Author: Harley Acheson
Date: Tue Feb 8 08:43:01 2022 -0800
Branches: master
https://developer.blender.org/rB55c90df316c7f5106b4ff97f1a6d6bcac3b195a3
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
===================================================================
M source/blender/blenfont/intern/blf_font.c
M source/blender/editors/space_file/filelist.c
===================================================================
diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c
index c1410447de6..3ac9fdc7f41 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -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;
}
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index 044d7aba88f..6be17bbd355 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -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")) {
More information about the Bf-blender-cvs
mailing list