Re: Normalize an NSAttributedString

2009-08-30 Thread Ross Carter
On Aug 29, 2009, at 5:29 PM, Ken Thomases wrote: On Aug 29, 2009, at 3:48 PM, Ross Carter wrote: On Aug 29, 2009, at 1:22 PM, Ken Thomases wrote: On Aug 29, 2009, at 11:46 AM, Ross Carter wrote: Suppose an NSAttributedString comprises the string o + umlaut in decomposed form, plus one at

Re: Normalize an NSAttributedString

2009-08-29 Thread Ken Thomases
On Aug 29, 2009, at 3:48 PM, Ross Carter wrote: On Aug 29, 2009, at 1:22 PM, Ken Thomases wrote: On Aug 29, 2009, at 11:46 AM, Ross Carter wrote: Suppose an NSAttributedString comprises the string o + umlaut in decomposed form, plus one attribute. Its length is 2, and the range of an attr

Re: Normalize an NSAttributedString

2009-08-29 Thread Ross Carter
On Aug 29, 2009, at 1:22 PM, Ken Thomases wrote: On Aug 29, 2009, at 11:46 AM, Ross Carter wrote: Suppose an NSAttributedString comprises the string o + umlaut in decomposed form, plus one attribute. Its length is 2, and the range of an attribute is {0, 2}. The string and its attribute are

Re: Normalize an NSAttributedString

2009-08-29 Thread Ken Thomases
On Aug 29, 2009, at 11:46 AM, Ross Carter wrote: Suppose an NSAttributedString comprises the string o + umlaut in decomposed form, plus one attribute. Its length is 2, and the range of an attribute is {0, 2}. The string and its attribute are archived separately as xml data like this: ö NSF

Re: Normalize an NSAttributedString

2009-08-29 Thread Ross Carter
On Aug 26, 2009, at 1:21 PM, Ken Thomases wrote: On Aug 26, 2009, at 10:43 AM, Michael Ash wrote: On Wed, Aug 26, 2009 at 5:42 AM, Ken Thomases wrote: On Aug 25, 2009, at 7:21 PM, Ross Carter wrote: I haven't tried it, but this should work: NSAttributedString* original = whatever;

Re: Normalize an NSAttributedString

2009-08-26 Thread Michael Ash
On Wed, Aug 26, 2009 at 2:59 PM, Ken Thomases wrote: > On Aug 26, 2009, at 1:45 PM, Michael Ash wrote: > >> On Wed, Aug 26, 2009 at 1:21 PM, Ken Thomases wrote: >>> >>> I'm well aware of what it means.  The question is, which exact operations >>> on >>> the mutable string proxy does CFStringNormali

Re: Normalize an NSAttributedString

2009-08-26 Thread Ken Thomases
On Aug 26, 2009, at 1:45 PM, Michael Ash wrote: On Wed, Aug 26, 2009 at 1:21 PM, Ken Thomases wrote: I'm well aware of what it means. The question is, which exact operations on the mutable string proxy does CFStringNormalize perform. If CFStringNormalize performs the minimal replace operat

Re: Normalize an NSAttributedString

2009-08-26 Thread Michael Ash
On Wed, Aug 26, 2009 at 1:21 PM, Ken Thomases wrote: > On Aug 26, 2009, at 10:43 AM, Michael Ash wrote: > >> On Wed, Aug 26, 2009 at 5:42 AM, Ken Thomases wrote: >>> >>> On Aug 25, 2009, at 7:21 PM, Ross Carter wrote: >>> > I haven't tried it, but this should work: > >       NSAttribute

Re: Normalize an NSAttributedString

2009-08-26 Thread Ken Thomases
On Aug 26, 2009, at 10:43 AM, Michael Ash wrote: On Wed, Aug 26, 2009 at 5:42 AM, Ken Thomases wrote: On Aug 25, 2009, at 7:21 PM, Ross Carter wrote: I haven't tried it, but this should work: NSAttributedString* original = whatever; NSMutableAttributedString* normalized = [[or

Re: Normalize an NSAttributedString

2009-08-26 Thread Douglas Davidson
On Aug 26, 2009, at 1:30 AM, Alastair Houghton wrote: On 26 Aug 2009, at 00:56, Martin Wierschin wrote: Note that there is an issue with this approach, which is that attribute runs that start in the middle of a grapheme cluster might result in odd behaviour wrt normalisation. However, it

Re: Normalize an NSAttributedString

2009-08-26 Thread Michael Ash
On Wed, Aug 26, 2009 at 5:42 AM, Ken Thomases wrote: > On Aug 25, 2009, at 7:21 PM, Ross Carter wrote: > >>> I haven't tried it, but this should work: >>> >>>        NSAttributedString* original = whatever; >>>        NSMutableAttributedString* normalized = [[original mutableCopy] >>> autorelease];

Re: Normalize an NSAttributedString

2009-08-26 Thread Ken Thomases
On Aug 25, 2009, at 7:21 PM, Ross Carter wrote: I haven't tried it, but this should work: NSAttributedString* original = whatever; NSMutableAttributedString* normalized = [[original mutableCopy] autorelease]; CFMutableStringRef str = (CFMutableStringRef)[original mutableString];

Re: Normalize an NSAttributedString

2009-08-26 Thread Alastair Houghton
On 26 Aug 2009, at 00:56, Martin Wierschin wrote: Note that there is an issue with this approach, which is that attribute runs that start in the middle of a grapheme cluster might result in odd behaviour wrt normalisation. However, it generally doesn't make sense to have such an attribute

Re: Normalize an NSAttributedString

2009-08-25 Thread Ross Carter
I haven't tried it, but this should work: NSAttributedString* original = whatever; NSMutableAttributedString* normalized = [[original mutableCopy] autorelease]; CFMutableStringRef str = (CFMutableStringRef)[original mutableString]; CFStringNormalize(str, kCFStringNormalizat

Re: Normalize an NSAttributedString

2009-08-25 Thread Martin Wierschin
Note that there is an issue with this approach, which is that attribute runs that start in the middle of a grapheme cluster might result in odd behaviour wrt normalisation. However, it generally doesn't make sense to have such an attribute run (it's the equivalent of asking for e.g. a bold

Re: Normalize an NSAttributedString

2009-08-25 Thread Martin Wierschin
NSString has methods for normalizing the content using Normalization Forms D, KD, C, and KC. NSAttributedString does not. Is there any way to normalize an NSAttributedString? I haven't tried it, but this should work: NSAttributedString* original = wha

Re: Normalize an NSAttributedString

2009-08-25 Thread Alastair Houghton
On 25 Aug 2009, at 18:02, Ross Carter wrote: I'd love to do this: Archiving: 1. Normalize the source attributed string. 2. Archive its string content and its attribute information. Unarchiving: 3. Create a new string from the archived data and normalize it. 4. Created a new attributed string f

Re: Normalize an NSAttributedString

2009-08-25 Thread Ross Carter
er. Dave On Aug 25, 2009, at 11:02 AM, Ross Carter wrote: NSString has methods for normalizing the content using Normalization Forms D, KD, C, and KC. NSAttributedString does not. Is there any way to normalize an NSAttributedString? I need to archive an NSAttributedString by extracting

Re: Normalize an NSAttributedString

2009-08-25 Thread Dave DeLong
ethods for normalizing the content using Normalization Forms D, KD, C, and KC. NSAttributedString does not. Is there any way to normalize an NSAttributedString? I need to archive an NSAttributedString by extracting its string, attributes, and the attribute ranges. This is easy enough to do. The

Normalize an NSAttributedString

2009-08-25 Thread Ross Carter
NSString has methods for normalizing the content using Normalization Forms D, KD, C, and KC. NSAttributedString does not. Is there any way to normalize an NSAttributedString? I need to archive an NSAttributedString by extracting its string, attributes, and the attribute ranges. This is easy