C H A P T E R 8
Text and Ink Input and Display
Important Rich String Considerations
Although the Newton system software allows you to use rich strings anywhere that
plain strings are used, there are certain considerations to be aware of when using
rich strings. These include:
Do not use functions that are not rich-string-aware. These include the
function to find the length of a string.
function to perform operations that modify the length of a
string, such as appending or deleting characters.
Do not assume that the rich string terminator character is the last character in a
rich string object.
Do not truncate a rich string by inserting a string terminator character into
Do not assign characters into a rich string, due to the presence of ink place-
holder characters. Use the
function instead of direct assignment.
Do not use undocumented string functions, which are not guaranteed to work
with rich strings.
Using the Rich String Storage Format
Ink data is embedded in rich strings by inserting a placeholder character in the
string for each ink word. Data for each ink word is stored following the string
Each ink word is represented in the text portion of the rich string by the special
), which is a reserved Unicode character value.
The ink data for all ink words in the string follows the string terminator character.
The final 32 bits in a rich string encode information about the rich string.
The string in the
slot of a paragraph view uses the
) character as a placeholder character
instead of the
slot string is not a
rich string but might contain ink word placeholders. See "Text and
Styles" (page 8-25) for more information.
Automatic Conversion of Rich Strings
Text is automatically converted from the rich string format to a text/styles pair when-
ever a paragraph is opened and the
function is called with a rich string.
When a paragraph view is opened, the
slot is first examined to determine
whether or not the text contains any embedded ink. If so, new versions of the