C H A P T E R 8
Text and Ink Input and Display
Using Text
8-25
Text and Styles
8
Within a paragraph view, text is represented in two slots: the
'text
slot and the
'styles
slot. The
'text
slot contains the sequence of text characters in the
paragraph, including an instance of the
kParaInkChar
placeholder character
(
0xF701
) for each ink word.
The
'styles
slot specifies how each text run is displayed in the paragraph. A
text run is a sequence of characters that are all displayed with the same font
specification. The
'styles
slot consists of an array of alternating length and style
information: one length value and one style specification for each text run. For ink
words, the length value is always
1
, and the style specification is a binary object
that contains the ink data.
For example, consider the paragraph text shown in Figure 8-5.
Figure 8-5
A paragraph view containing an ink word and text
In the paragraph view shown in Figure 8-5, the
'text
slot contains the following
sequence of Unicode characters:
'T' 'r' 'y' ' ' 0xF701 'o' 'n' 'e'
The
'styles
slot for this paragraph consists of the following array:
styles: [4, 12289, 1, <inkData, length 42>, 4, 12289]
The first pair of values in the array, (
4, 12289
), covers the word "Try" and the
space that follows it. The length value,
4
, specifies that the text run consists of four
characters. The packed integer font specification value
12289
specifies plain,
12-point, New York.
The second pair of values in the array, (
1, inkData
), covers the ink word. The
length value is
1
, which is always the case for ink words. The value
inkData
is a
binary object that contains the compressed data for the handwritten "this" that is
part of the text in the paragraph view. The data is automatically extracted from the
tablet data as part of a preliminary recognition process that precedes word recognition.
The third and final pair of values in the
'styles
slot array,
(4, 12289)
, covers
the word "one" and the space that precedes it. This text run is 4 characters long and
is displayed 12 points high in the plain version of the New York font family.
Note
The packed integer font specification values
are shown in Table 8-6 (page 8-21).