Best way to compare NSParagraphStyles?
Best way to compare NSParagraphStyles?
- Subject: Best way to compare NSParagraphStyles?
- From: Keith Blount <email@hidden>
- Date: Wed, 4 Oct 2006 13:56:03 -0700 (PDT)
Hello,
In my app I have the need to compare two
NSParagraphStyles to see if they are the same. I
basically have a dictionary of preset text attributes,
and the user can pick from a list to switch between
them while writing. The app needs to keep track of
which attribute is currently in use, so that it can
display this information in a status bar along with
other things.
I do this by comparing the NSParagraphStyle in the
typing attributes dictionary with the paragraph styles
in the attributes inside my preset dictionary. This
works fine until a file is saved to disk (as RTFD) and
then reloaded. Once this happens, it seems that the
reloaded text is no longer the same as it used to be.
For instance, the paragraph style's first line head
indent and normal head indent can be off by a
fraction. Also, NSLeftTextAlignment can become
NSNaturalTextAlignment after a save and load (and I
bet this could also happen to NSRightTextAlignment
where that was natural for the used script).
So, my question is, what is the best way to compare
two NSParagraphStyles, which will work even after the
text has been saved as RTFD and opened again? At the
moment I am going through every paragraph style
setting I actually use and comparing them manually,
but I have to round certain values (because the head
indent can be off) and count NSNaturalTextAlignment as
NSLeftTextAlignment, all of which seems awkward and
could conceivably break.
Thanks in advance for any suggestions or advice.
All the best,
Keith
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.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