• 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: ATSUI vs NSTextView?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ATSUI vs NSTextView?


  • Subject: Re: ATSUI vs NSTextView?
  • From: Douglas Davidson <email@hidden>
  • Date: Tue, 28 Aug 2001 09:35:10 -0700

On Tuesday, August 28, 2001, at 05:07 AM, David Masters wrote:

I'm writing a Cocoa application that will require fine control over typography (kerning, tracking, possibly text on a curve) for relatively small amounts of text, and so far the main alternatives seem to be either to work with ATSUI directly, or utilise NSTextView and associated classes.

Example source code for ATSUI seems to be scarce (apart from Apple's TypeServicesForUnicode example) - does this imply that most people prefer not to work directly with ATSUI? From reading the documentation, it appears that NSTextView is extremely powerful, and calls ATSUI anyway. So, if I go with NSTextView and related classes such as NSAttributedString instead, are there any features or functionality from ATSUI I'll be missing out on, or any performance penalties that I might encounter?

I can't really make a recommendation as between the Cocoa text system and ATSUI, but I can say that the Cocoa text system is extensive and flexible, and you can probably get it to do almost anything you want to do.

The Cocoa text system is made up of a number of pieces, of which NSTextView is only the visible tip--the view in the model-view-controller paradigm. The central class, the controller, is NSLayoutManager, which coordinates all of the others--NSTextContainer, NSTextStorage, NSTypesetter, and so on. By going directly to NSLayoutManager it is possible to display a glyph, or a sequence of glyphs, in a custom view, at any location you choose, if you need that level of control.

On the other hand, if all you need is control over kerning and baselines, you can easily get that in a standard NSTextView configuration. Take a look at TextEdit, and try the various submenus in the Font menu.

If your needs are somewhere in between, you can take a standard NSTextView and manipulate its underlying NSLayoutManager. You also have the option of supplying an entire custom NSTypesetter subclass to do all your own layout.

There are some examples of text system usage in /Developer/Examples/AppKit, and I believe we will be coming out with at least one new one in the next release. If you have more specific questions, you can probably find answers on this list.

Douglas Davidson


References: 
 >ATSUI vs NSTextView? (From: David Masters <email@hidden>)

  • Prev by Date: Re: NSDictionary objectForKey and non-standard key classes
  • Next by Date: Re: Cocoa and MySql
  • Previous by thread: ATSUI vs NSTextView?
  • Next by thread: NSDictionary objectForKey and non-standard key classes
  • Index(es):
    • Date
    • Thread