• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Overwriting text in an NSTextView?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Overwriting text in an NSTextView?


  • Subject: Re: Overwriting text in an NSTextView?
  • From: Keith Blount <email@hidden>
  • Date: Thu, 15 Jun 2006 12:17:41 -0700 (PDT)

Thank you for your reply, Douglas. I would love to see
the AnnotatedTextDemo code (not only for the
typewriter emulation, but also because I spent a lot
of time on a text annotation system for my main
program, so it sounds very interesting).

I'm not sure I want to go to all the bother of messing
with NSTypeSetter, as this is really only meant to be
a small and simple side-project, and, as you say, it
needs to be obvious to the user what is being output
given that it outputs RTF text. I probably need to
rethink how the typewriter metaphor is going to work.

Thanks again,
Keith


--- Douglas Davidson <email@hidden> wrote:

>
> On Jun 15, 2006, at 9:39 AM, Keith Blount wrote:
>
> > Is there a way to have letters overwrite one
> another
> > using the NSTextView text system? Eg., so that I
> could
> > merge a "g" with an "X" (in my emulator, I would
> like
> > it so that if the user goes back and types,
> instead of
> > the text getting inserted and moving text after it
> > forward, it will overwrite the old text). Not sure
> if
> > this is at all possible, but I'm sure I read
> somewhere
> > ages ago about something like this (probably
> imagining
> > it).
> >
>
> Well, usually this is something we try to avoid. :)
> You can, if you
> like, directly manipulate the glyphs in the layout
> manager--for
> example, inserting new glyphs at arbitrary locations
> in the text and
> arbitrary positions.  You need to be a little
> careful about it,
> because it's easy to shoot yourself in the foot this
> way.  You should
> think about how you want this to work in general,
> though--the Cocoa
> text system is based on taking a text document
> (NSTextStorage) and
> from it producing a set of glyphs and positions in
> the layout
> manager.  Just how do you plan on representing your
> overstrikes in
> the text document?
>
> If you represent them as characters, then maybe you
> can use a
> typesetter subclass to arrange the positioning you
> want--that would
> probably be the most robust way to do it.  If the
> overstrikes are
> represented as attributes, then perhaps you don't
> need to insert
> glyphs in the layout manager--maybe you just need to
> do some extra
> drawing.  I showed an example of something along
> those lines at WWDC
> in 2003, my "AnnotatedTextDemo".  I can make that
> code available if
> you want it.
>
> Douglas Davidson
>
>


__________________________________________________
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

References: 
 >Re: Overwriting text in an NSTextView? (From: Douglas Davidson <email@hidden>)

  • Prev by Date: Text Capture in Cocoa
  • Next by Date: Apple's Secret Desktop Sauce
  • Previous by thread: Re: Overwriting text in an NSTextView?
  • Next by thread: setSelectedTextAttributes not fully supported?
  • Index(es):
    • Date
    • Thread