Re: Bold Text
Re: Bold Text
- Subject: Re: Bold Text
- From: Moray Taylor <email@hidden>
- Date: Tue, 23 May 2006 21:06:10 +0100
Written directly in Mail, so apologies for mistakes
This code should be in your NSView subclass
- (void) drawRect:(NSRect) r {
NSString * Text = @"My string!";
// create the attributed string
NSFont * Font = [NSFont fontWithName:@"Geneva Bold" size:10.0f];
NSMutableDictionary * Styles = [[[NSMutableDictionary alloc]
init] autorelease];
[Styles setObject:Font forKey:NSFontAttributeName];
NSAttributedString * as = [[[NSAttributedString alloc]
initWithString:Text attributes:Styles] autorelease];
[as drawAtPoint:NSMakePoint(10,10)];
}
Note, if you care about speed, you may want to cache the string you
create, and not create it every time the NSView draws itself, like my
example does.
If you need any more info, feel free to contact me off list.
Cheers
Moray
This is very basic, sorry.
I have a NSAttributed string instance with some text in Geneva 9.
I want to draw that text in my view with BOLD style.
How can I do that?
Thanks for you patience...
Paolo
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40dataactive.com
This email sent to email@hidden
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
_______________________________________________
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
References: | |
| >Bold Text (From: Paolo Bertani <email@hidden>) |