background image
C H A P T E R 8
Text and Ink Input and Display
Using Text
Text and Styles
Within a paragraph view, text is represented in two slots: the
slot and the
slot. The
slot contains the sequence of text characters in the
paragraph, including an instance of the
placeholder character
) for each ink word.
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
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
, 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
slot contains the following
sequence of Unicode characters:
'T' 'r' 'y' ' ' 0xF701 'o' 'n' 'e'
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,
, specifies that the text run consists of four
characters. The packed integer font specification value
specifies plain,
12-point, New York.
The second pair of values in the array, (
1, inkData
), covers the ink word. The
length value is
, which is always the case for ink words. The value
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
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.
The packed integer font specification values
are shown in Table 8-6 (page 8-21).
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна