Re: Problem with fontDescriptorWithFontAttributes:
Re: Problem with fontDescriptorWithFontAttributes:
- Subject: Re: Problem with fontDescriptorWithFontAttributes:
- From: Laurent Daudelin <email@hidden>
- Date: Mon, 21 Sep 2009 14:12:06 -0700
On Sep 19, 2009, at 00:03, John C. Randolph wrote:
Looks like NSFontColorAttribute is deprecated after 10.4. Try
NSForegroundColorAttributeName instead.
-jcr
John, I just tried this:
NSFontDescriptor *currentFontDescriptor = [[self font] fontDescriptor];
NSMutableDictionary *fontAttributes = [NSMutableDictionary
dictionaryWithDictionary:[currentFontDescriptor fontAttributes]];
if ([self isEnabled])
[fontAttributes setObject:[NSColor blackColor]
forKey:NSForegroundColorAttributeName];
else
[fontAttributes setObject:[NSColor lightGrayColor]
forKey:NSForegroundColorAttributeName];
currentFontDescriptor = [NSFontDescriptor
fontDescriptorWithFontAttributes:fontAttributes];
NSFont *fontToUse = [NSFont fontWithDescriptor:currentFontDescriptor
size:[[self font] pointSize]];
With no result:
(gdb) po currentFontDescriptor
NSCTFontDescriptor <0x4a75e0> = {
NSColor = NSCalibratedWhiteColorSpace 0.666667 1;
NSFontNameAttribute = LucidaGrande;
NSFontSizeAttribute = 11;
}
(gdb) po [fontToUse fontDescriptor]
NSCTFontDescriptor <0x457af0> = {
NSFontNameAttribute = LucidaGrande;
NSFontSizeAttribute = 11;
}
Why is the font ignoring the NSColor attribute?
-Laurent.
--
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin http://nemesys.dyndns.org
Logiciels Nemesys Software email@hidden
Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden