Re: Trouble with outlined text
Re: Trouble with outlined text
- Subject: Re: Trouble with outlined text
- From: Francesca Cuciniello <email@hidden>
- Date: Thu, 20 Apr 2006 15:49:00 +0200
Hi Jonathon,
this is the code:
NSMutableDictionary * parametri = [[NSMutableDictionary
alloc] initWithDictionary:[textView typingAttributes]];
// [sizeOutline floatValue] is a negative value
[parametri setObject:[NSNumber numberWithFloat:[sizeOutline
floatValue]] forKey:NSStrokeWidthAttributeName];
[parametri setObject:[NSNumber numberWithFloat:[sizeKerning
floatValue]] forKey:NSKernAttributeName];
[parametri setObject:[colorOutline color]
forKey:NSStrokeColorAttributeName];
if ([sizeLineSpacing floatValue] != 0) {
NSMutableParagraphStyle* stile = [[parametri
objectForKey:NSParagraphStyleAttributeName] mutableCopy];
if (stile == nil) {
stile = [[[NSMutableParagraphStyle alloc] init]
autorelease];
[stile setParagraphStyle: [NSParagraphStyle
defaultParagraphStyle]];
[stile setAlignment: NSLeftTextAlignment];
[stile setLineBreakMode: NSLineBreakByWordWrapping];
}
[stile setMinimumLineHeight:[sizeLineSpacing floatValue]];
[stile setMaximumLineHeight:[sizeLineSpacing floatValue]];
[parametri setObject:stile
forKey:NSParagraphStyleAttributeName];
}
NSShadow* ombra = [parametri
objectForKey:NSShadowAttributeName];
if (ombra != nil) {
[ombra setShadowColor:[colorOmbra color]];
[parametri setObject:ombra forKey:NSShadowAttributeName];
// [testoView setTypingAttributes:parametri];
// [testoView setNeedsDisplay:YES];
[[NSFontManager sharedFontManager]
setSelectedAttributes:parametri isMultiple:NO];
NSRange selezione = [textView selectedRange];
if (selezione.length == 0)
NSMakeRange(0,[[textView string] length]);
[[textView textStorage] setAttributes:parametri
range:selezione];
}
Thanks
Francesca Cuciniello
Il giorno 20/apr/06, alle ore 15:01, Jonathon Mah ha scritto:
Hi Francesca,
On 2006-04-20, at 20:04, Francesca Cuciniello wrote:
I'm develop an application that uses NSTextView and Attributed
Strings.
I need to draw text with different color for outline, foreground
and shadow.
I can draw a text with different colors, but something strange
appear.
Also the shadow has an outline and you can see this inside the
caracter.
I've attached an example.
Any ideas?
There's no way to tell without seeing the code; can you post it?
Jonathon Mah
email@hidden
_______________________________________________
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