Re: Non-View Text Engine
Re: Non-View Text Engine
- Subject: Re: Non-View Text Engine
- From: Douglas Davidson <email@hidden>
- Date: Fri, 26 Sep 2003 14:10:57 -0700
On Friday, September 26, 2003, at 12:25 AM, Gordon Apple wrote:
I have taken a top level look at NSText, NSTextView, and the
TextEdit
example. My problem is that I want the text engine outside the text
views.
I want to be able to flow text into an arbitrary draw shape and I want
it
drawn in my specified draw order, not in the view heirarchy drawing
order.
I would also like to be able to use menus, typing, mouse actions, etc.
just
as if the text were in a NSTextView. I would also like to show a
Ruler view
when needed. When I used MacApp, I solved the problem by writing my
own
fairly sophisticated text engine. However, I did not have UniCode,
bi-directional text, anti-aliasing, and a few other features Cocoa text
provides.
Nothing actually forces you to allow your views to be drawn using the
standard display machinery; a suitable overriding of
setNeedsDisplayInRect:, drawRect:, and related methods ought to allow
you to place your views in the hierarchy so that they receive events,
but to prevent them from being drawn as usual. Why you would want to
prevent your views from being drawn as usual is another matter.
To flow text into arbitrary containers, you would use a custom
NSTextContainer subclass. To use the Cocoa text system without a text
view, just use NSTextStorage, NSLayoutManager, and NSTextContainer as
in the CircleView example. Look through the documentation and
examples, and you will see that the text system is designed for
extensive customizability in many, many ways.
It is, of course, also open to you to write your own text engine. We
also have anticipated this contingency, and you will find that you can
hook in to things like the font panel, the color panel, spellchecking,
input methods, and so forth with your own custom view instead of an
NSTextView.
Douglas Davidson
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.