while the following works, this seems to me like an awful lot of code i've
written just to change the font mask.  any suggestions?

-=-=-=-=-

- (void)prepareAttributes

{

NSShadow *shadow = [[NSShadow alloc] init];

[shadow setShadowOffset:NSMakeSize(-3, -3)];

[shadow setShadowBlurRadius:5];

[shadow setShadowColor:[NSColor blackColor]];

 attributes = [[NSMutableDictionary alloc] init];

[attributes setObject:[NSFont fontWithName:@"Helvetica" size:75] forKey:
NSFontAttributeName];

[attributes setObject:[NSColor redColor] forKey:
NSForegroundColorAttributeName];

[attributes setObject:shadow forKey:NSShadowAttributeName];

 [shadow release];

}


- (IBAction)fontMask:(id)sender

{

NSFontManager *fm = [NSFontManager sharedFontManager];

NSFont *currentFont = [attributes objectForKey:NSFontAttributeName];

NSObject *newFontMask;

 //Bold Font Mask

if ([sender tag] == 1)

if ([sender state] == NSOnState)

newFontMask = [fm convertFont:currentFont toHaveTrait:NSBoldFontMask];

else

newFontMask = [fm convertFont:currentFont toHaveTrait:NSUnboldFontMask];

 //Italic Font Mask

if ([sender tag] == 2)

if ([sender state] == NSOnState)

newFontMask = [fm convertFont:currentFont toHaveTrait:NSItalicFontMask];

else

newFontMask = [fm convertFont:currentFont toHaveTrait:NSUnitalicFontMask];

 [attributes setObject:newFontMask forKey:NSFontAttributeName];

[self setNeedsDisplay:YES];

}


-=-=-=-=-
_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to