Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

removed disabled caching

  • Loading branch information...
commit f4c4ff62e3c85413b01a27b51d4973e12460d73b 1 parent 3afbafa
@Cocoanetics authored
Showing with 13 additions and 27 deletions.
  1. +13 −27 Core/Source/DTCoreTextFontCollection.m
View
40 Core/Source/DTCoreTextFontCollection.m
@@ -99,42 +99,28 @@ - (NSArray *)fontDescriptors
{
if (!_fontDescriptors)
{
- // try caches
+ CTFontCollectionRef fonts = CTFontCollectionCreateFromAvailableFonts(NULL);
- NSString *cachesPath = [[NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:@"FontDescriptors.cache"];
+ CFArrayRef matchingFonts = CTFontCollectionCreateMatchingFontDescriptors(fonts);
- self.fontDescriptors = nil;//[NSKeyedUnarchiver unarchiveObjectWithFile:cachesPath];
-
- if (!_fontDescriptors)
+ if (matchingFonts)
{
- CTFontCollectionRef fonts = CTFontCollectionCreateFromAvailableFonts(NULL);
-
- CFArrayRef matchingFonts = CTFontCollectionCreateMatchingFontDescriptors(fonts);
+ // convert all to our objects
+ NSMutableArray *tmpArray = [[NSMutableArray alloc] init];
- if (matchingFonts)
+ for (NSInteger i=0; i<CFArrayGetCount(matchingFonts); i++)
{
-
- // convert all to our objects
- NSMutableArray *tmpArray = [[NSMutableArray alloc] init];
-
- for (NSInteger i=0; i<CFArrayGetCount(matchingFonts); i++)
- {
- CTFontDescriptorRef fontDesc = CFArrayGetValueAtIndex(matchingFonts, i);
-
-
- DTCoreTextFontDescriptor *desc = [[DTCoreTextFontDescriptor alloc] initWithCTFontDescriptor:fontDesc];
- [tmpArray addObject:desc];
- }
+ CTFontDescriptorRef fontDesc = CFArrayGetValueAtIndex(matchingFonts, i);
- CFRelease(matchingFonts);
-
- self.fontDescriptors = tmpArray;
+ DTCoreTextFontDescriptor *desc = [[DTCoreTextFontDescriptor alloc] initWithCTFontDescriptor:fontDesc];
+ [tmpArray addObject:desc];
}
+
+ CFRelease(matchingFonts);
+
+ self.fontDescriptors = tmpArray;
}
-
- // cache that
- [NSKeyedArchiver archiveRootObject:self.fontDescriptors toFile:cachesPath];
}
return _fontDescriptors;
Please sign in to comment.
Something went wrong with that request. Please try again.