Re: Bold Text
Re: Bold Text
- Subject: Re: Bold Text
- From: Paolo Bertani <email@hidden>
- Date: Wed, 24 May 2006 08:36:24 +0200
Sorry, I have to correct myself.
It doesn't work with Geneva.
In my code I have
f=[NSFont fontWithName:@"Geneva Bold" size:9.0f];
f is nil after the call.
Instead it work with @"Courier New Bold".
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
_______________________________________________
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>) |
| >Re: Bold Text (From: Moray Taylor <email@hidden>) |