Re: Problem with fontDescriptorWithFontAttributes:

2009-09-21 Thread Laurent Daudelin

On Sep 21, 2009, at 14:30, Kyle Sluder wrote:


On Mon, Sep 21, 2009 at 2:29 PM, Laurent Daudelin
 wrote:
Simple: I want to set the font as a gray to show that the text  
field cell is

disabled, e.g. cannot be selected.


Okay, what you really want to do is set the
NSForegroundColorAttributeName of the attributed string that's being
drawn.

http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Conceptual/AttributedStrings/AttributedStrings.html

--Kyle Sluder


That works, Kyle, thanks!

-Laurent.
--
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 
http://nemesys.dyndns.org
Logiciels Nemesys Software  
laurent.daude...@verizon.net
Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com


Re: Problem with fontDescriptorWithFontAttributes:

2009-09-21 Thread Laurent Daudelin


On Sep 21, 2009, at 14:47, Steve Christensen wrote:


On Sep 21, 2009, at 2:29 PM, Laurent Daudelin wrote:


On Sep 21, 2009, at 14:23, Kyle Sluder wrote:

Fonts really don't have colors.  I don't know why  
NSFontColorAttribute

is defined in NSFontDescriptor.h, but none of the other attributed
string attributes are in there.

Why are you trying to attach a color to a font?

--Kyle Sluder


Simple: I want to set the font as a gray to show that the text  
field cell is disabled, e.g. cannot be selected.


Yes, but a font describes essentially the shape of all the glyphs.  
When it comes time to draw it, -then- you apply characteristics like  
color, but to the string you're trying to draw, not to the font.


steve



Yes, that makes sense. I was just distracted with those APIs in  
NSFont, I guess...


-Laurent.
--
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 
http://nemesys.dyndns.org
Logiciels Nemesys Software  
laurent.daude...@verizon.net
Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com


Re: Problem with fontDescriptorWithFontAttributes:

2009-09-21 Thread Steve Christensen

On Sep 21, 2009, at 2:29 PM, Laurent Daudelin wrote:


On Sep 21, 2009, at 14:23, Kyle Sluder wrote:

Fonts really don't have colors.  I don't know why  
NSFontColorAttribute

is defined in NSFontDescriptor.h, but none of the other attributed
string attributes are in there.

Why are you trying to attach a color to a font?

--Kyle Sluder


Simple: I want to set the font as a gray to show that the text  
field cell is disabled, e.g. cannot be selected.


Yes, but a font describes essentially the shape of all the glyphs.  
When it comes time to draw it, -then- you apply characteristics like  
color, but to the string you're trying to draw, not to the font.


steve

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com


Re: Problem with fontDescriptorWithFontAttributes:

2009-09-21 Thread Kyle Sluder
On Mon, Sep 21, 2009 at 2:29 PM, Laurent Daudelin
 wrote:
> Simple: I want to set the font as a gray to show that the text field cell is
> disabled, e.g. cannot be selected.

Okay, what you really want to do is set the
NSForegroundColorAttributeName of the attributed string that's being
drawn.

http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Conceptual/AttributedStrings/AttributedStrings.html

--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com


Re: Problem with fontDescriptorWithFontAttributes:

2009-09-21 Thread Laurent Daudelin

On Sep 21, 2009, at 14:23, Kyle Sluder wrote:


Fonts really don't have colors.  I don't know why NSFontColorAttribute
is defined in NSFontDescriptor.h, but none of the other attributed
string attributes are in there.

Why are you trying to attach a color to a font?

--Kyle Sluder


Simple: I want to set the font as a gray to show that the text field  
cell is disabled, e.g. cannot be selected.



-Laurent.
--
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 
http://nemesys.dyndns.org
Logiciels Nemesys Software  
laurent.daude...@verizon.net
Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com


Re: Problem with fontDescriptorWithFontAttributes:

2009-09-21 Thread Kyle Sluder
Fonts really don't have colors.  I don't know why NSFontColorAttribute
is defined in NSFontDescriptor.h, but none of the other attributed
string attributes are in there.

Why are you trying to attach a color to a font?

--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com


Re: Problem with fontDescriptorWithFontAttributes:

2009-09-21 Thread Laurent Daudelin

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.67 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  
laurent.daude...@verizon.net
Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com


Re: Problem with fontDescriptorWithFontAttributes:

2009-09-19 Thread John C. Randolph


Looks like NSFontColorAttribute is deprecated after 10.4.   Try  
NSForegroundColorAttributeName instead.


-jcr



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com


Problem with fontDescriptorWithFontAttributes:

2009-09-18 Thread Laurent Daudelin

Not sure if it's a known issue but given this:

currentFontDescriptor = [NSFontDescriptor  
fontDescriptorWithFontAttributes:fontAttributes];
NSFont *fontToUse = [NSFont fontWithDescriptor:currentFontDescriptor  
size:[[self font] pointSize]];


I'm getting this in the debugger:
(gdb) po currentFontDescriptor
NSCTFontDescriptor <0x2b0fe0> = {
NSFontColorAttribute = NSCalibratedWhiteColorSpace 0 1;
NSFontNameAttribute = LucidaGrande;
NSFontSizeAttribute = 11;
}
(gdb) po [fontToUse fontDescriptor]
NSCTFontDescriptor <0x269460> = {
NSFontNameAttribute = LucidaGrande;
NSFontSizeAttribute = 11;
}

As a result, I can't set the font color. What am I doing wrong? This  
is with 10.5 as base SDK.


Anybody has any idea?

-Laurent.
--
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 
http://nemesys.dyndns.org
Logiciels Nemesys Software  
laurent.daude...@verizon.net
Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com