• 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
How to make letters appear in italics?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to make letters appear in italics?


  • Subject: How to make letters appear in italics?
  • From: Li Fumin <email@hidden>
  • Date: Tue, 17 Mar 2009 22:14:18 +0800

Hi,all.I am new to cocoa. I am reading Aaron Hillegass's Book "Cocoa Programming for Mac OS X".

I have got some problems with challenge 2 of Chapter 20.I have a custom NSView called BigLetterView, and then it show the input letter on the view.Now I want to make the letter which I just inputted appears in italics. So, I define this method:

- (IBAction) isItalic: (id) sender
{
if ([italicBox state])
{
NSFontManager *fontManager = [NSFontManager sharedFontManager];
[fontManager convertFont: [NSFont fontWithName: @"Helvetica" size: 75]
toHaveTrait: NSItalicFontMask];
}else {
NSFontManager *fontManager = [NSFontManager sharedFontManager];
[fontManager convertFont: [NSFont fontWithName: @"Helvetica" size: 75]
toHaveTrait: NSUnitalicFontMask];
}


	[self setNeedsDisplay: YES];
}

When I click the italics check button. Nothing happens. How do I suppose to make this wok?
How can I get the font the letter is using?


Thanks.
_______________________________________________

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: How to make letters appear in italics?
      • From: Jim Correia <email@hidden>
  • Prev by Date: Re: Double Initialize - is that how it should be?
  • Next by Date: Drawing background windows during window move.
  • Previous by thread: Re: Banding/smoothing problem with drawing angled gradients.
  • Next by thread: Re: How to make letters appear in italics?
  • Index(es):
    • Date
    • Thread