How to make letters appear in italics?
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