• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Problem with fontDescriptorWithFontAttributes:
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Problem with fontDescriptorWithFontAttributes:
      • From: Kyle Sluder <email@hidden>
References: 
 >Problem with fontDescriptorWithFontAttributes: (From: Laurent Daudelin <email@hidden>)
 >Re: Problem with fontDescriptorWithFontAttributes: (From: "John C. Randolph" <email@hidden>)

  • Prev by Date: Re: Why am I always getting the linker error: 'duplicate symbol'...?
  • Next by Date: Re: Why am I always getting the linker error: 'duplicate symbol'...?
  • Previous by thread: Re: Problem with fontDescriptorWithFontAttributes:
  • Next by thread: Re: Problem with fontDescriptorWithFontAttributes:
  • Index(es):
    • Date
    • Thread