< Previous PageNext Page > Hide TOC

Plain and Rich Text Objects

Text objects such as NSText and NSTextView can contain either plain text or rich text. Plain text objects allow only one set of text attributes for all of their text; rich text objects allow multiple fonts, sizes, indents, and other attributes for different sets of characters and paragraphs. You can control whether a text object is plain or rich using the setRichText: method. Rich text objects are also capable of allowing the user to drag images and files into them. This behavior is controlled by the setImportsGraphics: method.

A rich NSText object can use RTF (Rich Text Format) as an interchange format. Not all RTF control words are supported, however. On input, an NSText object ignores any control word it doesn’t recognize; some of those it can read and interpret it doesn’t write out. Table 1 lists the RTF control words that any text object recognizes. Subclasses may recognize more.

Table 1  RTF control words recognized by all text objects

Control word

Can be written out

\ansi

yes

\b

yes

\cb

yes

\cf

yes

\colortbl

yes

\dnn

yes

\fin

yes

\fn

yes

\fonttbl

yes

\fsn

yes

\i

yes

\lin

yes

\margrn

yes

\paperwn

yes

\mac

no

\margln

yes

\par

yes

\pard

no

\pca

no

\qc

yes

\ql

yes

\qr

yes

\sn

no

\tab

yes

\upn

yes



< Previous PageNext Page > Hide TOC


© 1997, 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-06-28)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.