RTF Semantics

When reading a stream of RTF text, an RTF reader must accomplish the following tasks:

1.1.Separate RTF control information from plain text.

2.2.Act on control information.

This is designed to be a relatively simple process, as described in the next section.

Some control information just contributes special characters to the plain text stream. Other information changes the program state, which includes document properties as a whole and a stack of group states that apply to parts of the document. The group state is saved by the opening { brace and is restored by the closing } brace.

The current group state specifies:

nThe destination or part of the document that the plain text is building up.

nThe section formatting properties.

nThe paragraph formatting properties.

nThe character formatting properties.

3.3.Collect and properly dispose of any remaining plain text as directed by the current group state.