Character calculation
The GenerateParagraph
fucnction generates the character rectangles and the line lists of a paragraph every time characters are added or removed or when the font or alignment is changed. First, we generate lists of sizes and ascents for every character as well as the line list by calling the GenerateSizeAndAscentList
and GenerateLineList
methods. Then, we iterate through the line list and generate the character rectangles by calling the GenerateLineRectList
method. Finally, we invalidate the characters that have been changed by comparing them to the original rectangle lists:
void WordDocument::GenerateParagraph(Paragraph* paragraphPtr) { if (!charList.Empty()) { DynamicList<Size> sizeList; DynamicList<int> ascentList; DynamicList<CharInfo> prevCharList; charList.Copy(prevCharList, paragraphPtr->First(), paragraphPtr->Last()); GenerateSizeAndAscentList...