>689
see NSTextStorage, NSLyaoutManager, NSTextContainer とか。

http://developer.apple.com/documentation/Cocoa/Conceptual/TextLayout/index.html

とか。