Re: NSFont question
Re: NSFont question
- Subject: Re: NSFont question
- From: Jeff Gilbert <email@hidden>
- Date: Tue, 03 May 2005 12:10:54 -0500
Hi Rohn,
You will want to use the NSFont message fontWithName:size: like this:
[NSFont fontWithName:tFont size:tSize]
Since you storing font descriptions in preference files, you may want to look at using NSFontDescriptor for the storage and retrieval of your font data. You can then use the NSFont class message fontWithDescriptor:size: to generate a font of the correct size.
later,
Jeff Gilbert
On Tuesday, May 03, 2005, at 11:58AM, rfitz <email@hidden> wrote:
>I am reading from a preference file the following attributes:
>tR: red color
>tG: green color ----give me the RGB color for string
>tB: blue color
>
>tFont: name of font i want to use (Tahoma could be a value)
>tSize: size I want my font to be (24 could be a value)
>
>With the code below I am able to make my string the the color I want,
>but I have not been able to get it to the font or size that I want.
>
>What do I need to change in the code below so I can get this to work
>how I want it?
>
>
>NSColor *tcol = [NSColor colorWithCalibratedRed:tR green:tG blue:tB alpha:1.0];
>stringAttributes =
> [[NSDictionary dictionaryWithObjectsAndKeys:
> [NSFont systemFontOfSize:36.0], NSFontAttributeName,
> tcol, NSForegroundColorAttributeName,
> nil] retain];
>
>Thanks in advance for the help.
>
>-Rhon
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden