|[Top] [Chapter] [Previous] [Next]|
A document can contain a lot of different elements.
First of all the text. Such text consists of characters which are combined in paragraphs.
The paragraphs may be part of a table cell, of a layer, such as a header or footer text, a footnote or the contents of a text box. (Footnotes and textboxes are only supported by the premium edition).
It is important to know, that each character may have its individual set of attributes.
The attributes are not stored in a record which belongs to the character but using a 3 bytes of a 4 byte index value to an attribute cache. This index value is referred to as "CharAttr". The 4th byte is used to store certain flags which are temporarily used for characters, most important to support spellcheck with curly underlines. The CharAttr index values can be calculated by "AttrHelper".
Up to 16 different attribute types are supported for individual characters. Some of this attributes are reserved.
1: the Font, such as "Arial"
2: the charset, such as ansi, baltic, russian etc.
3: the size in points, such as 11pt or 8.5pt
4: the character width - this property is reserved
5: a special character effect, this is also reserved
6: a bit field which controls which of 15 flags are used (CharStyleMask). This flags are used for "bold", "italic" ...
7: a bit field to activate each of the 15 flags (CharStyleON)
8: a text color
9: a background color
10: the letter spacing
11: a reserved property. Please do not use it.
12: a reserved property. Please do not use it.
13: a special underline mode, such as dotted or double
14: the underline color
15: the text language code. This is not used yet.
16: a text style sheet
All the attributes can be undefined as well. In this case the value for the text is inherited by the definition in a preceding SPAN style element, the current paragraph or the paragraph style which is used by this paragraph.
Consequently each attribute defined in a paragraph style is overridden by the attributes defined for a character, if this character has such a definition.
Therefore the character style, such as "bold", "italic", use two bitfields for definition. One to enable the slot (6=mask), the other (on=7) to switch it on or off. The engine however does not need the enable flag if the flag is set in the "on" bit field. But if it is set in "mask" and not set in the "on", this means the style is forced to be off, even if a possible paragraph style has this style enabled.
This graphic shows how attributes are stored in a paragraph style, a paragraph and the attribute cache:
In this chapter we discuss how text and other elements are added to the document.