background image
C H A P T E R 8
Text and Ink Input and Display
Using Text
8-23
Important Rich String Considerations
8
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
Length
,
SetLength
,
BinaryMunger
, and
StuffXXX
functions.
Use the
StrLen
function to find the length of a string.
Use the
StrMunger
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
the string.
Do not assign characters into a rich string, due to the presence of ink place-
holder characters. Use the
SetChar
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
8
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
terminator character.
Each ink word is represented in the text portion of the rich string by the special
character
kInkChar
(
0xF700
), 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.
Note
The string in the
'text
slot of a paragraph view uses the
kParaInkChar
(
0xF701
) character as a placeholder character
instead of the
kInkChar
code. The
'text
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
8
Text is automatically converted from the rich string format to a text/styles pair when-
ever a paragraph is opened and the
SetValue
function is called with a rich string.
When a paragraph view is opened, the
'text
slot is first examined to determine
whether or not the text contains any embedded ink. If so, new versions of the
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна