BuildTextFragments2 works by render complete style runs as a single block rather than calculating information for each and every character. This results in a dramatic performance boost as well as better character layout results.
The layout calculations are as follows: 1. Generate line start and line length arrays. 2. Build a list of all style runs within the text block. 3. Calculate the heights of each line 4. Calculate the horizontal offset for each line based upon the alignment requirements. 5. Build a text block for each style run in every line and add it to the rendering list.
The class Draw() method adds the generated shapes to the instance group object for rendering puropses. The BuildTextFragments2 method does NOT render. That is left to the Draw method.
AD Comments on rewriting BuildTextFragments
Rewritten to make optimal use of the new RB5.5 styledText and because of a few bugs particularly under Windows.
The motivation behind some things is that the word-wrapping of lines doesn't affect the StyledText StyleRun or Paragraph classes (see StyleRunStats test).
We therefore still need to break things into our own blocks and work out the line dimensions.
Exact nature of how text offsets are calculated
mDrawGroup is recreated in ADStraightTextObject.Draw with coords of 0,0 After assigning all the text fragments to it, it is set to mDragObject.X/Y which means they will all translate (this is after rotation).
1.5.1