This figure shows the basic architecture for
the Unicode Text Framework style classes:

The framework currently supports two types
of styles: character styles and paragraph styles. These styles
derive from the abstract classes ICharacterStyle
and IParagraphStyle, respectively, and are
distinguished by how they propagate:
Paragraph styles include justification and indentation. For example, if you apply a paragraph style such
as a justification style to a range of characters, IText
automatically applies it to the entire paragraph (or multiple
paragraphs) containing that range. Paragraph styles may be
adjusted as text is edited, for example, if paragraph separator
characters are added or deleted.
The framework includes fifteen concrete
style classes:

When you create a style object, give it a
meaningful value. For example, you might give the value
"12" to an ITextPointSizeStyle object or the value IParagraphJustificationStyle::kCenter
to an IParagraphJustificationStyle object. No default values are
provided--if you don't specify a value when you create a style
object, the style's value remains undefined.
Using an undefined style may be useful,
for example, in situations where the value is unimportant (such
as calling IText::removeStyles) or where you create the style
object to pass it to another function that will fill in the
value.
The style classes also provide the ITextStyleSet,
which lets you group styles. For example, you could add several
styles to a range of characters with a single call to IText. Any
IText function that takes an ITextStyle
parameter is overloaded to take an ITextStyleSet parameter as
well.
This figure shows the methods for setting
styles on IText:

Character styles derive from
ICharacterStyle. ICharacterStyle::propagates returns the value
ITextStyle::kPropagateByCharacter. You can apply these character
styles to any arbitrary range of characters, from a single
character to all characters in an IText object.
This table describes the concrete character
styles currently provided by the framework, along with the type
of value each contains.
| Class |
Description |
Value |
| ITextTypefaceStyle |
Specifies the typeface to use to
display characters. |
An IText object encapsulating the
name of the typeface, for example, "Helvetica."
|
| ITextPointSizeStyle |
Specifies the point size in which
to display characters. |
A float representing
the point size, for example, "14." |
| ITextBoldfaceStyle |
Specifies whether characters are
displayed in boldface, for example, SampleString. |
A bool-true
means the characters are displayed in boldface. |
| ITextItalicStyle |
Specifies whether characters are
displayed in italics, for example, SampleString.
|
A bool-true
means the characters are displayed in italics. |
| ITextUnderlineStyle |
Specifies whether characters are
displayed underlined, for example, SampleString. |
A bool-true
means the characters are underlined. |
| ITextStrikethroughStyle |
Specifies whether characters are
displayed with a strikethrough line, for example,
SampleString. |
A bool-true
means the characters are struckthrough. |
| ITextOutlineStyle |
Specifies whether character are
displayed in an outline typeface, for example,
SampleString. |
A bool-true
means the characters are outlined. |
| ITextUneditableStyle |
Specifies whether characters can be
edited. This is currently the only style that is not
related to text display. |
A bool-true
means the character cannot be edited. |
| ITextColorStyle |
Specifies a color to use to display
characters. |
Three unsigned char
values representing the red, green, and blue components
of the color. |
| ITextSuperSubscriptStyle |
Specifies a shift from the
baseline, in points, for displaying characters as
superscripts or subscripts. |
A float representing
the baseline shift. A negative value creates a subscript.
A positive value create a superscript. |
Paragraph styles derive from
IParagraphStyle. IParagraphStyle::propagates returns the value
ITextStyle::kPropagateByParagraph. You can apply paragraph styles
only to whole paragraphs, that is, to ranges of characters
delimited by UUnicodeSpecial::kParagraphSeparator
characters.
If you apply paragraph styles to a range of
characters that is less than a paragraph or that intersects
multiple paragraphs, IText propagates the paragraph styles to all
the relevant paragraphs. The styles also remain associated with
the paragraph as the number of characters in the paragraphs
changes during editing.
This table describes the concrete paragraph
styles currently provided by the framework, along with the type
of value each contains.
| Class |
Description |
Value |
| IParagraphJustificationStyle |
Specifies the alignment of the
paragraph. Alignment is specified relative to the
directionality of the writing system. For example,
starting-edge-aligned means on the left for left-to-right
languages such as English. |
EJustification enum, defining the
possible values kStart, kCenter, and kEnd. |
| IParagraphSpreadStyle |
Specifies whether no lines, all
lines, or all but the last line of the paragraph are
fully justified. |
ESpread enum, defining the possible
values kNone, kAll, and kNotLastLine. |
| IParagraphStartIndentStyle |
Specifies an indent distance, in
points, for the starting edge (the left edge in
left-to-right writing systems) of the paragraph. |
A float representing
the indent distance in points. |
| IParagraphEndIndentStyle |
Specifies an indent distance, in
points, for the ending edge (the right edge in
left-to-right writing systems) of the paragraph. |
A float representing
the indent distance in points. |
| IParagraphFirstIndentStyle |
Specifies an indent distance, in
points, for the starting edge of the first line of the
paragraph. |
A float representing
the indent distance in points. |
Currently the set of styles supported by
the Unicode Text Framework is not extensible--that is, you cannot
create your own subclasses of ITextStyle, ICharacterStyle, or
IParagraphStyle. Future Open Class releases may support extending
this style mechanism.

Style Propagation