-
-
Save DmitrySeredinov/5533375 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CTFontManagerRegisterFontsForURLs((__bridge CFArrayRef)((^{ | |
NSFileManager *fileManager = [NSFileManager defaultManager]; | |
NSURL *resourceURL = [[NSBundle mainBundle] resourceURL]; | |
NSArray *resourceURLs = [fileManager contentsOfDirectoryAtURL:resourceURL includingPropertiesForKeys:nil options:0 error:nil]; | |
return [resourceURLs filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(NSURL *url, NSDictionary *bindings) { | |
CFStringRef pathExtension = (__bridge CFStringRef)[url pathExtension]; | |
NSArray *allIdentifiers = (__bridge_transfer NSArray *)UTTypeCreateAllIdentifiersForTag(kUTTagClassFilenameExtension, pathExtension, CFSTR("public.font")); | |
if (![allIdentifiers count]) { | |
return NO; | |
} | |
CFStringRef utType = (__bridge CFStringRef)[allIdentifiers lastObject]; | |
return (!CFStringHasPrefix(utType, CFSTR("dyn.")) && UTTypeConformsTo(utType, CFSTR("public.font"))); | |
}]]; | |
})()), kCTFontManagerScopeProcess, nil); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment