Re: is this string styled?
Re: is this string styled?
- Subject: Re: is this string styled?
- From: Matt Neuburg <email@hidden>
- Date: Sat, 07 Jan 2006 07:49:10 -0800
- Thread-topic: is this string styled?
On or about 1/7/06 7:16 AM, thus spake "Camillo Lugaresi"
<email@hidden>:
> On 07/gen/06, at 15:57, Matt Neuburg wrote:
>
>> I have an NSTextView. To save storage space, if what's in the text view is
>> effectively unstyled, I'd like to save just the NSString version of it, not
>> the whole NSAttributedString. Is there a simple way to ask the
>> NSAttributedString: "Are your attributes the same as what I'd get if I took
>> your string, made an NSAttributedString from it using initWithString, and
>> stuck it in that NSTextView?" (The reason I'm having trouble with this is
>> that the attributes of an attributed string made with initWithString form an
>> empty dictionary, but the attributes of that same attributed string when it
>> has passed thru the text view are no longer empty.) m.
>
> First, determine if the entire string is covered by the same
> attribute set using attributesAtIndex:longestEffectiveRange:inRange:.
> If it is, compare that attribute set with the default attribute set
> (which depends on your application).
But what *is* the 'default attribute set'? As I said, when I make an
attributed string with initWithString, its attribute dictionary is empty.
That's the problem. m.
--
matt neuburg, phd = email@hidden, http://www.tidbits.com/matt/
pantes anthropoi tou eidenai oregontai phusei
AppleScript: the Definitive Guide -
http://www.amazon.com/exec/obidos/ASIN/0596005571/somethingsbymatt
Take Control of Word 2004, Tiger, and more -
http://www.takecontrolbooks.com/tiger-customizing.html
Subscribe to TidBITS! It's free and smart. http://www.tidbits.com/
_______________________________________________
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