Re: Simple NSAttributedString question
Re: Simple NSAttributedString question
- Subject: Re: Simple NSAttributedString question
- From: Christopher Corbell <email@hidden>
- Date: Thu, 24 Jul 2003 13:27:55 -0700
On Thursday, July 24, 2003, at 10:37 AM, Michael Tsai wrote:
On Thursday, July 24, 2003, at 12:56 PM, Christopher Corbell wrote:
But what key-value pair do I use in the attributes dictionary to
indicate
that the string should be italic?
NSFontAttributeName is the key, and you can get an italic NSFont from
NSFontManager.
--
Michael Tsai <http://www.c-command.com>
Thanks...
This seemed straightforward... I just create a default NSFont (a
system font, in
small-system-font size) and if I want it italic I set the font trait
NSItalicFontMask.
Then I create a dictionary with this as object and NSFontAttributeName
as key...
Except that this doesn't appear to do anything in italic.
NSBoldFontMask -does-
work, so is this just a quirk of the system font (no italic available),
or am I doing
something else wrong?
I convert the font to use italic with the NSFontManager as follows:
NSFont * pFont = [NSFont systemFontOfSize:[NSFont
smallSystemFontSize]];
if( bConvertToItalic )
pFont = [[NSFontManager sharedFontManager] convertFont:pFont
toHaveTrait:NSItalicFontMask];
Thanks again for any help,
Christopher
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.