فهرست منبع

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.
jp9000 8 سال پیش
والد
کامیت
e04ab3da7f
1فایلهای تغییر یافته به همراه10 افزوده شده و 1 حذف شده
  1. 10 1
      plugins/text-freetype2/find-font-cocoa.m

+ 10 - 1
plugins/text-freetype2/find-font-cocoa.m

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