Re: LayoutManager
Re: LayoutManager
- Subject: Re: LayoutManager
- From: jgo <email@hidden>
- Date: Wed, 28 Nov 2001 14:42:07 -0800
>
Douglas Davidson <email@hidden> Mon, 2001-11-26 15:01:35 -0800
>
> On Friday, 2001 November 23 at 06:03, Gerriet M. Denkmann wrote:
>
> I have a TextStorage where some characters have an addtitional
>
> Attribute "Hidden".
>
> And I want the LayoutManager NOT to display these characters.
>
>
>
> E.g.
>
> Storage:
>
> some text -Now chars with Hidden- Followed by normal text
>
>
>
> This should be displayed as:
>
> some text @Followed by normal text
>
>
>
> I.e. a whole range of hidden chars should be shown as "@".
>
>
>
> Probably I have to override some methods in LayoutManger, but I cannot
>
> figure out, which and how.
>
>
>
> Could someone give me some clues?
>
>
Offhand I can't think of a really easy way to do this, but a few
>
approaches do spring to mind. First, you could create a text storage
>
subclass that lies about its contents under certain circumstances. This
>
would be somewhat tricky; for example, you have to let the layout
>
manager know when you change your mind. Second, you could create an
>
NSTypesetter subclass that modifies the glyph stream before calling the
>
stock typesetter. It is allowed for the typesetter to modify the glyph
>
stream--typically by inserting glyphs, e.g. hyphens--so in theory this
>
should be possible. Third, you could create an NSTypesetter subclass
>
that would insert an @ in the glyph stream and lay out the other glyphs
>
as not shown, for the hidden regions, or call the stock typesetter for
>
everything else.
How is this handled for any other custom attribute?
Where is it that one taps in to take care of properly drawing those
glyph ranges?
In this case, you could just have a range have the attribute "hidden"
or "invisible", and when you drew that range... well, you wouldn't
and it would have a zero-sized glyph rect to boot.
"A book is a wonderful thing. It feels good to hold. It doesn't
require electricity or batteries. You can slap a Post-It (TM) note
on a key page or passage. You can grab it off the shelf & refer to
it easily, without waiting for all your Extensions & Control Panels
to load. You can throw it at the dog. And it's easier to use in
the bath-room than a PowerBook." --- Bob LeVitus & Jeff Evans 1995
_WebMaster Macintosh_ pg 4
John G. Otto, Eagle Scout, Knight, Cybernetic Praxeologist
Existence, Consciousness, Identity, Life, Liberty, Property, Privacy, Justice