NSAttributedString gains default font and paragraph style after round tripping through pasteboard?
NSAttributedString gains default font and paragraph style after round tripping through pasteboard?
- Subject: NSAttributedString gains default font and paragraph style after round tripping through pasteboard?
- From: Jim Correia <email@hidden>
- Date: Sun, 11 Jun 2006 19:00:31 -0400
I am creating an NSAttributedString which only has a link attribute
with the hopes that when pasted it would pick up the typing
attributes. However, after round tripping through RTFD it appears to
have picked up the default font and paragraph style.
Is this the expected behavior? Is there any way I can put a string
with a link on the pasteboard in such a way that it will pick up the
typing attributes when pasted?
- Jim
2006-06-11 18:18:56.991 AttributedStringTest[28130] Apple{NSLink =
http://www.apple.com; }
2006-06-11 18:18:57.042 AttributedStringTest[28130] Apple{
NSFont = "Helvetica 12.00 pt. P [] (0x00344af0) fobj=0x0032e8d0,
spc=3.33";
NSLink = http://www.apple.com;
NSParagraphStyle = Alignment 4, LineSpacing 0, ParagraphSpacing
0, ParagraphSpacingBefore 0, HeadIndent 0, TailIndent 0,
FirstLineHeadIndent 0, LineHeight 0/0, LineHeightMultiple 0,
LineBreakMode 0, Tabs (28L, 56L, 84L, 112L, 140L, 168L, 196L, 224L,
252L, 280L, 308L, 336L), DefaultTabInterval 0, Blocks (null), Lists
(null), BaseWritingDirection -1, HyphenationFactor 0,
TighteningFactor 0.05, HeaderLevel 0;
}
int main(int argc, char *argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSURL *url = [NSURL URLWithString: @"http://www.apple.com"];
NSDictionary *attributes = [NSDictionary dictionaryWithObject: url
forKey: NSLinkAttributeName];
NSAttributedString *attributedString = [[[NSAttributedString alloc]
initWithString: @"Apple" attributes: attributes] autorelease];
NSLog(@"%@", attributedString);
NSData *data = [attributedString RTFDFromRange: NSMakeRange(0,
[attributedString length]) documentAttributes: nil];
NSAttributedString *attributedString2 = [[[NSAttributedString alloc]
initWithRTFD: data documentAttributes: NULL] autorelease];
NSLog(@"%@", attributedString2);
[pool release];
return 0;
}
_______________________________________________
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