Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]


Introduction to formatting

Editable text and plain text have content, but no formatting. This means they can be stored and manipulated, but cannot be viewed, because viewing needs format information — obviously, it needs a font and, more subtly, it also needs paragraph alignment, colour etc.

There are two types of format: character and paragraph formats

In order to economise on space, format specifications are built up in format layers CParaFormatLayer and CCharFormatLayer. Each layer specifies a number of attributes and their values. Functions are provided to manipulate and interrogate the attributes and values in a layer, and to find out the effective format from all the layers applying to a region of the text object. Format mask classes TParaFormatMask and TCharFormatMask play a key role in specifying which attributes are involved in these operations.

For global text, the same formatting applies to the entire text object. A character and paragraph format layer are specified for the global text object's constructor, and are used throughout the lifetime of the object. The effective format is taken by layering these over a default format which specifies values for all attributes.

For rich text, format layers may be overlaid, and may apply to any region of the text object. By this means, formatting for each character and paragraph may be controlled individually.

A paragraph style is a named format, represented by the CParagraphStyle class, which may be applied to a paragraph. A style may either replace all attributes already set, or change only the attributes specified in the layer. The paragraph style is a paragraph format layer with a name and, also, a character format layer which sets character formatting in the paragraph.