Plugins
For convenience, the database scheme and headers of the frameworks are printed here.
The headers are also included in the Fontcase Framework.
Fontcase' Data Structure
The central class or entity in Fontcase is a Variation. The schema below should make the structure clear for those who are familiar with CoreData:
As you can see, the central component of the entire system is the 'Variation'-entity. You should also note that apart from the name, there's basically no difference between a tag, a designer or a collection, which makes it possible for Fontcase to be incredibly flexible.
Basically everything you need is in this schema, and you can use key-value-coding to change any of these properties. However also included in the plugin-framework is the header file of class that is used internally to represent a variations which supports a few more actions like activating and loading fonts.
Convenience Methods
While you can use NSEntityDescription to insert new entities, we advice you to use the methods we declared as a category on NSManagedObjectContext because they provide extra functionality and give you a lot of nice things for free. This header is also included in the framework and is also printed below:
@interface NSManagedObjectContext (CDManagedObjectContextExtensions)
- (BOOL)entityWithNameExists:(NSString*)entityName
whereKey:(NSString*)key
like:(NSString*)value;
- (id)entityWithName:(NSString*)entityName
whereKey:(NSString*)key
like:(NSString*)value;
- (id)retrieveOrCreateEntityWithName:(NSString*)entityName
whereKey:(NSString*)key
like:(NSString*)value;
- (id)createEntity:(NSString*)entityName
withUniqueValueForKey:(NSString*)key
defaultValue:(NSString*)def;
- (id)createEntity:(NSString*)entityName
whereKey:(NSString*)key
like:(NSString*)value;
- (int)numberOfEntitiesWithName:(NSString*)entityName;
- (int)numberOfEntitiesWithName:(NSString*)entityName
where:(NSString*)key
like:(NSString*)value;
- (NSArray*)entitiesWithName:(NSString*)entityName;
- (NSArray*)entitiesWithName:(NSString*)entityName
where:(NSString*)key
like:(NSString*)value;
- (BOOL)deleteEntitiesWithName:(NSString*)entityName
withEmptyRelationshipForKey:(NSString*)key;
@end
Variation header file
Below you'll find the complete interface-file for the Variations entity. It may seem a lot but look at it from the upside; you won't need anything, but if you need something special, it's there.
@interface FCVariation : NSManagedObject
{
}
@property (retain) NSString *copyright, *familyName, *generator;
@property (retain) NSString *kind, *postscriptName;
@property (retain) NSString *location, *name, *notes, *price;
@property (retain) NSString *specimen, *supportFile, *version;
@property (retain) NSNumber *fixedWidth, *rating, numberOfActivations;
@property (retain) NSDate *lastActivationDate, *importDate;
@property (retain) NSManagedObject * foundry;
@property (retain) NSSet *genres, *tags, *designers, *collections;
- (NSString *)displayName;
- (NSString *)fullLocation;
- (NSString *)fullSupportFileLocation;
- (NSArray *)copyToFolder:(NSString *)folderPath;
- (BOOL)isSystemFont;
@end
@interface FCVariation (AccessorsStringAccess)
@property (retain) NSString *foundryName;
//separated by comma's, note the setter works as well
@property (retain) NSString *designerNames;
@property (retain) NSString *tagNames;
@property (retain) NSString *genreNames;
- (int)numberOfTags;
- (int)numberOfGenres;
- (int)numberOfCollections;
- (NSString *)isSystemFontTitle;
- (NSString *)hasSpecimenTitle;
@end
@interface FCVariation (FCSpecimenExtensions)
- (void)openSpecimen;
- (void)deleteSpecimen;
- (void)addSpecimen:(NSString *)filename;
@end
@interface FCVariation (CoreDataGeneratedAccessors)
- (void)addCollectionsObject:(NSManagedObject *)value;
- (void)removeCollectionsObject:(NSManagedObject *)value;
- (void)addCollections:(NSSet *)value;
- (void)removeCollections:(NSSet *)value;
- (void)addDesignersObject:(NSManagedObject *)value;
- (void)removeDesignersObject:(NSManagedObject *)value;
- (void)addDesigners:(NSSet *)value;
- (void)removeDesigners:(NSSet *)value;
- (void)addGenresObject:(NSManagedObject *)value;
- (void)removeGenresObject:(NSManagedObject *)value;
- (void)addGenres:(NSSet *)value;
- (void)removeGenres:(NSSet *)value;
- (void)addTagsObject:(NSManagedObject *)value;
- (void)removeTagsObject:(NSManagedObject *)value;
- (void)addTags:(NSSet *)value;
- (void)removeTags:(NSSet *)value;
@end
@interface NSObject (QueryExtensions)
- (BOOL)isVariation;
- (BOOL)isLibrary;
- (BOOL)isSmartCollection;
@end
@interface NSManagedObject (NSManagedObjectCompare)
- (NSComparisonResult)caseInsensitiveCompare:(id)other; //by 'name'
@end
@interface FCVariation (VariationsActivationExtensions)
- (BOOL)isLoaded;
- (void)load;
- (BOOL)isActivated;
- (void)setIsActivated:(BOOL)flag;
- (void)activate;
- (BOOL)deactivate;
- (NSFont *)asFontWithSize:(CGFloat)size;
@end