Hi,

I have a custom glyph generator (NSGlyphGenerator subclass) that is used to 
hide glyphs for text with certain attributes. It does this by inserting a 
single NSNullGlyph for a range of glyphs representing text with these hidden 
attributes. (This is basically a hidden text toggle.) This all works 
brilliantly - I can completely hide whole ranges of text - but only so long as 
the text is viewed in a single text view.

If I have the same text storage shared between two text views, and one view has 
the text hidden whilst the other doesn't, I get array out of bounds errors 
under the following circumstances: If, in the view where no text is hidden, I 
click in the range of text that IS hidden in the other view, and then I hit 
return a couple of times, I get these errors:

Exception raised during background layout:  *** NSRunStorage, 
_NSBlockNumberForIndex(): index (345) beyond array bounds (335)
2008-03-08 10:28:00.042 HiddenTextTest[42350:813] *** NSRunStorage, 
_NSBlockNumberForIndex(): index (345) 

Clearly, these errors are caused because my hidden-text view has less glyphs in 
it than the non-hidden-text view, but they both share the same text storage. So 
my question is, how do I fix this? Somewhere it seems that I need to tell 
something else - other than my glyph generator - that some text is hidden. The 
errors seem to indicate that I might need to tell my text storage about this... 
But where and how? But then, I can't tell the text storage, because it has 
hidden text in one view but not the other...

The method of hiding text by inserting a null glyph was recommended to me by 
DTS, but there is very little documentation on actually achieving something 
like this, so I'm hoping some text expert here will be able to give me some 
clues. :)

Many thanks in advance and all the best,
Keith



      
____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to