O'Reilly logo

C++ Windows Programming by Stefan Björnander

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required