diff --git a/Cocoa/Categories/NGSCategories.h b/Cocoa/Categories/NGSCategories.h new file mode 100644 index 0000000..5fd05ea --- /dev/null +++ b/Cocoa/Categories/NGSCategories.h @@ -0,0 +1,171 @@ +#import + +@interface NSArray (NGSIndexExtensions) +/*! +@method subarrayWithIndicies: +@author Nicholas Shanks +@created January 2004 +@abstract Returns an immutable array of the objects at the given indicies. +*/ +- (NSArray *)subarrayWithIndicies:(NSIndexSet *)indicies; +@end + +@interface NSArray (NGSKeyValueExtensions) +/*! +@method indexOfFirstObjectReturningValue:forKey: +@author Nicholas Shanks +@created January 2003 +@discussion Calls valueForKey: on each object in the array, returning the index of the first one encountered which itself returned the value passed in, according to isEqual:, or returns NSNotFound if no object matched for the given key/value pair. Mostly useful just for increasing code readability, as the methd is only one line long, but one that's not easy to understand at first glance. +@change NGS 2005-02-23: Removed unnecessary code, indexOfObject: already returns NSNotFound for me. +*/ +- (int)indexOfFirstObjectReturningValue:(id)value forKey:(id)key; +/*! +@method firstObjectReturningValue:forKey: +@author Nicholas Shanks +@created January 2003 +@discussion Calls valueForKey: on each object in the array, returning the first one encountered which itself returned the value passed in, according to isEqual:. Returns nil if no matching object is found. +@change NGS 2005-02-23: Removed message to indexOfFirstObjectReturningValue:forKey:, incorperated that method's code into this one. +*/ +- (id)firstObjectReturningValue:(id)value forKey:(id)key; +/*! +@method objectsReturningValue:forKey: +@author Nicholas Shanks +@created January 2003 +@abstract Returns an array containing all objects in the receiver which have value set for key key. +@discussion Calls valueForKey: on each object in the array, returning a new array containing all objects which themselves returned the value passed in, according to isEqual:. If no objects matched, this method returns an empty array. +*/ +- (NSArray *)objectsReturningValue:(id)value forKey:(id)key; +- (NSArray *)arrayByMakingObjectsPerformSelector:(SEL)selector withObject:(id)inObject; +@end + +@interface NSCharacterSet (NGSNewlineExtensions) +#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4 +/*! +@method newlineCharacterSet +@author Nicholas Shanks +@created March 2005 +@abstract Returns a character set containing only the newline and nextline characters (U+000AÐU+000D, U+0085). +*/ ++ (NSCharacterSet *)newlineCharacterSet; +#endif +/*! +@method tabCharacterSet +@author Nicholas Shanks +@created March 2005 +@abstract Returns a character set containing only the horizontal and vertical tab characters (U+0009, U+000B). +*/ ++ (NSCharacterSet *)tabCharacterSet; +@end + +@interface NSIndexSet (NGSIndicies) ++ (id)indexSetWithIndiciesInRange:(NSRange)range; +- (id)initWithIndiciesInRange:(NSRange)range; +- (unsigned int)getIndicies:(unsigned int *)indexBuffer maxCount:(unsigned int)bufferSize inIndexRange:(NSRangePointer)range; +- (BOOL)containsIndiciesInRange:(NSRange)range; +- (BOOL)containsIndicies:(NSIndexSet *)indexSet; +- (BOOL)intersectsIndiciesInRange:(NSRange)range; +@end + +@interface NSMutableIndexSet (NGSIndicies) +- (void)addIndicies:(NSIndexSet *)indexSet; +- (void)removeIndicies:(NSIndexSet *)indexSet; +- (void)removeAllIndicies; +- (void)addIndiciesInRange:(NSRange)range; +- (void)removeIndiciesInRange:(NSRange)range; +- (void)shiftIndiciesStartingAtIndex:(unsigned int)index by:(int)delta; +@end + +@interface NSNumber (NGSRangeExtensions) +/*! +@method isWithinRange: +@author Nicholas Shanks +@created February 2003 +*/ +- (BOOL)isWithinRange:(NSRange)range; // location <= self <= location+length +/*! +@method isExclusivelyWithinRange: +@author Nicholas Shanks +@created February 2003 +*/ +- (BOOL)isExclusivelyWithinRange:(NSRange)range; // location < self < location+length +/*! +@method isBoundedByRange: +@author Nicholas Shanks +@created February 2003 +*/ +- (BOOL)isBoundedByRange:(NSRange)range; // location <= self < location+length +@end + +@interface NSString (NGSFSSpecExtensions) +/*! +@method createFSRef +@author Nicholas Shanks +@created November 2002 +@abstract Returns an FSRef for the absolute path represented by the receiver. The caller is responsible for disposing of the FSRef. +*/ +- (FSRef *)createFSRef; +/*! +@method createFSSpec +@author Nicholas Shanks +@created November 2002 +@abstract Returns an FSSpec for the absolute path represented by the receiver. The caller is responsible for disposing of the FSSpec. +*/ +- (FSSpec *)createFSSpec; +@end + +@interface NSString (NGSBooleanExtensions) +#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4 +/*! +@method boolValue +@author Nicholas Shanks +@created March 2001 +*/ +- (BOOL)boolValue; +#endif +/*! +@method stringWithBool: +@author Nicholas Shanks +@created March 2001 +*/ ++ (NSString *)stringWithBool:(BOOL)boolean; +@end + +#pragma mark - +#import + +@interface NSOutlineView (NGSSelectedItemExtensions) +/*! +@method selectedItem +@author Nicholas Shanks +@created September 2001 +*/ +- (id)selectedItem; +/*! +@method selectedItems +@author Nicholas Shanks +@created September 2001 +*/ +- (NSArray *)selectedItems; +@end + +/* +@interface NSGradient (NGSGradientExtensions) +/*! +@method aquaGradient +@method aquaGradientWithAlpha: +@method gradientWithAlpha: +@author Nicholas Shanks +@created May 2007 +* / ++ (NSGradient *)aquaGradient; ++ (NSGradient *)aquaGradientWithAlpha:(CGFloat)alpha; +- (NSGradient *)gradientWithAlpha:(CGFloat)alpha; +@end +*/ + +#pragma mark - +#import + +@interface NSOpenGLContext (CGLContextAccess) +- (CGLContextObj)cglContext; +@end \ No newline at end of file diff --git a/Cocoa/Categories/NGSCategories.m b/Cocoa/Categories/NGSCategories.m new file mode 100644 index 0000000..68eaffc --- /dev/null +++ b/Cocoa/Categories/NGSCategories.m @@ -0,0 +1,263 @@ +#import "NGSCategories.h" + +@implementation NSArray (NGSIndexExtensions) +- (NSArray *)subarrayWithIndicies:(NSIndexSet *)indicies +{ + NSRange range = {0,[self count]}; + unsigned int count = [indicies count]; + unsigned int *buffer = (unsigned int *) calloc(count, sizeof(int)); + NSMutableArray *newArray = [NSMutableArray arrayWithCapacity:count]; + [indicies getIndexes:buffer maxCount:count inIndexRange:&range]; + for(unsigned int i = 0; i < count; i++) + [newArray addObject:[self objectAtIndex:*(buffer+i)]]; + return [NSArray arrayWithArray:newArray]; +} +@end + +@implementation NSArray (NGSKeyValueExtensions) +- (int)indexOfFirstObjectReturningValue:(id)value forKey:(id)key +{ + return [[self valueForKey:key] indexOfObject:value]; +} +- (id)firstObjectReturningValue:(id)value forKey:(id)key +{ + int index = [[self valueForKey:key] indexOfObject:value]; + if(index != NSNotFound) + return [self objectAtIndex:index]; + else return nil; +} +- (NSArray *)objectsReturningValue:(id)value forKey:(id)key +{ + id object; + NSMutableArray *array = [NSMutableArray array]; + NSEnumerator *enumerator = [self objectEnumerator]; + while(object = [enumerator nextObject]) + if([[object valueForKey:key] isEqual:value]) + [array addObject:object]; + return [NSArray arrayWithArray:array]; +} +- (NSArray *)arrayByMakingObjectsPerformSelector:(SEL)selector withObject:(id)inObject +{ + id object; + NSMutableArray *array = [NSMutableArray array]; + NSEnumerator *enumerator = [self objectEnumerator]; + while(object = [enumerator nextObject]) + [array addObject:[object performSelector:selector withObject:inObject]]; + return [NSArray arrayWithArray:array]; +} +@end + +#pragma mark - + +@implementation NSCharacterSet (NGSCharacterSetExtensions) +#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4 ++ (NSCharacterSet *)newlineCharacterSet +{ + unsigned char bitmapRep[8192]; + bitmapRep[0x0A >> 3] |= (((unsigned int)1) << (0x0A & 7)); + bitmapRep[0x0B >> 3] |= (((unsigned int)1) << (0x0B & 7)); + bitmapRep[0x0C >> 3] |= (((unsigned int)1) << (0x0C & 7)); + bitmapRep[0x0D >> 3] |= (((unsigned int)1) << (0x0D & 7)); + bitmapRep[0x85 >> 3] |= (((unsigned int)1) << (0x85 & 7)); + NSData *data = [NSData dataWithBytesNoCopy:bitmapRep length:8192 freeWhenDone:YES]; + return [NSCharacterSet characterSetWithBitmapRepresentation:data]; +} +#endif ++ (NSCharacterSet *)tabCharacterSet +{ + unsigned char bitmapRep[8192]; + bitmapRep[0x09 >> 3] |= (((unsigned int)1) << (0x09 & 7)); + bitmapRep[0x0B >> 3] |= (((unsigned int)1) << (0x0B & 7)); + NSData *data = [NSData dataWithBytesNoCopy:bitmapRep length:8192 freeWhenDone:YES]; + return [NSCharacterSet characterSetWithBitmapRepresentation:data]; +} +@end + +#pragma mark - + +@implementation NSIndexSet (NGSIndicies) ++ (id)indexSetWithIndiciesInRange:(NSRange)range +{ return [NSIndexSet indexSetWithIndexesInRange:range]; } +- (id)initWithIndiciesInRange:(NSRange)range +{ return [self initWithIndexesInRange:range]; } +- (unsigned int)getIndicies:(unsigned int *)indexBuffer maxCount:(unsigned int)bufferSize inIndexRange:(NSRangePointer)range +{ return [self getIndexes:indexBuffer maxCount:bufferSize inIndexRange:range]; } +- (BOOL)containsIndiciesInRange:(NSRange)range +{ return [self containsIndexesInRange:range]; } +- (BOOL)containsIndicies:(NSIndexSet *)indexSet +{ return [self containsIndexes:indexSet]; } +- (BOOL)intersectsIndiciesInRange:(NSRange)range +{ return [self intersectsIndexesInRange:range]; } +@end + +@implementation NSMutableIndexSet (NGSIndicies) +- (void)addIndicies:(NSIndexSet *)indexSet +{ [self addIndexes:indexSet]; } +- (void)removeIndicies:(NSIndexSet *)indexSet +{ [self removeIndexes:indexSet]; } +- (void)removeAllIndicies +{ [self removeAllIndexes]; } +- (void)addIndiciesInRange:(NSRange)range +{ [self addIndexesInRange:range]; } +- (void)removeIndiciesInRange:(NSRange)range +{ [self removeIndexesInRange:range]; } +- (void)shiftIndiciesStartingAtIndex:(unsigned int)index by:(int)delta +{ [self shiftIndexesStartingAtIndex:index by:delta]; } +@end + +#pragma mark - + +@implementation NSNumber (NGSRangeExtensions) +- (BOOL)isWithinRange:(NSRange)range // location <= self <= location+length +{ + // e.g. for {6,1} a value of 6.000 will return true, as will 7.000 + return [self compare:[NSNumber numberWithInt:range.location]] != NSOrderedAscending && [self compare:[NSNumber numberWithInt:range.location+range.length]] != NSOrderedDescending; +} +- (BOOL)isExclusivelyWithinRange:(NSRange)range // location < self < location+length +{ + // e.g. for {6,1} a value of 6.000 will return false, 6.001 will return true, 6.999 will return true, 7.000 false + return [self compare:[NSNumber numberWithInt:range.location]] == NSOrderedDescending && [self compare:[NSNumber numberWithInt:range.location+range.length]] == NSOrderedAscending; +} +- (BOOL)isBoundedByRange:(NSRange)range // location <= self < location+length +{ + // e.g. for {6,1} a value of 6.000 will return true, 6.999 will return true, 7.000 will not + return [self compare:[NSNumber numberWithInt:range.location]] != NSOrderedAscending && [self compare:[NSNumber numberWithInt:range.location+range.length]] == NSOrderedAscending; +} +@end + +#pragma mark - + +@implementation NSString (NGSFSSpecExtensions) +- (FSRef *)createFSRef +{ + // caller is responsible for disposing of the FSRef (method is a 'create' method) + FSRef *fsRef = (FSRef *) NewPtrClear(sizeof(FSRef)); + OSStatus error = FSPathMakeRef((const UInt8 *)[self fileSystemRepresentation], fsRef, NULL); + if(error != noErr) fsRef = NULL; + return fsRef; +} +- (FSSpec *)createFSSpec +{ + // caller is responsible for disposing of the FSSpec (method is a 'create' method) + FSRef *fsRef = (FSRef *) NewPtrClear(sizeof(FSRef)); + FSSpec *fsSpec = (FSSpec *) NewPtrClear(sizeof(FSSpec)); + OSStatus error = FSPathMakeRef((const UInt8 *)[self fileSystemRepresentation], fsRef, NULL); + if(error == noErr) + { + error = FSGetCatalogInfo(fsRef, kFSCatInfoNone, NULL, NULL, fsSpec, NULL); + if(error == noErr) + { + DisposePtr((Ptr)fsRef); + return fsSpec; + } + } + DisposePtr((Ptr)fsRef); + DisposePtr((Ptr)fsSpec); + return NULL; +} +@end + +@implementation NSString (NGSBooleanExtensions) +#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4 +- (BOOL)boolValue +{ + return ![self isEqualToString:@"NO"]; +} +#endif ++ (NSString *)stringWithBool:(BOOL)boolean +{ + return boolean? @"YES" : @"NO"; +} +@end + +#pragma mark - +/* +@implementation NSMatrix (NGSSelectionIndicies) +- (NSIndexSet *)selectedRows +{ + int numRows, numCols; + NSMutableIndexSet *rows = [[NSMutableIndexSet alloc] init]; + [self getNumberOfRows:&numRows columns:&numCols]; + for(int r = 0; r < numRows; r++) + { + for(int c = 0; c < numCols; c++) + { + if() + { + c = numCols; + continue; + } + } + } +} +- (NSIndexSet *)selectedColumns +{ + NSMutableIndexSet *columns = [[NSMutableIndexSet alloc] init]; +} +@end +*/ +@implementation NSOutlineView (NGSSelectedItemExtensions) +- (id)selectedItem +{ + if([self numberOfSelectedRows] != 1) return nil; + else return [self itemAtRow:[self selectedRow]]; +} +- (NSArray *)selectedItems; +{ + NSNumber *row; + NSMutableArray *items = [NSMutableArray array]; + NSEnumerator *enumerator = [self selectedRowEnumerator]; + while(row = [enumerator nextObject]) + [items addObject:[self itemAtRow:[row intValue]]]; + return items; +} +@end + +#pragma mark - +/* +@implementation NSGradient (NGSGradientExtensions) ++ (NSGradient *)aquaGradient +{ + NSGradient *gradient = [[NSGradient alloc] initWithColorsAndLocations: + [NSColor colorWithCalibratedWhite: 0.95 alpha: 1.0], 0.0, + [NSColor colorWithCalibratedWhite: 0.83 alpha: 1.0], 0.5, + [NSColor colorWithCalibratedWhite: 0.95 alpha: 1.0], 0.5, + [NSColor colorWithCalibratedWhite: 0.92 alpha: 1.0], 1.0, nil]; + return [gradient autorelease]; +} ++ (NSGradient *)aquaGradientWithAlpha:(CGFloat)alpha +{ + NSGradient *gradient = [[NSGradient alloc] initWithColorsAndLocations: + [NSColor colorWithCalibratedWhite: 0.95 alpha: alpha], 0.0, + [NSColor colorWithCalibratedWhite: 0.83 alpha: alpha], 0.5, + [NSColor colorWithCalibratedWhite: 0.95 alpha: alpha], 0.5, + [NSColor colorWithCalibratedWhite: 0.92 alpha: alpha], 1.0, nil]; + return [gradient autorelease]; +} +- (NSGradient *)gradientWithAlpha:(CGFloat)alpha +{ + NSColor *colour; + NSInteger stops = [self numberOfColorStops]; + NSMutableArray *colours = [NSMutableArray array]; + CGFloat *locations = (CGFloat *) calloc(sizeof(CGFloat), stops); + for(NSInteger i = 0; i < stops; i++) + { + [self getColor: &colour location: &(locations[i]) atIndex: i]; + [colours addObject: [colour colorWithAlphaComponent: alpha]]; + } + NSGradient *gradient = [[NSGradient alloc] initWithColors: colours atLocations: locations colorSpace: [self colorSpace]]; + return [gradient autorelease]; +} +@end +*/ +#pragma mark - + +/* CGLContext access for pre-10.3 */ +@implementation NSOpenGLContext (CGLContextAccess) +- (CGLContextObj)cglContext; +{ + if(NSAppKitVersionNumber < 700.0) + return _contextAuxiliary; + else return (CGLContextObj) [self CGLContextObj]; +} +@end \ No newline at end of file diff --git a/Cocoa/Plug-Ins/Font Editor/English.lproj/FontDocument.nib/classes.nib b/Cocoa/Plug-Ins/Font Editor/English.lproj/FontDocument.nib/classes.nib new file mode 100644 index 0000000..5f48deb --- /dev/null +++ b/Cocoa/Plug-Ins/Font Editor/English.lproj/FontDocument.nib/classes.nib @@ -0,0 +1,12 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + ACTIONS = {openTableInEditor = id; }; + CLASS = FontWindowController; + LANGUAGE = ObjC; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +} \ No newline at end of file diff --git a/Cocoa/Plug-Ins/Font Editor/English.lproj/FontDocument.nib/info.nib b/Cocoa/Plug-Ins/Font Editor/English.lproj/FontDocument.nib/info.nib new file mode 100644 index 0000000..26a8aaf --- /dev/null +++ b/Cocoa/Plug-Ins/Font Editor/English.lproj/FontDocument.nib/info.nib @@ -0,0 +1,22 @@ + + + + + IBDocumentLocation + 137 216 356 240 0 0 1600 1002 + IBFramework Version + 446.1 + IBLockedObjects + + 21 + + IBOldestOS + 3 + IBOpenObjects + + 5 + + IBSystem Version + 8L127 + + diff --git a/Cocoa/Plug-Ins/Font Editor/English.lproj/FontDocument.nib/keyedobjects.nib b/Cocoa/Plug-Ins/Font Editor/English.lproj/FontDocument.nib/keyedobjects.nib new file mode 100644 index 0000000..4bf3dd7 Binary files /dev/null and b/Cocoa/Plug-Ins/Font Editor/English.lproj/FontDocument.nib/keyedobjects.nib differ diff --git a/Cocoa/Plug-Ins/Font Editor/English.lproj/FontWindow.nib/classes.nib b/Cocoa/Plug-Ins/Font Editor/English.lproj/FontWindow.nib/classes.nib new file mode 100644 index 0000000..d29f4ae --- /dev/null +++ b/Cocoa/Plug-Ins/Font Editor/English.lproj/FontWindow.nib/classes.nib @@ -0,0 +1,13 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + ACTIONS = {imageViewChanged = id; }; + CLASS = FontWindowController; + LANGUAGE = ObjC; + OUTLETS = {resource = id; tableList = NSTableView; tableListDrawer = NSDrawer; }; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +} \ No newline at end of file diff --git a/Cocoa/Plug-Ins/Font Editor/English.lproj/FontWindow.nib/info.nib b/Cocoa/Plug-Ins/Font Editor/English.lproj/FontWindow.nib/info.nib new file mode 100644 index 0000000..08d42f6 --- /dev/null +++ b/Cocoa/Plug-Ins/Font Editor/English.lproj/FontWindow.nib/info.nib @@ -0,0 +1,29 @@ + + + + + IBDocumentLocation + 445 178 356 240 0 0 1600 1002 + IBEditorPositions + + 31 + 864 207 78 249 0 0 1600 1002 + 52 + 612 490 436 355 0 0 1600 1002 + + IBFramework Version + 446.1 + IBLockedObjects + + IBOldestOS + 2 + IBOpenObjects + + 43 + 31 + 52 + + IBSystem Version + 8L127 + + diff --git a/Cocoa/Plug-Ins/Font Editor/English.lproj/FontWindow.nib/keyedobjects.nib b/Cocoa/Plug-Ins/Font Editor/English.lproj/FontWindow.nib/keyedobjects.nib new file mode 100644 index 0000000..a6ec328 Binary files /dev/null and b/Cocoa/Plug-Ins/Font Editor/English.lproj/FontWindow.nib/keyedobjects.nib differ diff --git a/Cocoa/Plug-Ins/Font Editor/English.lproj/Localizable.strings b/Cocoa/Plug-Ins/Font Editor/English.lproj/Localizable.strings new file mode 100644 index 0000000..a7c3f2e --- /dev/null +++ b/Cocoa/Plug-Ins/Font Editor/English.lproj/Localizable.strings @@ -0,0 +1,2 @@ +/* name of menu item */ +"Add Font Table..." = "Add Font Table…"; \ No newline at end of file diff --git a/Cocoa/Plug-Ins/Font Editor/Font Templates.rsrc b/Cocoa/Plug-Ins/Font Editor/Font Templates.rsrc new file mode 100644 index 0000000..be6bfd1 Binary files /dev/null and b/Cocoa/Plug-Ins/Font Editor/Font Templates.rsrc differ diff --git a/Cocoa/Plug-Ins/Font Editor/FontWindowController.h b/Cocoa/Plug-Ins/Font Editor/FontWindowController.h new file mode 100644 index 0000000..707ff65 --- /dev/null +++ b/Cocoa/Plug-Ins/Font Editor/FontWindowController.h @@ -0,0 +1,131 @@ +#import +#import + +#import "ResKnifePluginProtocol.h" +#import "ResKnifeResourceProtocol.h" + +@interface FontWindowController : NSWindowController +{ + id resource; + + OSType arch; + UInt16 numTables; + UInt16 searchRange; + UInt16 entrySelector; + UInt16 rangeShift; + NSMutableArray *headerTable; +} +- (void)loadFontFromResource; +- (IBAction)saveResource:(id)sender; +- (void)setTableData:(id)tableResource; +- (void)openTable:(NSDictionary *)table inEditor:(BOOL)editor; +@end + +/* known Open Font Architectures (OFAs) + + true = TrueType (Mac) + 0x00010000 = TrueType (Windows) + OTTO = OpenType + typ1 = Type 1 +*/ + +const OSType kOFATrueType = 'true'; +const OSType kOFAOpenType = 'OTTO'; +const OSType kOFAType1 = 'typ1'; +const OSType kOFATrueTypeWindows = 0x00010000; + +/* known sfnt tables for all OFAs (TT, OT, T1) + + acnt = Accent attachment + addg + avar = Axis variation + BASE (Baseline adjustment) + bdat = Bitmap data + bhed = Bitmap font header + bloc = Bitmap location + bsln = Baseline + CFF (Type 1 glyph outlines) + cmap = Character mapping + cvar = CVT variation + cvt = Control value + DSIG (Digital signature) + EBDT (Embedded bitmap data) + EBLC (Embedded bitmap locator) + EBSC = Embedded bitmap scaling control + ENCO [seen in Tekton Plus] + fdsc = Font descriptor + feat = Layout features + fmtx = Font metrics + FNAM [seen in Tekton Plus] + fpgm = Font program + fvar = Font variations + gasp = Grid-fitting and scan-conversion procedure + glyf = Glyph outlines + GPOS (Glyph positioning) + GSUB (Glyph substitution) + gvar = Glyph variations + hdmx = Horizontal device metrics + head = Font header + HFMX [seen in Tekton Plus] + hhea = Horizontal header + hmtx = Horizontal metrics + hsty = Horizontal style + just = Justification + kern = Kerning + lcar = Ligature caret + loca = Glyph location indicies + LTSH "This table improves the performance of OpenType fonts with TrueType outlines. The table should be used if bit 2 or 4 of flags in 'head' is set. (Microsoft)" [seen in Cochin] + maxp = Maximum profile + mort = Metamorphosis + morx = Extended metamorphosos + name = Font names and other strings + opbd = Optical bounds + OS/2 = OS compatibility + post = Glyph names & PostScript compatibility + prep = Control value program + prop = Properties + trak = Tracking + TYP1 (Type 1 glyph outlines) [seen in Tekton Plus] + VDMX (Vertical device metrics) [seen in Cochin] + vhea = Vertical header + vmtx = Vertical metrics + Zapf = Glyph reference +*/ + +/* THESE C STRUCTS ARE JUST TO MAKE IT EASIER TO LOAD THE RESOURCE, AND HELP WITH DEBUGGING */ + +/* sfnt resource http://developer.apple.com/documentation/mac/Text/Text-253.html */ +typedef struct +{ + unsigned short versionMajor; + unsigned short versionMinor; + unsigned short tableCount; + unsigned short searchRange; + unsigned short entrySelector; + unsigned short rangeShift; + struct + { + unsigned long tagname; + unsigned long checksum; + unsigned long offset; + unsigned long length; + } __attribute__ ((packed)) tables[0]; +} __attribute__ ((packed)) sfnt_header; + +/* name record http://developer.apple.com/documentation/mac/Text/Text-266.html */ +typedef struct +{ + unsigned short format_selector; // always 0 + unsigned short record_count; // number of name records + unsigned short record_offset; // the offset from the start of the table to the start of string storage + struct + { + unsigned short platform_id; + unsigned short platform_specific_id; + unsigned short language_id; + unsigned short name_id; + unsigned short length; + unsigned short offset; // the offset from the start of storage area + } __attribute__ ((packed)) names[0]; +} __attribute__ ((packed)) name_table_header; + diff --git a/Cocoa/Plug-Ins/Font Editor/FontWindowController.m b/Cocoa/Plug-Ins/Font Editor/FontWindowController.m new file mode 100644 index 0000000..6d8af36 --- /dev/null +++ b/Cocoa/Plug-Ins/Font Editor/FontWindowController.m @@ -0,0 +1,336 @@ +#import "FontWindowController.h" +#import "NGSCategories.h" +#import + +UInt32 TableChecksum(UInt32 *table, UInt32 length) +{ + UInt32 sum = 0, nLongs = (length+3) >> 2; + while(nLongs-- > 0) sum += *table++; + return sum; +} + +@implementation FontWindowController + +- (id)initWithResource:(id )inResource +{ + self = [self initWithWindowNibName:@"FontDocument"]; + if(!self) return nil; + + resource = [(id)inResource retain]; + headerTable = [[NSMutableArray alloc] init]; + [self loadFontFromResource]; + + // load the window from the nib + [self window]; + return self; +} + +- (void)loadFontFromResource +{ + char *start = (char *)[[resource data] bytes]; + arch = *(OSType*)start; + numTables = *(UInt16*)(start+4); + searchRange = *(UInt16*)(start+6); + entrySelector = *(UInt16*)(start+8); + rangeShift = *(UInt16*)(start+10); + UInt32 *pos = (UInt32 *)(start+12); +/* printf("%s\n", [[self displayName] cString]); + printf(" architecture: %#lx '%.4s'\n", arch, &arch); + printf(" number of tables: %hu\n", numTables); + printf(" searchRange: %hu\n", searchRange); + printf(" entrySelector: %hu\n", entrySelector); + printf(" rangeShift: %hu\n\n", rangeShift); +*/ for(int i = 0; i < numTables; i++) + { + OSType name = *pos++; + UInt32 checksum = *pos++; + UInt32 offset = *pos++; + UInt32 length = *pos++; + [headerTable addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys: + [[[NSString alloc] initWithBytes:&name length:4 encoding:NSMacOSRomanStringEncoding] autorelease], @"name", + [NSNumber numberWithUnsignedLong: checksum], @"checksum", + [NSNumber numberWithUnsignedLong: offset], @"offset", + [NSNumber numberWithUnsignedLong: length], @"length", + [NSData dataWithBytes:start+offset length:length], @"data", + nil]]; + } +} + +- (void)dealloc +{ + [[NSNotificationCenter defaultCenter] removeObserver:self]; + [(id)resource release]; + [headerTable release]; + [super dealloc]; +} + +- (void)windowDidLoad +{ + [super windowDidLoad]; + + // set the window's title + if(![[resource name] isEqualToString:@""]) + { + [[self window] setTitle:[resource name]]; + SetWindowAlternateTitle((WindowRef) [[self window] windowRef], (CFStringRef) [NSString stringWithFormat:@"%@ %@: Ò%@Ó", [resource type], [resource resID], [resource name]]); + } + + // we don't want this notification until we have a window! (Only register for notifications on the resource we're editing) + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(resourceDataDidChange:) name:ResourceDataDidChangeNotification object:resource]; + + // finally, show the window + [self showWindow:self]; +} + +- (void)windowDidBecomeKey:(NSNotification *)notification +{ + NSMenu *resourceMenu = [[[NSApp mainMenu] itemAtIndex:3] submenu]; + NSMenuItem *createItem = [resourceMenu itemAtIndex:[resourceMenu indexOfItemWithTarget:nil andAction:@selector(showCreateResourceSheet:)]]; + + [createItem setTitle: NSLocalizedString(@"Add Font Table...", nil)]; + [createItem setAction:@selector(showAddFontTableSheet:)]; +} + +- (void)windowDidResignKey:(NSNotification *)notification +{ + NSMenu *resourceMenu = [[[NSApp mainMenu] itemAtIndex:3] submenu]; + NSMenuItem *createItem = [resourceMenu itemAtIndex:[resourceMenu indexOfItemWithTarget:nil andAction:@selector(showAddFontTableSheet:)]]; + + [createItem setTitle: NSLocalizedString(@"Create New Resource...", nil)]; + [createItem setAction:@selector(showCreateResourceSheet:)]; +} + +- (void)resourceDataDidChange:(NSNotification *)notification +{ + [headerTable removeAllObjects]; + [self loadFontFromResource]; +} + +- (BOOL)windowShouldClose:(id)sender +{ + if([[self window] isDocumentEdited]) + { + NSBeginAlertSheet(@"Do you want to keep the changes you made to this font?", @"Keep", @"DonÕt Keep", @"Cancel", sender, self, @selector(saveSheetDidClose:returnCode:contextInfo:), nil, nil, @"Your changes cannot be saved later if you don't keep them."); + return NO; + } + else return YES; +} + +- (void)saveSheetDidClose:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo +{ + switch(returnCode) + { + case NSAlertDefaultReturn: // keep + [self saveResource:nil]; + [[self window] close]; + break; + + case NSAlertAlternateReturn: // don't keep + [[self window] close]; + break; + + case NSAlertOtherReturn: // cancel + break; + } +} + +- (void)saveResource:(id)sender +{ + // write header fields + NSMutableData *data = [NSMutableData data]; + [data appendBytes:&arch length:4]; + [data appendBytes:&numTables length:2]; + [data appendBytes:&searchRange length:2]; + [data appendBytes:&entrySelector length:2]; + [data appendBytes:&rangeShift length:2]; + UInt32 offset = 12 + ([headerTable count] << 4); + + // add table index + for(int i = 0; i < numTables; i++) + { + NSMutableDictionary *table = [headerTable objectAtIndex:i]; + NSData *tableData = [table valueForKey:@"data"]; + UInt32 length = [tableData length]; + UInt32 checksum = TableChecksum((UInt32 *)[tableData bytes], length); + [table setValue:[NSNumber numberWithUnsignedLong:checksum] forKey:@"checksum"]; + [table setValue:[NSNumber numberWithUnsignedLong:offset] forKey:@"offset"]; + [table setValue:[NSNumber numberWithUnsignedLong:length] forKey:@"length"]; + [data appendBytes:[[table valueForKey:@"name"] cStringUsingEncoding:NSMacOSRomanStringEncoding] length:4]; + [data appendBytes:&checksum length:4]; + [data appendBytes:&offset length:4]; + [data appendBytes:&length length:4]; + offset += length; + if(offset % 4) + offset += 4-(offset%4); + } + + // append tables + long align = 0; + for(int i = 0; i < numTables; i++) + { + // note that this doesn't output in the order thet they were read, nor align on long boundries + [data appendData:[[headerTable objectAtIndex:i] valueForKey:@"data"]]; + if([data length] % 4) // pads the last table too... oh well + [data appendBytes:&align length:4-([data length]%4)]; + } + + // write checksum adjustment to head table + NSDictionary *head = [headerTable firstObjectReturningValue:@"head" forKey:@"name"]; + if(head) + { + UInt32 fontChecksum = 0; + NSRange csRange = NSMakeRange([[head valueForKey:@"offset"] unsignedLongValue]+8,4); + [data replaceBytesInRange:csRange withBytes:&fontChecksum length:4]; + fontChecksum = TableChecksum((UInt32 *)[data bytes], [data length]); + [data replaceBytesInRange:csRange withBytes:&fontChecksum length:4]; + } +// [[NSNotificationCenter defaultCenter] removeObserver:self name:ResourceDataDidChangeNotification object:backup]; + [resource setData:data]; +// [backup setData:[data copy]]; +// [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(resourceDataDidChange:) name:ResourceDataDidChangeNotification object:backup]; + [self setDocumentEdited:NO]; +} + +- (IBAction)showAddFontTableSheet:(id)sender +{ + +} + +- (void)addFontTable:(NSString *)name +{ + NSMutableDictionary *table = [NSMutableDictionary dictionaryWithObjectsAndKeys: + name, @"name", + [NSNumber numberWithUnsignedLong: 0], @"checksum", + [NSNumber numberWithUnsignedLong: 0], @"offset", + [NSNumber numberWithUnsignedLong: 0], @"length", + [NSData data], @"data", nil]; + [headerTable addObject:table]; + numTables = [headerTable count]; + [self openTable:table inEditor:YES]; + [self setDocumentEdited:YES]; +} + +- (void)openTableInEditor:(NSTableView *)sender +{ + if([sender action]) + { + // action set in IB but swapped at first click for a doubleAction ;) + [sender setAction:nil]; + [sender setDoubleAction:@selector(openTableInEditor:)]; + return; + } + + [self openTable:[headerTable objectAtIndex:[sender clickedRow]] inEditor:YES]; +} + +- (void)openTable:(NSDictionary *)table inEditor:(BOOL)editor +{ + NSData *data = [table valueForKey:@"data"]; + if(data) + { + id tableResource = [NSClassFromString(@"Resource") resourceOfType:[table valueForKey:@"name"] andID:[NSNumber numberWithInt:0] withName:[NSString stringWithFormat:@"%@ È %@", [resource name], [table valueForKey:@"name"]] andAttributes:[NSNumber numberWithUnsignedShort:0] data:[table valueForKey:@"data"]]; + if(!tableResource) + { + NSLog(@"Couldn't create Resource with data for table '%@'.", [table valueForKey:@"name"]); + return; + } + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(tableDataDidChange:) name:ResourceDataDidChangeNotification object:tableResource]; + if(editor) [[resource document] openResourceUsingEditor:tableResource]; + else [[resource document] openResource:tableResource usingTemplate:[NSString stringWithFormat:@"sfnt subtable '%@'", [table valueForKey:@"name"]]]; + } +} + +- (void)tableDataDidChange:(NSNotification *)notification +{ + [self setTableData:[notification object]]; +} + +- (void)setTableData:(id)tableResource +{ + NSDictionary *table = [headerTable firstObjectReturningValue:[tableResource type] forKey:@"name"]; + if(!table) + { + NSLog(@"Couldn't retrieve table with name '%@'.", [tableResource type]); + return; + } + + id undoResource = [[tableResource copy] autorelease]; + [undoResource setData:[table valueForKey:@"data"]]; + [[[resource document] undoManager] registerUndoWithTarget:resource selector:@selector(setTableData:) object:undoResource]; + [[[resource document] undoManager] setActionName:[NSString stringWithFormat:NSLocalizedString(@"Edit of table Ò%@Ó", nil), [tableResource type]]]; + [table setValue:[tableResource data] forKey:@"data"]; + [self setDocumentEdited:YES]; +} + ++ (NSArray *)filenameExtensionsForNativeHandling +{ + return [NSArray arrayWithObject:@"ttf"]; +} + ++ (NSString *)filenameExtensionForFileExport:(id )resource +{ + if([[resource type] isEqualToString:@"sfnt"]) return @"ttf"; + else return [resource type]; +} + +@end + +/* sfnt_header *header = (sfnt_header *) [[resource data] bytes]; + for(int i = 0; i < header->tableCount; i++) + { + switch(header->tableInfo[i].tagname) + { + case 'name': + name_table_header *name_table = (name_table_header *) (((char *)[[resource data] bytes]) + header->tableInfo[i].offset); + NSMutableArray *nameArray = [NSMutableArray array]; + for(int j = 0; j < name_table->record_count; j++) + { + // load names into array of name_record classes + NSMutableDictionary *name = [NSMutableDictionary dictionary]; + NSData *stringData = [NSData dataWithBytes:((char *)name_table + name_table->names[j].offset) length:name_table->names[j].length]; + NSStringEncoding stringEncoding; + switch(name_table->names[j].platform_id) + { + case 0: // unicode + stringEncoding = NSUnicodeStringEncoding; + break; + case 1: // mac - values originally were smScript values, which are equivalent to CFStringEncoding values + stringEncoding = CFStringConvertEncodingToNSStringEncoding(name_table->names[j].platform_specific_id); + break; + case 2: // ISO + switch(name_table->names[j].platform_specific_id) + { + case 0: stringEncoding = NSASCIIStringEncoding; break; + case 1: stringEncoding = NSUnicodeStringEncoding; break; // ISO 10646 + case 2: stringEncoding = NSISOLatin1StringEncoding; break; // ISO 8859-1 + default: stringEncoding = NSASCIIStringEncoding; break; + } + break; + case 2: // windows + switch(name_table->names[j].platform_specific_id) + { + // bug: should use correct encodings here + default: stringEncoding = NSWindowsCP1252StringEncoding; break; + } + break; + default: // undefined + stringEncoding = NSWindowsCP1250StringEncoding; // guess Win-Latin-2 + break; + } + [name setValue:[NSNumber numberWithUnsignedShort:name_table->names[j].platform_id] forKey:@"platform"]; + [name setValue:[NSNumber numberWithUnsignedShort:name_table->names[j].platform_specific_id] forKey:@"specific"]; + [name setValue:[NSNumber numberWithUnsignedShort:name_table->names[j].language_id] forKey:@"language"]; + [name setValue:[NSNumber numberWithUnsignedShort:name_table->names[j].name_id] forKey:@"name"]; + [name setValue:[NSString stringWithData:stringData encoding:stringEncoding]] forKey:@"string"]; + [nameArray addObject:name]; + } + [tables setObject:nameArray forKey:@"name"]; + break; + + default: + // else just save the data of the table + [tables setObject:[NSData dataWithBytes:(((char *)[[resource data] bytes]) + header->tableInfo[i].offset) length:header->tableInfo[i].length] forKey:[NSString stringWithCString:&(header->tableInfo[i].tagname) length:4]]; + break; + } + } +*/ \ No newline at end of file diff --git a/Cocoa/Plug-Ins/Font Editor/Info.plist b/Cocoa/Plug-Ins/Font Editor/Info.plist new file mode 100644 index 0000000..ed01a98 --- /dev/null +++ b/Cocoa/Plug-Ins/Font Editor/Info.plist @@ -0,0 +1,35 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + Font Editor + CFBundleIdentifier + com.nickshanks.resknife.fonteditor + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + BNDL + CFBundleSignature + ResK + CFBundleVersion + 1 + NSPrincipalClass + FontWindowController + RKPluginName + Great Expectations + RKSupportedTypes + + + IsResKnifeDefaultForType + YES + RKTypeName + sfnt + RKTypeRole + Editor + + + + diff --git a/ResKnife.xcodeproj/project.pbxproj b/ResKnife.xcodeproj/project.pbxproj index 70148b2..4d106de 100644 --- a/ResKnife.xcodeproj/project.pbxproj +++ b/ResKnife.xcodeproj/project.pbxproj @@ -286,6 +286,22 @@ E1B2A5920E41103A00A72928 /* Template Editor.plugin in CopyFiles */ = {isa = PBXBuildFile; fileRef = E1B2A5860E41103A00A72928 /* Template Editor.plugin */; }; E1B2A5930E41103A00A72928 /* Hexadecimal Editor.plugin in CopyFiles */ = {isa = PBXBuildFile; fileRef = E1B2A4570E41103800A72928 /* Hexadecimal Editor.plugin */; }; E1B2A5950E41103A00A72928 /* libResKnife.dylib.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E1B2A4F00E41103900A72928 /* libResKnife.dylib.a */; }; + E1B2A73F0E41218F00A72928 /* FontDocument.nib in Resources */ = {isa = PBXBuildFile; fileRef = E1B2A7350E41218F00A72928 /* FontDocument.nib */; }; + E1B2A7400E41218F00A72928 /* FontWindow.nib in Resources */ = {isa = PBXBuildFile; fileRef = E1B2A7370E41218F00A72928 /* FontWindow.nib */; }; + E1B2A7410E41219000A72928 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = E1B2A7390E41218F00A72928 /* Localizable.strings */; }; + E1B2A7420E41219000A72928 /* Font Templates.rsrc in Resources */ = {isa = PBXBuildFile; fileRef = E1B2A73B0E41218F00A72928 /* Font Templates.rsrc */; }; + E1B2A7430E41219000A72928 /* FontWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = E1B2A73D0E41218F00A72928 /* FontWindowController.m */; }; + E1B2A7760E41230E00A72928 /* NGSCategories.m in Sources */ = {isa = PBXBuildFile; fileRef = E1B2A7750E41230E00A72928 /* NGSCategories.m */; }; + E1B2A7770E41230E00A72928 /* NGSCategories.h in Headers */ = {isa = PBXBuildFile; fileRef = E1B2A7740E41230E00A72928 /* NGSCategories.h */; }; + E1B2A7780E41230E00A72928 /* NGSCategories.m in Sources */ = {isa = PBXBuildFile; fileRef = E1B2A7750E41230E00A72928 /* NGSCategories.m */; }; + E1B2A7790E41230E00A72928 /* NGSCategories.h in Headers */ = {isa = PBXBuildFile; fileRef = E1B2A7740E41230E00A72928 /* NGSCategories.h */; }; + E1B2A77A0E41230E00A72928 /* NGSCategories.m in Sources */ = {isa = PBXBuildFile; fileRef = E1B2A7750E41230E00A72928 /* NGSCategories.m */; }; + E1B2A77B0E41230E00A72928 /* NGSCategories.h in Headers */ = {isa = PBXBuildFile; fileRef = E1B2A7740E41230E00A72928 /* NGSCategories.h */; }; + E1B2A77C0E41230E00A72928 /* NGSCategories.m in Sources */ = {isa = PBXBuildFile; fileRef = E1B2A7750E41230E00A72928 /* NGSCategories.m */; }; + E1B2A77D0E41230E00A72928 /* NGSCategories.h in Headers */ = {isa = PBXBuildFile; fileRef = E1B2A7740E41230E00A72928 /* NGSCategories.h */; }; + E1B2A77E0E41230E00A72928 /* NGSCategories.m in Sources */ = {isa = PBXBuildFile; fileRef = E1B2A7750E41230E00A72928 /* NGSCategories.m */; }; + E1B2A77F0E41230E00A72928 /* NGSCategories.h in Headers */ = {isa = PBXBuildFile; fileRef = E1B2A7740E41230E00A72928 /* NGSCategories.h */; }; + E1B2A7800E41230E00A72928 /* NGSCategories.m in Sources */ = {isa = PBXBuildFile; fileRef = E1B2A7750E41230E00A72928 /* NGSCategories.m */; }; /* End PBXBuildFile section */ /* Begin PBXBuildRule section */ @@ -402,6 +418,16 @@ E1B2A55A0E41103A00A72928 /* Bitmap Editor.plugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Bitmap Editor.plugin"; sourceTree = BUILT_PRODUCTS_DIR; }; E1B2A5850E41103A00A72928 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; E1B2A5860E41103A00A72928 /* Template Editor.plugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Template Editor.plugin"; sourceTree = BUILT_PRODUCTS_DIR; }; + E1B2A7220E41213300A72928 /* Font Editor.plugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Font Editor.plugin"; sourceTree = BUILT_PRODUCTS_DIR; }; + E1B2A7360E41218F00A72928 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/FontDocument.nib; sourceTree = ""; }; + E1B2A7380E41218F00A72928 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/FontWindow.nib; sourceTree = ""; }; + E1B2A73A0E41218F00A72928 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/Localizable.strings; sourceTree = ""; }; + E1B2A73B0E41218F00A72928 /* Font Templates.rsrc */ = {isa = PBXFileReference; lastKnownFileType = archive.rsrc; path = "Font Templates.rsrc"; sourceTree = ""; }; + E1B2A73C0E41218F00A72928 /* FontWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontWindowController.h; sourceTree = ""; }; + E1B2A73D0E41218F00A72928 /* FontWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FontWindowController.m; sourceTree = ""; }; + E1B2A73E0E41218F00A72928 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + E1B2A7740E41230E00A72928 /* NGSCategories.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NGSCategories.h; sourceTree = ""; }; + E1B2A7750E41230E00A72928 /* NGSCategories.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NGSCategories.m; sourceTree = ""; }; F5041736036BD60801A8010A /* ResKnife.scriptSuite */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = ResKnife.scriptSuite; sourceTree = ""; }; F50DFE17036C203F01A8010A /* English */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = English; path = Cocoa/English.lproj/ResKnife.scriptTerminology; sourceTree = SOURCE_ROOT; }; F50DFE22036C258201A8010A /* BoolTemplateField.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = BoolTemplateField.cpp; sourceTree = ""; }; @@ -714,6 +740,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + E1B2A7200E41213300A72928 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -774,6 +807,20 @@ path = "Template Editor"; sourceTree = ""; }; + E1B2A7340E41218F00A72928 /* Font Editor */ = { + isa = PBXGroup; + children = ( + E1B2A73C0E41218F00A72928 /* FontWindowController.h */, + E1B2A73D0E41218F00A72928 /* FontWindowController.m */, + E1B2A73B0E41218F00A72928 /* Font Templates.rsrc */, + E1B2A73E0E41218F00A72928 /* Info.plist */, + E1B2A7390E41218F00A72928 /* Localizable.strings */, + E1B2A7350E41218F00A72928 /* FontDocument.nib */, + E1B2A7370E41218F00A72928 /* FontWindow.nib */, + ); + path = "Font Editor"; + sourceTree = ""; + }; F50DFE20036C258201A8010A /* Uli's Template Editor */ = { isa = PBXGroup; children = ( @@ -835,6 +882,8 @@ F5594EE9021F3E2301A80001 /* Categories */ = { isa = PBXGroup; children = ( + E1B2A7740E41230E00A72928 /* NGSCategories.h */, + E1B2A7750E41230E00A72928 /* NGSCategories.m */, F5D0CBCF022744C701A80001 /* NSOutlineView-SelectedItems.h */, F5D0CBD0022744C701A80001 /* NSOutlineView-SelectedItems.m */, F59D5DE40320DFF601A8010C /* NSString-FSSpec.h */, @@ -852,6 +901,7 @@ F5502C4001C579FF01C57124 /* ResKnifePluginProtocol.h */, F5CDEBAB01FC893201A80001 /* ResKnifeResourceProtocol.h */, F5EF839F020C08E601A80001 /* Hex Editor */, + E1B2A7340E41218F00A72928 /* Font Editor */, 3D3B99B704DC167D0056861E /* Bitmap Editor */, 3D0B38A504DEF41E005AED5E /* Template Editor */, F5354435022673C101A80001 /* Template Editor (Abandoned) */, @@ -905,6 +955,7 @@ E1B2A5480E41103A00A72928 /* Ulis Template Editor.bundle */, E1B2A55A0E41103A00A72928 /* Bitmap Editor.plugin */, E1B2A5860E41103A00A72928 /* Template Editor.plugin */, + E1B2A7220E41213300A72928 /* Font Editor.plugin */, ); name = Products; sourceTree = ""; @@ -1262,6 +1313,7 @@ E1B2A3FE0E41103700A72928 /* OpenFileDataSource.h in Headers */, E1B2A3FF0E41103700A72928 /* RKEditorRegistry.h in Headers */, E1B2A4000E41103700A72928 /* RKSupportResourceRegistry.h in Headers */, + E1B2A7770E41230E00A72928 /* NGSCategories.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1275,6 +1327,7 @@ E1B2A4430E41103800A72928 /* HexTextView.h in Headers */, E1B2A4440E41103800A72928 /* HexWindowController.h in Headers */, E1B2A4450E41103800A72928 /* FindSheetController.h in Headers */, + E1B2A7790E41230E00A72928 /* NGSCategories.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1304,6 +1357,7 @@ E1B2A4760E41103800A72928 /* DataSource.h in Headers */, E1B2A4770E41103800A72928 /* Structs.h in Headers */, E1B2A4780E41103800A72928 /* NSNumber-Range.h in Headers */, + E1B2A77F0E41230E00A72928 /* NGSCategories.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1413,6 +1467,7 @@ E1B2A54B0E41103A00A72928 /* ResKnifePluginProtocol.h in Headers */, E1B2A54C0E41103A00A72928 /* ResKnifeResourceProtocol.h in Headers */, E1B2A54D0E41103A00A72928 /* ICONWindowController.h in Headers */, + E1B2A77D0E41230E00A72928 /* NGSCategories.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1435,6 +1490,7 @@ E1B2A5690E41103A00A72928 /* NuTemplateDBYTElement.h in Headers */, E1B2A56A0E41103A00A72928 /* NuTemplateOCNTElement.h in Headers */, E1B2A56B0E41103A00A72928 /* NuTemplateLSTCElement.h in Headers */, + E1B2A77B0E41230E00A72928 /* NGSCategories.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1683,6 +1739,23 @@ productReference = E1B2A5860E41103A00A72928 /* Template Editor.plugin */; productType = "com.apple.product-type.bundle"; }; + E1B2A7210E41213300A72928 /* Font Editor Cocoa */ = { + isa = PBXNativeTarget; + buildConfigurationList = E1B2A7260E41213400A72928 /* Build configuration list for PBXNativeTarget "Font Editor Cocoa" */; + buildPhases = ( + E1B2A71E0E41213300A72928 /* Resources */, + E1B2A71F0E41213300A72928 /* Sources */, + E1B2A7200E41213300A72928 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "Font Editor Cocoa"; + productName = "Font Editor"; + productReference = E1B2A7220E41213300A72928 /* Font Editor.plugin */; + productType = "com.apple.product-type.bundle"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -1699,6 +1772,7 @@ E1B2A3DE0E41103700A72928 /* ResKnife Cocoa */, E1B2A43E0E41103800A72928 /* Hex Editor Cocoa */, E1B2A55B0E41103A00A72928 /* Template Editor Cocoa */, + E1B2A7210E41213300A72928 /* Font Editor Cocoa */, E1B2A5490E41103A00A72928 /* Bitmap Editor Cocoa */, E1B2A46A0E41103800A72928 /* NovaTools */, E1B2A4950E41103800A72928 /* ResKnife Carbon */, @@ -1827,6 +1901,17 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + E1B2A71E0E41213300A72928 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + E1B2A73F0E41218F00A72928 /* FontDocument.nib in Resources */, + E1B2A7400E41218F00A72928 /* FontWindow.nib in Resources */, + E1B2A7410E41219000A72928 /* Localizable.strings in Resources */, + E1B2A7420E41219000A72928 /* Font Templates.rsrc in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ /* Begin PBXRezBuildPhase section */ @@ -1948,6 +2033,7 @@ E1B2A4310E41103700A72928 /* main.m in Sources */, E1B2A4320E41103700A72928 /* RKEditorRegistry.m in Sources */, E1B2A4330E41103700A72928 /* RKSupportResourceRegistry.m in Sources */, + E1B2A7780E41230E00A72928 /* NGSCategories.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1960,6 +2046,7 @@ E1B2A44D0E41103800A72928 /* HexWindowController.m in Sources */, E1B2A44E0E41103800A72928 /* FindSheetController.m in Sources */, E1B2A44F0E41103800A72928 /* Notifications.m in Sources */, + E1B2A77A0E41230E00A72928 /* NGSCategories.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1987,6 +2074,7 @@ E1B2A4890E41103800A72928 /* DataSource.m in Sources */, E1B2A48A0E41103800A72928 /* Notifications.m in Sources */, E1B2A48B0E41103800A72928 /* NSNumber-Range.m in Sources */, + E1B2A7800E41230E00A72928 /* NGSCategories.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2084,6 +2172,7 @@ files = ( E1B2A5510E41103A00A72928 /* Notifications.m in Sources */, E1B2A5520E41103A00A72928 /* ICONWindowController.m in Sources */, + E1B2A77E0E41230E00A72928 /* NGSCategories.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2105,6 +2194,16 @@ E1B2A57C0E41103A00A72928 /* NuTemplateDBYTElement.m in Sources */, E1B2A57D0E41103A00A72928 /* NuTemplateOCNTElement.m in Sources */, E1B2A57E0E41103A00A72928 /* NuTemplateLSTCElement.m in Sources */, + E1B2A77C0E41230E00A72928 /* NGSCategories.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + E1B2A71F0E41213300A72928 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + E1B2A7430E41219000A72928 /* FontWindowController.m in Sources */, + E1B2A7760E41230E00A72928 /* NGSCategories.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2140,6 +2239,30 @@ name = ICONWindow.nib; sourceTree = ""; }; + E1B2A7350E41218F00A72928 /* FontDocument.nib */ = { + isa = PBXVariantGroup; + children = ( + E1B2A7360E41218F00A72928 /* English */, + ); + name = FontDocument.nib; + sourceTree = ""; + }; + E1B2A7370E41218F00A72928 /* FontWindow.nib */ = { + isa = PBXVariantGroup; + children = ( + E1B2A7380E41218F00A72928 /* English */, + ); + name = FontWindow.nib; + sourceTree = ""; + }; + E1B2A7390E41218F00A72928 /* Localizable.strings */ = { + isa = PBXVariantGroup; + children = ( + E1B2A73A0E41218F00A72928 /* English */, + ); + name = Localizable.strings; + sourceTree = ""; + }; F50DFE16036C203F01A8010A /* ResKnife.scriptTerminology */ = { isa = PBXVariantGroup; children = ( @@ -2321,14 +2444,18 @@ 84A45AA60E410BAD008598FD /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + GCC_C_LANGUAGE_STANDARD = gnu99; GCC_VERSION = com.apple.compilers.llvmgcc42; + MACOSX_DEPLOYMENT_TARGET = 10.1; }; name = Debug; }; 84A45AA70E410BAD008598FD /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + GCC_C_LANGUAGE_STANDARD = gnu99; GCC_VERSION = com.apple.compilers.llvmgcc42; + MACOSX_DEPLOYMENT_TARGET = 10.1; }; name = Release; }; @@ -2939,20 +3066,17 @@ GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_GENERATE_DEBUGGING_SYMBOLS = YES; GCC_OPTIMIZATION_LEVEL = 0; - GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; INFOPLIST_FILE = NuTemplateEditor/Info.plist; - OTHER_CFLAGS = ""; OTHER_LDFLAGS = ""; - OTHER_REZFLAGS = ""; PRODUCT_NAME = "Template Editor"; - SECTORDER_FLAGS = ""; WARNING_CFLAGS = ( "-Wmost", "-Wno-four-char-constants", "-Wno-unknown-pragmas", ); WRAPPER_EXTENSION = plugin; - ZERO_LINK = YES; }; name = Debug; }; @@ -2962,20 +3086,60 @@ COPY_PHASE_STRIP = YES; GCC_ENABLE_FIX_AND_CONTINUE = NO; GCC_GENERATE_DEBUGGING_SYMBOLS = NO; - GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; INFOPLIST_FILE = NuTemplateEditor/Info.plist; - OTHER_CFLAGS = ""; OTHER_LDFLAGS = ""; - OTHER_REZFLAGS = ""; PRODUCT_NAME = "Template Editor"; - SECTORDER_FLAGS = ""; WARNING_CFLAGS = ( "-Wmost", "-Wno-four-char-constants", "-Wno-unknown-pragmas", ); WRAPPER_EXTENSION = plugin; - ZERO_LINK = NO; + }; + name = Release; + }; + E1B2A7240E41213400A72928 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; + INFOPLIST_FILE = "Cocoa/Plug-Ins/Font Editor/Info.plist"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = "Font Editor"; + WRAPPER_EXTENSION = plugin; + }; + name = Debug; + }; + E1B2A7250E41213400A72928 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; + INFOPLIST_FILE = "Cocoa/Plug-Ins/Font Editor/Info.plist"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = "Font Editor"; + WRAPPER_EXTENSION = plugin; }; name = Release; }; @@ -3099,6 +3263,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Debug; }; + E1B2A7260E41213400A72928 /* Build configuration list for PBXNativeTarget "Font Editor Cocoa" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + E1B2A7240E41213400A72928 /* Debug */, + E1B2A7250E41213400A72928 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; /* End XCConfigurationList section */ }; rootObject = F5B5880F0156D2A601000001 /* Project object */;