beautypg.com

Apple Newton Programmer’s Newton 2.0 (for Newton 2.0) User Manual

Page 314

background image

C H A P T E R 8

Text and Ink Input and Display

8-22

Using Text

Note that the “Casual” font uses the symbol

'handwriting

for its font family.

You can use the

MakeCompactFont

function at runtime to create a packed

integer value from a specification of the font family, font size, and font face. You
can only specify ROM fonts with the packed integer format. Here is an example:

fontValue := MakeCompactFont('tsSimple, 12, tsItalic)

If the font specified by the three parameters does not belong to a ROM font family,

MakeCompactFont

returns a font frame instead.

The

MakeCompactFont

function is described in “MakeCompactFont”

(page 7-28) in Newton Programmer’s Reference.

Rich Strings

8

Rich strings store text strings and ink in a single string. If you application supports
user-input text or ink, you can use rich strings to represent all user data. You can
convert between the text and styles pairs in paragraph views and rich strings. Text
and styles pair are described in “Text and Styles” (page 8-25).

Rich strings are especially useful for storing text with embedded ink in a soup. You
can use the rich string functions, described in “Rich String Functions” (page 8-24),
to work with rich strings.

The system software automatically handles rich strings properly, including their
use in performing the following operations:

screen display

sorting and indexing

concatenation with standard functions such as

StrConcat

and

ParamStr

,

described in “Utility Functions” (page 26-1)

measuring

tsItalic

2097152

Italic font

tsUnderline

4194304

Underlined normal font

tsOutline

8388608

Outline font

tsSuperScript

134217728

Superscript font

tsSubScript

268435456

Subscript font

Table 8-6

Font packing constants (continued)

Constant

Value

Description