mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-02 09:21:00 +00:00
Tidyups
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@25176 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
63a7dfcef5
commit
d1ca91a7fa
3 changed files with 169 additions and 102 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2007-05-16 Riccardo Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Headers/AppKit/NSFontDescriptor.h: tidied indentation etc.
|
||||||
|
* Source/NSFont.m: Tidied for coding standards. Fixed memory leak.
|
||||||
|
Fixed error in matrix equality test.
|
||||||
|
|
||||||
2007-05-16 Riccardo Mottola <rmottola@users.sf.net>
|
2007-05-16 Riccardo Mottola <rmottola@users.sf.net>
|
||||||
|
|
||||||
* Headers/AppKit/NSFontDescriptor.h : added from mgstep
|
* Headers/AppKit/NSFontDescriptor.h : added from mgstep
|
||||||
|
@ -5,7 +11,6 @@
|
||||||
NSFontDescriptor implementation
|
NSFontDescriptor implementation
|
||||||
* GNUMakefile: added NSFontDescriptor
|
* GNUMakefile: added NSFontDescriptor
|
||||||
|
|
||||||
|
|
||||||
2007-05-16 Richard Frith-Macdonald <rfm@gnu.org>
|
2007-05-16 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/NSTextAttachment.m: For MacOS-X compatibility, don't call
|
* Source/NSTextAttachment.m: For MacOS-X compatibility, don't call
|
||||||
|
|
|
@ -35,6 +35,8 @@
|
||||||
#import "AppKit/NSController.h"
|
#import "AppKit/NSController.h"
|
||||||
#import "AppKit/NSAffineTransform.h"
|
#import "AppKit/NSAffineTransform.h"
|
||||||
|
|
||||||
|
#if OS_API_VERSION(100300, GS_API_LATEST)
|
||||||
|
|
||||||
@class NSString;
|
@class NSString;
|
||||||
@class NSCoder;
|
@class NSCoder;
|
||||||
|
|
||||||
|
@ -42,28 +44,28 @@ typedef uint32_t NSFontSymbolicTraits;
|
||||||
|
|
||||||
typedef enum _NSFontFamilyClass
|
typedef enum _NSFontFamilyClass
|
||||||
{
|
{
|
||||||
NSFontUnknownClass = 0 << 28,
|
NSFontUnknownClass = 0 << 28,
|
||||||
NSFontOldStyleSerifsClass = 1 << 28,
|
NSFontOldStyleSerifsClass = 1 << 28,
|
||||||
NSFontTransitionalSerifsClass = 2 << 28,
|
NSFontTransitionalSerifsClass = 2 << 28,
|
||||||
NSFontModernSerifsClass = 3 << 28,
|
NSFontModernSerifsClass = 3 << 28,
|
||||||
NSFontClarendonSerifsClass = 4 << 28,
|
NSFontClarendonSerifsClass = 4 << 28,
|
||||||
NSFontSlabSerifsClass = 5 << 28,
|
NSFontSlabSerifsClass = 5 << 28,
|
||||||
NSFontFreeformSerifsClass = 7 << 28,
|
NSFontFreeformSerifsClass = 7 << 28,
|
||||||
NSFontSansSerifClass = 8 << 28,
|
NSFontSansSerifClass = 8 << 28,
|
||||||
NSFontOrnamentalsClass = 9 << 28,
|
NSFontOrnamentalsClass = 9 << 28,
|
||||||
NSFontScriptsClass = 10 << 28,
|
NSFontScriptsClass = 10 << 28,
|
||||||
NSFontSymbolicClass = 12 << 28
|
NSFontSymbolicClass = 12 << 28
|
||||||
} NSFontFamilyClass;
|
} NSFontFamilyClass;
|
||||||
|
|
||||||
enum _NSFontTrait
|
enum _NSFontTrait
|
||||||
{
|
{
|
||||||
NSFontItalicTrait = 0x0001,
|
NSFontItalicTrait = 0x0001,
|
||||||
NSFontBoldTrait = 0x0002,
|
NSFontBoldTrait = 0x0002,
|
||||||
NSFontExpandedTrait = 0x0020,
|
NSFontExpandedTrait = 0x0020,
|
||||||
NSFontCondensedTrait = 0x0040,
|
NSFontCondensedTrait = 0x0040,
|
||||||
NSFontMonoSpaceTrait = 0x0400,
|
NSFontMonoSpaceTrait = 0x0400,
|
||||||
NSFontVerticalTrait = 0x0800,
|
NSFontVerticalTrait = 0x0800,
|
||||||
NSFontUIOptimizedTrait = 0x1000
|
NSFontUIOptimizedTrait = 0x1000
|
||||||
};
|
};
|
||||||
|
|
||||||
extern NSString *NSFontFamilyAttribute;
|
extern NSString *NSFontFamilyAttribute;
|
||||||
|
@ -92,29 +94,35 @@ extern NSString *NSFontVariationAxisNameKey;
|
||||||
|
|
||||||
@interface NSFontDescriptor : NSObject <NSCoding>
|
@interface NSFontDescriptor : NSObject <NSCoding>
|
||||||
{
|
{
|
||||||
NSDictionary *_attributes;
|
NSDictionary *_attributes;
|
||||||
void *_backendPrivate; // caches an FT_Face
|
void *_backendPrivate; // caches an FT_Face
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (id) fontDescriptorWithFontAttributes:(NSDictionary *) attributes;
|
+ (id) fontDescriptorWithFontAttributes: (NSDictionary *)attributes;
|
||||||
+ (id) fontDescriptorWithName:(NSString *) name matrix:(NSAffineTransform *) matrix;
|
+ (id) fontDescriptorWithName: (NSString *)name
|
||||||
+ (id) fontDescriptorWithName:(NSString *) name size:(float) size;
|
matrix: (NSAffineTransform *)matrix;
|
||||||
|
+ (id) fontDescriptorWithName: (NSString *)name
|
||||||
|
size: (float)size;
|
||||||
|
|
||||||
- (NSDictionary *) fontAttributes;
|
- (NSDictionary *) fontAttributes;
|
||||||
- (NSFontDescriptor *) fontDescriptorByAddingAttributes:(NSDictionary *) attributes;
|
- (NSFontDescriptor *) fontDescriptorByAddingAttributes:
|
||||||
- (NSFontDescriptor *) fontDescriptorWithFace:(NSString *) face;
|
(NSDictionary *)attributes;
|
||||||
- (NSFontDescriptor *) fontDescriptorWithFamily:(NSString *) family;
|
- (NSFontDescriptor *) fontDescriptorWithFace: (NSString *)face;
|
||||||
- (NSFontDescriptor *) fontDescriptorWithMatrix:(NSAffineTransform *) matrix;
|
- (NSFontDescriptor *) fontDescriptorWithFamily: (NSString *)family;
|
||||||
- (NSFontDescriptor *) fontDescriptorWithSize:(float) size;
|
- (NSFontDescriptor *) fontDescriptorWithMatrix: (NSAffineTransform *)matrix;
|
||||||
- (NSFontDescriptor *) fontDescriptorWithSymbolicTraits:(NSFontSymbolicTraits) traits;
|
- (NSFontDescriptor *) fontDescriptorWithSize: (float)size;
|
||||||
- (id) initWithFontAttributes:(NSDictionary *) attributes;
|
- (NSFontDescriptor *) fontDescriptorWithSymbolicTraits:
|
||||||
- (NSArray *) matchingFontDescriptorsWithMandatoryKeys:(NSSet *) keys;
|
(NSFontSymbolicTraits)traits;
|
||||||
- (NSAffineTransform *) matrix;
|
- (id) initWithFontAttributes: (NSDictionary *)attributes;
|
||||||
- (id) objectForKey:(NSString *) attribute;
|
- (NSArray *) matchingFontDescriptorsWithMandatoryKeys: (NSSet *)keys;
|
||||||
|
- (id) objectForKey: (NSString *)attribute;
|
||||||
|
- (NSAffineTransform *)matrix;
|
||||||
- (float) pointSize;
|
- (float) pointSize;
|
||||||
- (NSString *) postscriptName;
|
- (NSString *) postscriptName;
|
||||||
- (NSFontSymbolicTraits) symbolicTraits;
|
- (NSFontSymbolicTraits) symbolicTraits;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
#endif /* OS_API_VERSION(100300, GS_API_LATEST) */
|
||||||
|
|
||||||
#endif /* _GNUstep_H_NSFontDescriptor */
|
#endif /* _GNUstep_H_NSFontDescriptor */
|
||||||
|
|
190
Source/NSFont.m
190
Source/NSFont.m
|
@ -496,29 +496,39 @@ static void setNSFont(NSString *key, NSFont *font)
|
||||||
return getNSFont(fontSize, RoleUserFont);
|
return getNSFont(fontSize, RoleUserFont);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (NSFont *) fontWithDescriptor:(NSFontDescriptor *) descriptor size:(float) size;
|
+ (NSFont *) fontWithDescriptor: (NSFontDescriptor *)descriptor
|
||||||
|
size: (float)size
|
||||||
{
|
{
|
||||||
return [self fontWithDescriptor:descriptor size:size textTransform:nil];
|
return [self fontWithDescriptor: descriptor size: size textTransform: nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
// the transform/matrix can be used to rotate/scale/shear the whole font (independently of the CTM!)
|
// the transform/matrix can be used to rotate/scale/shear the whole font (independently of the CTM!)
|
||||||
|
|
||||||
+ (NSFont *) fontWithDescriptor:(NSFontDescriptor *) descriptor size:(float) size textTransform:(NSAffineTransform *) transform;
|
+ (NSFont *) fontWithDescriptor: (NSFontDescriptor *)descriptor
|
||||||
|
size: (float)size
|
||||||
|
textTransform: (NSAffineTransform *)transform
|
||||||
{
|
{
|
||||||
NSArray *a;
|
NSArray *a;
|
||||||
|
|
||||||
if (size == 0.0)
|
if (size == 0.0)
|
||||||
size=[NSFont systemFontSize]; // default
|
size = [NSFont systemFontSize]; // default
|
||||||
|
|
||||||
descriptor=[descriptor fontDescriptorWithSize:size];
|
descriptor = [descriptor fontDescriptorWithSize: size];
|
||||||
if (transform)
|
if (transform)
|
||||||
descriptor=[descriptor fontDescriptorByAddingAttributes:[NSDictionary dictionaryWithObject:transform forKey:NSFontMatrixAttribute]];
|
{
|
||||||
a=[descriptor matchingFontDescriptorsWithMandatoryKeys:[NSSet setWithArray:[[descriptor fontAttributes] allKeys]]]; // match all keys
|
descriptor = [descriptor fontDescriptorByAddingAttributes:
|
||||||
|
[NSDictionary dictionaryWithObject: transform
|
||||||
|
forKey: NSFontMatrixAttribute]];
|
||||||
|
}
|
||||||
|
|
||||||
if([a count] == 0)
|
// match all keys
|
||||||
|
a = [descriptor matchingFontDescriptorsWithMandatoryKeys:
|
||||||
|
[NSSet setWithArray: [[descriptor fontAttributes] allKeys]]];
|
||||||
|
|
||||||
|
if ([a count] == 0)
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
return [a objectAtIndex:0]; // return first matching font
|
return [a objectAtIndex: 0]; // return first matching font
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -847,18 +857,22 @@ static void setNSFont(NSString *key, NSFont *font)
|
||||||
|
|
||||||
- (BOOL) isEqual: (id)anObject
|
- (BOOL) isEqual: (id)anObject
|
||||||
{
|
{
|
||||||
int i;
|
NSAffineTransformStruct ats;
|
||||||
const float*obj_matrix;
|
|
||||||
if (anObject == self)
|
if (anObject == self)
|
||||||
return YES;
|
return YES;
|
||||||
if ([anObject isKindOfClass: self->isa] == NO)
|
if ([anObject isKindOfClass: self->isa] == NO)
|
||||||
return NO;
|
return NO;
|
||||||
if ([[anObject fontName] isEqual: fontName] == NO)
|
if ([[anObject fontName] isEqual: fontName] == NO)
|
||||||
return NO;
|
return NO;
|
||||||
obj_matrix = [(NSFontDescriptor*)anObject matrix];
|
ats = [[(NSFontDescriptor*)anObject matrix] transformStruct];
|
||||||
for (i = 0; i < 6; i++)
|
if (ats.m11 != matrix[0]) return NO;
|
||||||
if (obj_matrix[i] != matrix[i])
|
if (ats.m12 != matrix[1]) return NO;
|
||||||
return NO;
|
if (ats.m21 != matrix[2]) return NO;
|
||||||
|
if (ats.m22 != matrix[3]) return NO;
|
||||||
|
if (ats.tX != matrix[4]) return NO;
|
||||||
|
if (ats.tY != matrix[5]) return NO;
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1446,126 +1460,166 @@ NSString *NSFontVariationAxisNameKey=@"VariationAxisName";
|
||||||
|
|
||||||
@implementation NSFontDescriptor
|
@implementation NSFontDescriptor
|
||||||
|
|
||||||
+ (id) fontDescriptorWithFontAttributes:(NSDictionary *) attributes;
|
+ (id) fontDescriptorWithFontAttributes: (NSDictionary *) attributes;
|
||||||
{
|
{
|
||||||
return [[[self alloc] initWithFontAttributes:attributes] autorelease];
|
return [[[self alloc] initWithFontAttributes:attributes] autorelease];
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (id) fontDescriptorWithName:(NSString *) name matrix:(NSAffineTransform *) matrix;
|
+ (id) fontDescriptorWithName: (NSString *)name
|
||||||
|
matrix: (NSAffineTransform *)matrix
|
||||||
{
|
{
|
||||||
return [self fontDescriptorWithFontAttributes:
|
return [self fontDescriptorWithFontAttributes:
|
||||||
[NSDictionary dictionaryWithObjectsAndKeys:
|
[NSDictionary dictionaryWithObjectsAndKeys:
|
||||||
name, NSFontNameAttribute,
|
name, NSFontNameAttribute,
|
||||||
matrix, NSFontMatrixAttribute,
|
matrix, NSFontMatrixAttribute,
|
||||||
nil]];
|
nil]];
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (id) fontDescriptorWithName:(NSString *) name size:(float) size;
|
+ (id) fontDescriptorWithName: (NSString *)name size: (float)size
|
||||||
{
|
{
|
||||||
return [self fontDescriptorWithFontAttributes:
|
return [self fontDescriptorWithFontAttributes:
|
||||||
[NSDictionary dictionaryWithObjectsAndKeys:
|
[NSDictionary dictionaryWithObjectsAndKeys:
|
||||||
name, NSFontNameAttribute,
|
name, NSFontNameAttribute,
|
||||||
[NSString stringWithFormat:@"%f", size], NSFontSizeAttribute,
|
[NSString stringWithFormat: @"%f", size], NSFontSizeAttribute,
|
||||||
nil]];
|
nil]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSDictionary *) fontAttributes; { return _attributes; }
|
- (NSDictionary *) fontAttributes
|
||||||
|
|
||||||
- (NSFontDescriptor *) fontDescriptorByAddingAttributes:(NSDictionary *) attributes;
|
|
||||||
{
|
{
|
||||||
NSFontDescriptor *fd=[super copy]; // make a copy
|
return _attributes;
|
||||||
if(fd)
|
}
|
||||||
|
|
||||||
|
- (NSFontDescriptor *) fontDescriptorByAddingAttributes:
|
||||||
|
(NSDictionary *)attributes
|
||||||
|
{
|
||||||
|
NSFontDescriptor *fd = [super copy];
|
||||||
|
|
||||||
|
if (fd != nil)
|
||||||
{
|
{
|
||||||
fd->_attributes=[_attributes mutableCopy]; // current attributes
|
NSMutableDictionary *m = [_attributes mutableCopy];
|
||||||
[(NSMutableDictionary *) fd->_attributes addEntriesFromDictionary:attributes]; // change
|
|
||||||
|
fd->_attributes = m; // current attributes
|
||||||
|
[m addEntriesFromDictionary: attributes]; // change
|
||||||
}
|
}
|
||||||
return fd;
|
return AUTORELEASE(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSFontDescriptor *) fontDescriptorWithFace:(NSString *) face;
|
- (NSFontDescriptor *) fontDescriptorWithFace: (NSString *)face
|
||||||
{
|
{
|
||||||
return [self fontDescriptorByAddingAttributes:[NSDictionary dictionaryWithObject:face forKey:NSFontFaceAttribute]];
|
return [self fontDescriptorByAddingAttributes:
|
||||||
|
[NSDictionary dictionaryWithObject: face forKey: NSFontFaceAttribute]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSFontDescriptor *) fontDescriptorWithFamily:(NSString *) family;
|
- (NSFontDescriptor *) fontDescriptorWithFamily: (NSString *)family
|
||||||
{
|
{
|
||||||
return [self fontDescriptorByAddingAttributes:[NSDictionary dictionaryWithObject:family forKey:NSFontFamilyAttribute]];
|
return [self fontDescriptorByAddingAttributes:
|
||||||
|
[NSDictionary dictionaryWithObject: family forKey: NSFontFamilyAttribute]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSFontDescriptor *) fontDescriptorWithMatrix:(NSAffineTransform *) matrix;
|
- (NSFontDescriptor *) fontDescriptorWithMatrix: (NSAffineTransform *)matrix
|
||||||
{
|
{
|
||||||
return [self fontDescriptorByAddingAttributes:[NSDictionary dictionaryWithObject:matrix forKey:NSFontMatrixAttribute]];
|
return [self fontDescriptorByAddingAttributes:
|
||||||
|
[NSDictionary dictionaryWithObject: matrix forKey: NSFontMatrixAttribute]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSFontDescriptor *) fontDescriptorWithSize:(float) size;
|
- (NSFontDescriptor *) fontDescriptorWithSize: (float)size
|
||||||
{
|
{
|
||||||
return [self fontDescriptorByAddingAttributes:[NSDictionary dictionaryWithObject:[NSNumber numberWithFloat:size] forKey:NSFontSizeAttribute]];
|
return [self fontDescriptorByAddingAttributes:
|
||||||
|
[NSDictionary dictionaryWithObject: [NSNumber numberWithFloat: size]
|
||||||
|
forKey: NSFontSizeAttribute]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSFontDescriptor *) fontDescriptorWithSymbolicTraits:(NSFontSymbolicTraits) traits;
|
- (NSFontDescriptor *) fontDescriptorWithSymbolicTraits:
|
||||||
|
(NSFontSymbolicTraits)traits
|
||||||
{
|
{
|
||||||
return [self fontDescriptorByAddingAttributes:[NSDictionary dictionaryWithObject:[NSNumber numberWithUnsignedInt:traits] forKey:NSFontSymbolicTrait]];
|
return [self fontDescriptorByAddingAttributes:
|
||||||
|
[NSDictionary dictionaryWithObject: [NSNumber numberWithUnsignedInt: traits]
|
||||||
|
forKey: NSFontSymbolicTrait]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) initWithFontAttributes:(NSDictionary *) attributes;
|
- (id) initWithFontAttributes: (NSDictionary *) attributes;
|
||||||
{
|
{
|
||||||
if((self=[super init]))
|
if ((self = [super init]) != nil)
|
||||||
{
|
{
|
||||||
if(attributes)
|
if (attributes)
|
||||||
_attributes=[attributes retain];
|
_attributes = [attributes copy];
|
||||||
else
|
else
|
||||||
_attributes=[[NSDictionary alloc] init]; // empty dictionary
|
_attributes = [NSDictionary new];
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) encodeWithCoder:(NSCoder *)aCoder
|
- (void) encodeWithCoder: (NSCoder *)aCoder
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) initWithCoder:(NSCoder *)aDecoder
|
- (id) initWithCoder: (NSCoder *)aDecoder
|
||||||
{
|
{
|
||||||
if(![aDecoder allowsKeyedCoding])
|
if (![aDecoder allowsKeyedCoding])
|
||||||
; // TODO FIXME (copied from mgstep)
|
; // TODO FIXME (copied from mgstep)
|
||||||
_attributes = [[aDecoder decodeObjectForKey:@"NSAttributes"] retain];
|
_attributes = RETAIN([aDecoder decodeObjectForKey: @"NSAttributes"]);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) dealloc;
|
- (void) dealloc;
|
||||||
{
|
{
|
||||||
[_attributes release];
|
RELEASE(_attributes);
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) copyWithZone:(NSZone *)z
|
- (id) copyWithZone: (NSZone *)z
|
||||||
{
|
{
|
||||||
NSFontDescriptor *f=[isa allocWithZone:z];
|
NSFontDescriptor *f = [isa allocWithZone: z];
|
||||||
if(f)
|
|
||||||
f->_attributes=[_attributes copyWithZone:z];
|
if (f != nil)
|
||||||
|
{
|
||||||
|
f->_attributes = [_attributes copyWithZone: z];
|
||||||
|
}
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
TODO FIXME: how to port this from mgStep ?
|
TODO FIXME: how to port this from mgStep ?
|
||||||
- (NSArray *) matchingFontDescriptorsWithMandatoryKeys:(NSSet *) keys; // this is the core font search engine that knows about font directories
|
- (NSArray *) matchingFontDescriptorsWithMandatoryKeys: (NSSet *) keys; // this is the core font search engine that knows about font directories
|
||||||
{
|
{
|
||||||
return BACKEND;
|
return BACKEND;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
- (NSAffineTransform *) matrix; { return [_attributes objectForKey:NSFontMatrixAttribute]; }
|
- (NSAffineTransform *) matrix
|
||||||
- (id) objectForKey:(NSString *) attribute; { return [_attributes objectForKey:attribute]; }
|
{
|
||||||
- (float) pointSize; { return [[_attributes objectForKey:NSFontSizeAttribute] floatValue]; }
|
return [_attributes objectForKey: NSFontMatrixAttribute];
|
||||||
- (NSFontSymbolicTraits) symbolicTraits; { return [[_attributes objectForKey:NSFontSymbolicTrait] unsignedIntValue]; }
|
}
|
||||||
|
|
||||||
|
- (id) objectForKey: (NSString *)attribute
|
||||||
|
{
|
||||||
|
return [_attributes objectForKey: attribute];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (float) pointSize
|
||||||
|
{
|
||||||
|
return [[_attributes objectForKey: NSFontSizeAttribute] floatValue];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSFontSymbolicTraits) symbolicTraits
|
||||||
|
{
|
||||||
|
return [[_attributes objectForKey: NSFontSymbolicTrait] unsignedIntValue];
|
||||||
|
}
|
||||||
|
|
||||||
- (NSString *) postscriptName;
|
- (NSString *) postscriptName;
|
||||||
{
|
{
|
||||||
NSMutableString *family=[[[self objectForKey:NSFontFamilyAttribute] mutableCopy] autorelease];
|
NSMutableString *family;
|
||||||
NSString *face=[self objectForKey:NSFontFaceAttribute];
|
NSString *face;
|
||||||
[family replaceOccurrencesOfString:@" " withString:@"" options:0 range:NSMakeRange(0, [family length])];
|
|
||||||
if([face isEqualToString:@"Regular"])
|
family = AUTORELEASE([[self objectForKey:NSFontFamilyAttribute] mutableCopy]);
|
||||||
|
face = [self objectForKey: NSFontFaceAttribute];
|
||||||
|
[family replaceOccurrencesOfString: @" "
|
||||||
|
withString: @""
|
||||||
|
options: 0
|
||||||
|
range: NSMakeRange(0, [family length])];
|
||||||
|
if ([face isEqualToString:@"Regular"])
|
||||||
return family;
|
return family;
|
||||||
return [NSString stringWithFormat:@"%@-%@", family, face];
|
return [NSString stringWithFormat: @"%@-%@", family, face];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue