Just to add a little info to my previous message, which was a little
misleading:a
My custom glyph generator replaces each glyph that is supposed to be
hidden with NSNullGlyph (it doesn't just insert one NSNullGlyph for
the lot of them), so I would expect the one-to-one mapping on this
first pass of glyph generation to be maintained. I'm therefore
really not sure why I'm getting all of these errors - it seems that
the presence of a group of null glyphs completely breaks things at
the typesetting stage (I'm guessing)? Hmm, given that there is so
little documentation about this sort of thing and most glyph
generation threads seem to have been unanswered, I don't hold out
much hope...
In case there is a better way of doing things: I am basically trying
to implement hidden text, so that text with a given custom attribute
does not get displayed in the text view. One way I could have done
this was via a custom text storage subclass that maintained two
representations of its text - one with the hidden text displayed,
one with it, um, hidden - but this is no good for what I want, as
the same text storage can be displayed in two different text views,
and there is more than one attribute type that can be hidden
separately.
Hence the custom glyph generator, which isn't working...
Thanks in advance for any help or pointers.
All the best,
Keith
--- ORIGINAL MESSAGE ---
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
____________________________________________________________________________________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping
_______________________________________________
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