Fontcase

Fontcase

Elegant font management for Mac OS X

Version 1.5.3

OS X 10.5+ Required

Plugins

You can take a look at these samples if you're interested in developing your own plug-ins. These plug-ins can be downloaded, both the source and the working version.

New Collection from Selection

This is a very basic action; it takes the current selection and puts that in a new collection. The code is also very simple. Basically you need two lines of code for the real work. Note the use of createEntity:withUniqueValueForKey:defaultValue:. This is one of the methods declared in Fontcase and it works very nice; it starts out with the name 'New Collection', but if there already is Collection with that name, it will take 'New Collection 1', 'New Collection 2', until it finds a name not yet taken.

@implementation FCCollectionFromSelection
- (NSString *)displayName
{
  return @"New Collection from Selection";
}

- (IBAction)performActionOnFonts:(NSArray *)variations
                         context:(NSManagedObjectContext *)context
{
  NSManagedObject *collection =
        [context createEntity:@"Collection"
        withUniqueValueForKey:@"name"
                 defaultValue:@"New Collection"];
  
  [[collection mutableSetValueForKey:@"variations"]
      addObjectsFromArray:variations];
  [self sendUpdate];
}

- (NSString *)keyEquivalent
{
  return @"N";
}

- (NSInteger)keyEquivalentModifierMask
{
  return NSAlternateKeyMask | NSCommandKeyMask | NSShiftKeyMask;
}
@end

Download the source file here: collectionfromselection.zip

Clear Cache for Selection

This action clears the cache and tells the grid to reload again. The Variation-entity implements the IKImageBrowserItem protocol and these methods are declared in FCVariation to clear the cache programatically:

@implementation FCClearCache
- (NSString *)displayName
{
  return @"Clear Cache for Selection";
}

- (IBAction)performActionOnFonts:(NSArray *)variations
                         context:(NSManagedObjectContext *)context
{
  for (NSManagedObject *var in variations) {
    [var clearCache];
    [var updateVersion];
  }
  [self sendUpdate];
}

@end

Download the source file here: clearcache.zip