### Style Propagation

The Unicode Text Framework uses the propagation of a style to determine how it can be applied to character ranges and how the affected style runs change as the characters are edited. The framework currently defines two types of style propagation:

- Character-based propagation
- Paragraph-based propagation

Styles that propagate by character can be applied to any arbitrary range of at least one character. The styles remain with these characters regardless of how characters within that range or surrounding that range are edited. Styles applied to a range of characters also propagate to any new text entered into that range.

For example, this shows a sequence of possible editing changes:

Styles that propagate by paragraph can be applied only to paragraphs--ranges of characters delimited by paragraph-separator characters (UUnicodeSpecial::kParagraphSeparator). This makes the style propagation mechanism more complicated than it is for character styles, because IText has to repropagate paragraph styles when paragraph separator characters are added or deleted.

The mechanism for propagating styles follows these rules:

- A text string containing no paragraph-separator characters takes on the paragraph styles of the text into which it is inserted.
- A text string bounded on both sides by paragraph-separator characters retains its paragraph styles even when inserted into text containing other paragraph styles.
- A range of text that is inserted into another string and then deleted should have the same paragraph separators and paragraph styles as it did before the editing operations.

IText propagates paragraph styles backwards from the character closest to a paragraph separator back to the beginning of the paragraph. For example, if you have two text strings containing several paragraphs with different paragraph styles:

When propagating paragraph styles, IText recognizes only the UUnicodeSpecial::kParagraphSeparator character (U+2029) to be a paragraph-separator character. When text in other character encoding systems is transcoded into Unicode, you must ensure that it is processed by an ILineBreakConverter object so that the separator characters are transcoded correctly.

Styles and Style Sets
Transcoding Classes

Editing Character Data in an IText Object