• 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: Simple NSAttributedString question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Simple NSAttributedString question
      • From: Douglas Davidson <email@hidden>
References: 
 >Re: Simple NSAttributedString question (From: Michael Tsai <email@hidden>)

  • Prev by Date: Re: time-based beta termination system
  • Next by Date: POSIX equiv to [nsBundle mainBundle] bundlePath]
  • Previous by thread: Re: Simple NSAttributedString question
  • Next by thread: Re: Simple NSAttributedString question
  • Index(es):
    • Date
    • Thread