Plugins
This document will explain how Fontcase is structured and what tools you can use to interact with Fontcase' data. And what's more, you can get a free license key to Fontcase if you write a plug-in.
Writing plug-ins for Fontcase
Fontcase can be extended with user-written plug-ins very easily. Plugins need to be written in Cocoa and are intended to act upon the current selection (although they could do significantly more if you wish to). Every plug-in is intended to perform one action which can be invoked through the Fonts or Tools menu:

Cocoa and other Frameworks
As noted above, plug-ins need to be written in Cocoa so you should at least be familiar with it. Also, Fontcase uses Apple's robust Core Data-framework to manage the data and any plug-in will have to deal with this, so familiarity with this would also be a helpful. Note that a Fontcase plug-in gives you a lot of power so if you don't know what you're doing, you might end up corrupting the users' database. That said, Fontcase provides a few helper methods which should make interacting with the data peanuts.
Tutorial: Creating a basic Plug-in
You need to have Xcode Tools installed and you should be familiar with them, or this will probably go too fast for you.
- Start out with a new project and chooose Bundle -> Cocoa Bundle.
- Import the FontcasePluginKit-framework but do not copy the items to the destination folder
- Then create a new class, import the FontcasePluginKit and make it a subclass of FCActionPlugin:
#import <Cocoa/Cocoa.h>
#import <FontcasePluginKit/FontcasePluginKit.h>
@interface SomePlugin : FCActionPlugin
{
}
@end
Go to the implementation file and overwrite (some of) these methods:
- (NSString *)displayName;
- (NSString *)keyEquivalent;
- (NSString *)keyEquivalentModifierMask;
- (int)displayMenuPosition;
- (IBAction)performActionOnFonts:(NSArray *)variations
context:(NSManagedObjectContext *)context;
- If you want to provide a shortcut for your action, overwrite keyEquivalent and keyEquivalentModifierMask but if not, you don't have to overwrite these methods.
- The
performActionOnFonts:contextwill be called whenever a user clicks your menu-item. The variations-argument are the variations the user had selected when they clicked your action and the context-argument is the centralmanagedObjectContextyou can use to add new entities such as tags, designers, collections and foundries. Fontcase declares a very handy category onNSManagedObjectContextso that might be handy for you. Take a look at the Adding new entities-page for the header. - If you're making big changes, you might want to update the interface. You can call the
-sendUpdatemethod ofFCActionPlugin. - If you want your plugin to appear in the 'Tools' menu instead of the 'Fonts' menu, overwrite
- (int)displayMenuPositionand returnFCDisplayInToolsMenuinstead. - If your plugin contains more than one class you'll have to provide a principal-class in the
info.plist - For Fontcase to recognise your plugin as a Fontcase-plugin,select the target in the sourcelist, press cmd+I, search for Extension and change the Wrapper Extension from bundle to fcplugin.