Re: Saving NSAttributedString to a File
Re: Saving NSAttributedString to a File
- Subject: Re: Saving NSAttributedString to a File
- From: Jeffrey Oleander <email@hidden>
- Date: Wed, 07 Jan 2015 16:49:22 -0500
On 2014 Dec 19, at 17:00, Jens Alfke wrote:
On Dec 19, 2014, at 1:39 PM, Charles Jenkins <email@hidden>
wrote:
But when it comes time to save to a file format selected from AppKit
additions (e.g. RTFFromRange:documentAttributes:), any unusual,
application-specific attributes will be lost. There is no built-in
file format you can select that will save just any arbitrarily named
attribute.
Am I right?
Yes, as far as I know. How would AppKit store your arbitrary
attributes into an HTML document? It would have to be a nasty hack
like adding a magic HTML attribute (like "nsattributedstringmetadata")
whose value was a base64 string of an NSArchive of the attribute
dictionary. O_o
Except that the last time I looked, the MSFT RTF pseudo-standard
allowed any tag compatible with the scheme (slash whatever). And if
you're importing the file and don't recognize it, you're supposed to
just drop it and move on (which can have some interesting results when
you're nested in several attributes, but...). Whatever attribute is in
the attributed text in memory should cause generation of a tag with
that name.
So, then the problem becomes, how do you get it to pass on those custom
tags as custom attributes, or to your custom attribute processor?
_______________________________________________
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