text-freetype2: Make font lookup recursive on mac

On macs, some fonts can be in sub-folders of the font folder, and may
not properly be found.  This fixes that to detect directories and make
the lookup recursive.
This commit is contained in:
jp9000 2017-05-05 22:43:57 -07:00
parent a23c009a69
commit e04ab3da7f

View File

@ -32,7 +32,16 @@ static void add_path_fonts(NSFileManager *file_manager, NSString *path)
for (NSString *file in files) {
NSString *full_path = [path stringByAppendingPathComponent:file];
add_path_font(full_path.fileSystemRepresentation);
BOOL is_dir = FALSE;
bool folder_exists = [file_manager
fileExistsAtPath:full_path
isDirectory:&is_dir];
if (folder_exists && is_dir) {
add_path_fonts(file_manager, full_path);
} else {
add_path_font(full_path.fileSystemRepresentation);
}
}
}